MCPcopy Create free account
hub / github.com/git/git / read_revisions_from_stdin

Function read_revisions_from_stdin

revision.c:2937–2983  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2935}
2936
2937static void read_revisions_from_stdin(struct rev_info *revs,
2938 struct strvec *prune)
2939{
2940 struct strbuf sb;
2941 int seen_dashdash = 0;
2942 int seen_end_of_options = 0;
2943 int save_warning;
2944 int flags = 0;
2945 struct repo_config_values *cfg = repo_config_values(the_repository);
2946
2947 save_warning = cfg->warn_on_object_refname_ambiguity;
2948 cfg->warn_on_object_refname_ambiguity = 0;
2949
2950 strbuf_init(&sb, 1000);
2951 while (strbuf_getline(&sb, stdin) != EOF) {
2952 if (!sb.len)
2953 break;
2954
2955 if (!strcmp(sb.buf, "--")) {
2956 seen_dashdash = 1;
2957 break;
2958 }
2959
2960 if (!seen_end_of_options && sb.buf[0] == '-') {
2961 const char *argv[] = { sb.buf, NULL };
2962
2963 if (!strcmp(sb.buf, "--end-of-options")) {
2964 seen_end_of_options = 1;
2965 continue;
2966 }
2967
2968 if (handle_revision_pseudo_opt(revs, argv, &flags) > 0)
2969 continue;
2970
2971 die(_("invalid option '%s' in --stdin mode"), sb.buf);
2972 }
2973
2974 if (handle_revision_arg(sb.buf, revs, flags,
2975 REVARG_CANNOT_BE_FILENAME))
2976 die("bad revision '%s'", sb.buf);
2977 }
2978 if (seen_dashdash)
2979 read_pathspec_from_stdin(&sb, prune);
2980
2981 strbuf_release(&sb);
2982 cfg->warn_on_object_refname_ambiguity = save_warning;
2983}
2984
2985static void NORETURN diagnose_missing_default(const char *def)
2986{

Callers 1

setup_revisionsFunction · 0.85

Calls 8

strbuf_initFunction · 0.85
strbuf_getlineFunction · 0.85
handle_revision_argFunction · 0.85
read_pathspec_from_stdinFunction · 0.85
strbuf_releaseFunction · 0.85
repo_config_valuesClass · 0.70
dieFunction · 0.70

Tested by

no test coverage detected