MCPcopy Index your code
hub / github.com/git/git / sequencer_make_script

Function sequencer_make_script

sequencer.c:6154–6237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6152}
6153
6154int sequencer_make_script(struct repository *r, struct strbuf *out,
6155 struct strvec *argv, unsigned flags)
6156{
6157 char *format = NULL;
6158 struct pretty_print_context pp = {0};
6159 struct rev_info revs;
6160 struct commit *commit;
6161 int keep_empty = flags & TODO_LIST_KEEP_EMPTY;
6162 const char *insn = flags & TODO_LIST_ABBREVIATE_CMDS ? "p" : "pick";
6163 int rebase_merges = flags & TODO_LIST_REBASE_MERGES;
6164 int reapply_cherry_picks = flags & TODO_LIST_REAPPLY_CHERRY_PICKS;
6165 int skipped_commit = 0;
6166 int ret = 0;
6167
6168 repo_init_revisions(r, &revs, NULL);
6169 revs.verbose_header = 1;
6170 if (!rebase_merges)
6171 revs.max_parents = 1;
6172 revs.cherry_mark = !reapply_cherry_picks;
6173 revs.limited = 1;
6174 revs.reverse = 1;
6175 revs.right_only = 1;
6176 revs.sort_order = REV_SORT_IN_GRAPH_ORDER;
6177 revs.topo_order = 1;
6178
6179 revs.pretty_given = 1;
6180 repo_config_get_string(the_repository, "rebase.instructionFormat", &format);
6181 if (!format || !*format) {
6182 free(format);
6183 format = xstrdup("# %s");
6184 }
6185 if (*format != '#') {
6186 char *temp = format;
6187 format = xstrfmt("# %s", temp);
6188 free(temp);
6189 }
6190
6191 get_commit_format(format, &revs);
6192 free(format);
6193 pp.fmt = revs.commit_format;
6194 pp.output_encoding = get_log_output_encoding();
6195
6196 setup_revisions_from_strvec(argv, &revs, NULL);
6197 if (argv->nr > 1) {
6198 ret = error(_("make_script: unhandled options"));
6199 goto cleanup;
6200 }
6201
6202 if (prepare_revision_walk(&revs) < 0) {
6203 ret = error(_("make_script: error preparing revisions"));
6204 goto cleanup;
6205 }
6206
6207 if (rebase_merges) {
6208 ret = make_script_with_merges(&pp, &revs, out, flags);
6209 goto cleanup;
6210 }
6211

Callers 1

do_interactive_rebaseFunction · 0.85

Calls 15

repo_init_revisionsFunction · 0.85
repo_config_get_stringFunction · 0.85
xstrdupFunction · 0.85
xstrfmtFunction · 0.85
get_commit_formatFunction · 0.85
get_log_output_encodingFunction · 0.85
errorFunction · 0.85
prepare_revision_walkFunction · 0.85
make_script_with_mergesFunction · 0.85
get_revisionFunction · 0.85
is_original_commit_emptyFunction · 0.85

Tested by

no test coverage detected