sequencer.c: remove implicit dependency on the_index

Since we're going to pass 'struct repository *' around most of the time instead of 'struct index_state *' because most sequencer.c operations need more than just the index, the_repository is replaced as well in the functions that now take 'struct repository *'. the_repository is still present in this file, but total clean up will be done later. It's not the main focus of this patch. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Nov 10, 2018 at 06:48 UTC f11c95805495fcb588f767ffab193f2aed328eab
6 files changed +197 -152
builtin/commit.c
+2 -1
@@ -1679,7 +1679,8 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
1679 flags |= SUMMARY_INITIAL_COMMIT;
1680 if (author_date_is_interesting())
1681 flags |= SUMMARY_SHOW_AUTHOR_DATE;
1682 - print_commit_summary(prefix, &oid, flags);
1682 + print_commit_summary(the_repository, prefix,
1683 + &oid, flags);
1684 }
1685
1686 UNLEAK(err);
builtin/merge.c
+1 -1
@@ -896,7 +896,7 @@ static int suggest_conflicts(void)
896 filename = git_path_merge_msg(the_repository);
897 fp = xfopen(filename, "a");
898
899 - append_conflicts_hint(&msgbuf);
899 + append_conflicts_hint(&the_index, &msgbuf);
900 fputs(msgbuf.buf, fp);
901 strbuf_release(&msgbuf);
902 fclose(fp);
builtin/rebase--interactive.c
+2 -2
@@ -105,7 +105,7 @@ static int do_interactive_rebase(struct replay_opts *opts, unsigned flags,
105 if (restrict_revision)
106 argv_array_push(&make_script_args, restrict_revision);
107
108 - ret = sequencer_make_script(todo_list,
108 + ret = sequencer_make_script(the_repository, todo_list,
109 make_script_args.argc, make_script_args.argv,
110 flags);
111 fclose(todo_list);
@@ -235,7 +235,7 @@ int cmd_rebase__interactive(int argc, const char **argv, const char *prefix)
235 rerere_clear(&merge_rr);
236 /* fallthrough */
237 case CONTINUE:
238 - ret = sequencer_continue(&opts);
238 + ret = sequencer_continue(the_repository, &opts);
239 break;
240 }
241 case EDIT_TODO:
builtin/revert.c
+2 -2
@@ -199,10 +199,10 @@ static int run_sequencer(int argc, const char **argv, struct replay_opts *opts)
199 return ret;
200 }
201 if (cmd == 'c')
202 - return sequencer_continue(opts);
202 + return sequencer_continue(the_repository, opts);
203 if (cmd == 'a')
204 return sequencer_rollback(opts);
205 - return sequencer_pick_revisions(opts);
205 + return sequencer_pick_revisions(the_repository, opts);
206 }
207
208 int cmd_revert(int argc, const char **argv, const char *prefix)
sequencer.c
+180 -141
@@ -445,9 +445,9 @@ static struct tree *empty_tree(void)
445 return lookup_tree(the_repository, the_repository->hash_algo->empty_tree);
446 }
447
448 -static int error_dirty_index(struct replay_opts *opts)
448 +static int error_dirty_index(struct index_state *istate, struct replay_opts *opts)
449 {
450 - if (read_cache_unmerged())
450 + if (read_index_unmerged(istate))
451 return error_resolve_conflict(_(action_name(opts)));
452
453 error(_("your local changes would be overwritten by %s."),
@@ -472,15 +472,18 @@ static void update_abort_safety_file(void)
472 write_file(git_path_abort_safety_file(), "%s", "");
473 }
474
475 -static int fast_forward_to(const struct object_id *to, const struct object_id *from,
476 - int unborn, struct replay_opts *opts)
475 +static int fast_forward_to(struct repository *r,
476 + const struct object_id *to,
477 + const struct object_id *from,
478 + int unborn,
479 + struct replay_opts *opts)
480 {
481 struct ref_transaction *transaction;
482 struct strbuf sb = STRBUF_INIT;
483 struct strbuf err = STRBUF_INIT;
484
482 - read_index(&the_index);
483 - if (checkout_fast_forward(the_repository, from, to, 1))
485 + read_index(r->index);
486 + if (checkout_fast_forward(r, from, to, 1))
487 return -1; /* the callee should have complained already */
488
489 strbuf_addf(&sb, _("%s: fast-forward"), _(action_name(opts)));
@@ -506,24 +509,26 @@ static int fast_forward_to(const struct object_id *to, const struct object_id *f
509 return 0;
510 }
511
509 -void append_conflicts_hint(struct strbuf *msgbuf)
512 +void append_conflicts_hint(struct index_state *istate,
513 + struct strbuf *msgbuf)
514 {
515 int i;
516
517 strbuf_addch(msgbuf, '\n');
518 strbuf_commented_addf(msgbuf, "Conflicts:\n");
515 - for (i = 0; i < active_nr;) {
516 - const struct cache_entry *ce = active_cache[i++];
519 + for (i = 0; i < istate->cache_nr;) {
520 + const struct cache_entry *ce = istate->cache[i++];
521 if (ce_stage(ce)) {
522 strbuf_commented_addf(msgbuf, "\t%s\n", ce->name);
519 - while (i < active_nr && !strcmp(ce->name,
520 - active_cache[i]->name))
523 + while (i < istate->cache_nr &&
524 + !strcmp(ce->name, istate->cache[i]->name))
525 i++;
526 }
527 }
528 }
529
526 -static int do_recursive_merge(struct commit *base, struct commit *next,
530 +static int do_recursive_merge(struct repository *r,
531 + struct commit *base, struct commit *next,
532 const char *base_label, const char *next_label,
533 struct object_id *head, struct strbuf *msgbuf,
534 struct replay_opts *opts)
@@ -537,7 +542,7 @@ static int do_recursive_merge(struct commit *base, struct commit *next,
542 if (hold_locked_index(&index_lock, LOCK_REPORT_ON_ERROR) < 0)
543 return -1;
544
540 - read_cache();
545 + read_index(r->index);
546
547 init_merge_options(&o);
548 o.ancestor = base ? base_label : "(empty tree)";
@@ -566,7 +571,7 @@ static int do_recursive_merge(struct commit *base, struct commit *next,
571 return clean;
572 }
573
569 - if (write_locked_index(&the_index, &index_lock,
574 + if (write_locked_index(r->index, &index_lock,
575 COMMIT_LOCK | SKIP_IF_UNCHANGED))
576 /*
577 * TRANSLATORS: %s will be "revert", "cherry-pick" or
@@ -576,26 +581,26 @@ static int do_recursive_merge(struct commit *base, struct commit *next,
581 _(action_name(opts)));
582
583 if (!clean)
579 - append_conflicts_hint(msgbuf);
584 + append_conflicts_hint(r->index, msgbuf);
585
586 return !clean;
587 }
588
584 -static struct object_id *get_cache_tree_oid(void)
589 +static struct object_id *get_cache_tree_oid(struct index_state *istate)
590 {
586 - if (!active_cache_tree)
587 - active_cache_tree = cache_tree();
591 + if (!istate->cache_tree)
592 + istate->cache_tree = cache_tree();
593
589 - if (!cache_tree_fully_valid(active_cache_tree))
590 - if (cache_tree_update(&the_index, 0)) {
594 + if (!cache_tree_fully_valid(istate->cache_tree))
595 + if (cache_tree_update(istate, 0)) {
596 error(_("unable to update cache tree"));
597 return NULL;
598 }
599
595 - return &active_cache_tree->oid;
600 + return &istate->cache_tree->oid;
601 }
602
598 -static int is_index_unchanged(void)
603 +static int is_index_unchanged(struct index_state *istate)
604 {
605 struct object_id head_oid, *cache_tree_oid;
606 struct commit *head_commit;
@@ -616,7 +621,7 @@ static int is_index_unchanged(void)
621 if (parse_commit(head_commit))
622 return -1;
623
619 - if (!(cache_tree_oid = get_cache_tree_oid()))
624 + if (!(cache_tree_oid = get_cache_tree_oid(istate)))
625 return -1;
626
627 return oideq(cache_tree_oid, get_commit_tree_oid(head_commit));
@@ -838,7 +843,9 @@ static int run_command_silent_on_success(struct child_process *cmd)
843 * interactive rebase: in that case, we will want to retain the
844 * author metadata.
845 */
841 -static int run_git_commit(const char *defmsg, struct replay_opts *opts,
846 +static int run_git_commit(struct repository *r,
847 + const char *defmsg,
848 + struct replay_opts *opts,
849 unsigned int flags)
850 {
851 struct child_process cmd = CHILD_PROCESS_INIT;
@@ -861,7 +868,7 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts,
868 if (!defmsg)
869 BUG("root commit without message");
870
864 - if (!(cache_tree_oid = get_cache_tree_oid()))
871 + if (!(cache_tree_oid = get_cache_tree_oid(r->index)))
872 res = -1;
873
874 if (!res)
@@ -1070,7 +1077,9 @@ void commit_post_rewrite(const struct commit *old_head,
1077 run_rewrite_hook(&old_head->object.oid, new_head);
1078 }
1079
1073 -static int run_prepare_commit_msg_hook(struct strbuf *msg, const char *commit)
1080 +static int run_prepare_commit_msg_hook(struct repository *r,
1081 + struct strbuf *msg,
1082 + const char *commit)
1083 {
1084 struct argv_array hook_env = ARGV_ARRAY_INIT;
1085 int ret;
@@ -1080,7 +1089,7 @@ static int run_prepare_commit_msg_hook(struct strbuf *msg, const char *commit)
1089 if (write_message(msg->buf, msg->len, name, 0))
1090 return -1;
1091
1083 - argv_array_pushf(&hook_env, "GIT_INDEX_FILE=%s", get_index_file());
1092 + argv_array_pushf(&hook_env, "GIT_INDEX_FILE=%s", r->index_file);
1093 argv_array_push(&hook_env, "GIT_EDITOR=:");
1094 if (commit)
1095 ret = run_hook_le(hook_env.argv, "prepare-commit-msg", name,
@@ -1136,7 +1145,9 @@ static const char *implicit_ident_advice(void)
1145
1146 }
1147
1139 -void print_commit_summary(const char *prefix, const struct object_id *oid,
1148 +void print_commit_summary(struct repository *r,
1149 + const char *prefix,
1150 + const struct object_id *oid,
1151 unsigned int flags)
1152 {
1153 struct rev_info rev;
@@ -1147,7 +1158,7 @@ void print_commit_summary(const char *prefix, const struct object_id *oid,
1158 struct strbuf author_ident = STRBUF_INIT;
1159 struct strbuf committer_ident = STRBUF_INIT;
1160
1150 - commit = lookup_commit(the_repository, oid);
1161 + commit = lookup_commit(r, oid);
1162 if (!commit)
1163 die(_("couldn't look up newly created commit"));
1164 if (parse_commit(commit))
@@ -1180,7 +1191,7 @@ void print_commit_summary(const char *prefix, const struct object_id *oid,
1191 strbuf_release(&author_ident);
1192 strbuf_release(&committer_ident);
1193
1183 - repo_init_revisions(the_repository, &rev, prefix);
1194 + repo_init_revisions(r, &rev, prefix);
1195 setup_revisions(0, NULL, &rev, NULL);
1196
1197 rev.diff = 1;
@@ -1246,7 +1257,8 @@ static int parse_head(struct commit **head)
1257 * 0 - success
1258 * 1 - run 'git commit'
1259 */
1249 -static int try_to_commit(struct strbuf *msg, const char *author,
1260 +static int try_to_commit(struct repository *r,
1261 + struct strbuf *msg, const char *author,
1262 struct replay_opts *opts, unsigned int flags,
1263 struct object_id *oid)
1264 {
@@ -1290,7 +1302,7 @@ static int try_to_commit(struct strbuf *msg, const char *author,
1302 commit_list_insert(current_head, &parents);
1303 }
1304
1293 - if (write_index_as_tree(&tree, &the_index, get_index_file(), 0, NULL)) {
1305 + if (write_index_as_tree(&tree, r->index, r->index_file, 0, NULL)) {
1306 res = error(_("git write-tree failed to write a tree"));
1307 goto out;
1308 }
@@ -1303,7 +1315,7 @@ static int try_to_commit(struct strbuf *msg, const char *author,
1315 }
1316
1317 if (find_hook("prepare-commit-msg")) {
1306 - res = run_prepare_commit_msg_hook(msg, hook_commit);
1318 + res = run_prepare_commit_msg_hook(r, msg, hook_commit);
1319 if (res)
1320 goto out;
1321 if (strbuf_read_file(&commit_msg, git_path_commit_editmsg(),
@@ -1352,7 +1364,8 @@ out:
1364 return res;
1365 }
1366
1355 -static int do_commit(const char *msg_file, const char *author,
1367 +static int do_commit(struct repository *r,
1368 + const char *msg_file, const char *author,
1369 struct replay_opts *opts, unsigned int flags)
1370 {
1371 int res = 1;
@@ -1367,20 +1380,20 @@ static int do_commit(const char *msg_file, const char *author,
1380 "from '%s'"),
1381 msg_file);
1382
1370 - res = try_to_commit(msg_file ? &sb : NULL, author, opts, flags,
1371 - &oid);
1383 + res = try_to_commit(r, msg_file ? &sb : NULL,
1384 + author, opts, flags, &oid);
1385 strbuf_release(&sb);
1386 if (!res) {
1374 - unlink(git_path_cherry_pick_head(the_repository));
1375 - unlink(git_path_merge_msg(the_repository));
1387 + unlink(git_path_cherry_pick_head(r));
1388 + unlink(git_path_merge_msg(r));
1389 if (!is_rebase_i(opts))
1377 - print_commit_summary(NULL, &oid,
1390 + print_commit_summary(r, NULL, &oid,
1391 SUMMARY_SHOW_AUTHOR_DATE);
1392 return res;
1393 }
1394 }
1395 if (res == 1)
1383 - return run_git_commit(msg_file, opts, flags);
1396 + return run_git_commit(r, msg_file, opts, flags);
1397
1398 return res;
1399 }
@@ -1408,7 +1421,9 @@ static int is_original_commit_empty(struct commit *commit)
1421 /*
1422 * Do we run "git commit" with "--allow-empty"?
1423 */
1411 -static int allow_empty(struct replay_opts *opts, struct commit *commit)
1424 +static int allow_empty(struct repository *r,
1425 + struct replay_opts *opts,
1426 + struct commit *commit)
1427 {
1428 int index_unchanged, empty_commit;
1429
@@ -1425,7 +1440,7 @@ static int allow_empty(struct replay_opts *opts, struct commit *commit)
1440 if (!opts->allow_empty)
1441 return 0; /* let "git commit" barf as necessary */
1442
1428 - index_unchanged = is_index_unchanged();
1443 + index_unchanged = is_index_unchanged(r->index);
1444 if (index_unchanged < 0)
1445 return index_unchanged;
1446 if (!index_unchanged)
@@ -1658,11 +1673,14 @@ static void record_in_rewritten(struct object_id *oid,
1673 flush_rewritten_pending();
1674 }
1675
1661 -static int do_pick_commit(enum todo_command command, struct commit *commit,
1662 - struct replay_opts *opts, int final_fixup)
1676 +static int do_pick_commit(struct repository *r,
1677 + enum todo_command command,
1678 + struct commit *commit,
1679 + struct replay_opts *opts,
1680 + int final_fixup)
1681 {
1682 unsigned int flags = opts->edit ? EDIT_MSG : 0;
1665 - const char *msg_file = opts->edit ? NULL : git_path_merge_msg(the_repository);
1683 + const char *msg_file = opts->edit ? NULL : git_path_merge_msg(r);
1684 struct object_id head;
1685 struct commit *base, *next, *parent;
1686 const char *base_label, *next_label;
@@ -1678,7 +1696,7 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
1696 * that represents the "current" state for merge-recursive
1697 * to work on.
1698 */
1681 - if (write_index_as_tree(&head, &the_index, get_index_file(), 0, NULL))
1699 + if (write_index_as_tree(&head, r->index, r->index_file, 0, NULL))
1700 return error(_("your index file is unmerged."));
1701 } else {
1702 unborn = get_oid("HEAD", &head);
@@ -1693,9 +1711,9 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
1711 oidcpy(&head, the_hash_algo->empty_tree);
1712 if (index_differs_from(unborn ? empty_tree_oid_hex() : "HEAD",
1713 NULL, 0))
1696 - return error_dirty_index(opts);
1714 + return error_dirty_index(r->index, opts);
1715 }
1698 - discard_cache();
1716 + discard_index(r->index);
1717
1718 if (!commit->parents)
1719 parent = NULL;
@@ -1731,7 +1749,7 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
1749 (!parent && unborn))) {
1750 if (is_rebase_i(opts))
1751 write_author_script(msg.message);
1734 - res = fast_forward_to(&commit->object.oid, &head, unborn,
1752 + res = fast_forward_to(r, &commit->object.oid, &head, unborn,
1753 opts);
1754 if (res || command != TODO_REWORD)
1755 goto leave;
@@ -1804,12 +1822,12 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
1822 flags |= CLEANUP_MSG;
1823 msg_file = rebase_path_fixup_msg();
1824 } else {
1807 - const char *dest = git_path_squash_msg(the_repository);
1825 + const char *dest = git_path_squash_msg(r);
1826 unlink(dest);
1827 if (copy_file(dest, rebase_path_squash_msg(), 0666))
1828 return error(_("could not rename '%s' to '%s'"),
1829 rebase_path_squash_msg(), dest);
1812 - unlink(git_path_merge_msg(the_repository));
1830 + unlink(git_path_merge_msg(r));
1831 msg_file = dest;
1832 flags |= EDIT_MSG;
1833 }
@@ -1821,23 +1839,23 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
1839 if (is_rebase_i(opts) && write_author_script(msg.message) < 0)
1840 res = -1;
1841 else if (!opts->strategy || !strcmp(opts->strategy, "recursive") || command == TODO_REVERT) {
1824 - res = do_recursive_merge(base, next, base_label, next_label,
1842 + res = do_recursive_merge(r, base, next, base_label, next_label,
1843 &head, &msgbuf, opts);
1844 if (res < 0)
1845 goto leave;
1846
1847 res |= write_message(msgbuf.buf, msgbuf.len,
1830 - git_path_merge_msg(the_repository), 0);
1848 + git_path_merge_msg(r), 0);
1849 } else {
1850 struct commit_list *common = NULL;
1851 struct commit_list *remotes = NULL;
1852
1853 res = write_message(msgbuf.buf, msgbuf.len,
1836 - git_path_merge_msg(the_repository), 0);
1854 + git_path_merge_msg(r), 0);
1855
1856 commit_list_insert(base, &common);
1857 commit_list_insert(next, &remotes);
1840 - res |= try_merge_command(the_repository, opts->strategy,
1858 + res |= try_merge_command(r, opts->strategy,
1859 opts->xopts_nr, (const char **)opts->xopts,
1860 common, oid_to_hex(&head), remotes);
1861 free_commit_list(common);
@@ -1866,11 +1884,11 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
1884 : _("could not apply %s... %s"),
1885 short_commit_name(commit), msg.subject);
1886 print_advice(res == 1, opts);
1869 - repo_rerere(the_repository, opts->allow_rerere_auto);
1887 + repo_rerere(r, opts->allow_rerere_auto);
1888 goto leave;
1889 }
1890
1873 - allow = allow_empty(opts, commit);
1891 + allow = allow_empty(r, opts, commit);
1892 if (allow < 0) {
1893 res = allow;
1894 goto leave;
@@ -1879,7 +1897,7 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
1897 if (!opts->no_commit) {
1898 fast_forward_edit:
1899 if (author || command == TODO_REVERT || (flags & AMEND_MSG))
1882 - res = do_commit(msg_file, author, opts, flags);
1900 + res = do_commit(r, msg_file, author, opts, flags);
1901 else
1902 res = error(_("unable to parse commit author"));
1903 }
@@ -1915,18 +1933,19 @@ static int prepare_revs(struct replay_opts *opts)
1933 return 0;
1934 }
1935
1918 -static int read_and_refresh_cache(struct replay_opts *opts)
1936 +static int read_and_refresh_cache(struct repository *r,
1937 + struct replay_opts *opts)
1938 {
1939 struct lock_file index_lock = LOCK_INIT;
1940 int index_fd = hold_locked_index(&index_lock, 0);
1922 - if (read_index_preload(&the_index, NULL, 0) < 0) {
1941 + if (read_index_preload(r->index, NULL, 0) < 0) {
1942 rollback_lock_file(&index_lock);
1943 return error(_("git %s: failed to read the index"),
1944 _(action_name(opts)));
1945 }
1927 - refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, NULL, NULL, NULL);
1946 + refresh_index(r->index, REFRESH_QUIET|REFRESH_UNMERGED, NULL, NULL, NULL);
1947 if (index_fd >= 0) {
1929 - if (write_locked_index(&the_index, &index_lock,
1948 + if (write_locked_index(r->index, &index_lock,
1949 COMMIT_LOCK | SKIP_IF_UNCHANGED)) {
1950 return error(_("git %s: failed to refresh the index"),
1951 _(action_name(opts)));
@@ -2644,7 +2663,9 @@ static int save_opts(struct replay_opts *opts)
2663 return res;
2664 }
2665
2647 -static int make_patch(struct commit *commit, struct replay_opts *opts)
2666 +static int make_patch(struct repository *r,
2667 + struct commit *commit,
2668 + struct replay_opts *opts)
2669 {
2670 struct strbuf buf = STRBUF_INIT;
2671 struct rev_info log_tree_opt;
@@ -2660,7 +2681,7 @@ static int make_patch(struct commit *commit, struct replay_opts *opts)
2681
2682 strbuf_addf(&buf, "%s/patch", get_dir(opts));
2683 memset(&log_tree_opt, 0, sizeof(log_tree_opt));
2663 - repo_init_revisions(the_repository, &log_tree_opt, NULL);
2684 + repo_init_revisions(r, &log_tree_opt, NULL);
2685 log_tree_opt.abbrev = 0;
2686 log_tree_opt.diff = 1;
2687 log_tree_opt.diffopt.output_format = DIFF_FORMAT_PATCH;
@@ -2700,17 +2721,19 @@ static int intend_to_amend(void)
2721 return write_message(p, strlen(p), rebase_path_amend(), 1);
2722 }
2723
2703 -static int error_with_patch(struct commit *commit,
2704 - const char *subject, int subject_len,
2705 - struct replay_opts *opts, int exit_code, int to_amend)
2724 +static int error_with_patch(struct repository *r,
2725 + struct commit *commit,
2726 + const char *subject, int subject_len,
2727 + struct replay_opts *opts,
2728 + int exit_code, int to_amend)
2729 {
2730 if (commit) {
2708 - if (make_patch(commit, opts))
2731 + if (make_patch(r, commit, opts))
2732 return -1;
2733 } else if (copy_file(rebase_path_message(),
2711 - git_path_merge_msg(the_repository), 0666))
2734 + git_path_merge_msg(r), 0666))
2735 return error(_("unable to copy '%s' to '%s'"),
2713 - git_path_merge_msg(the_repository), rebase_path_message());
2736 + git_path_merge_msg(r), rebase_path_message());
2737
2738 if (to_amend) {
2739 if (intend_to_amend())
@@ -2741,21 +2764,24 @@ static int error_with_patch(struct commit *commit,
2764 return exit_code;
2765 }
2766
2744 -static int error_failed_squash(struct commit *commit,
2745 - struct replay_opts *opts, int subject_len, const char *subject)
2767 +static int error_failed_squash(struct repository *r,
2768 + struct commit *commit,
2769 + struct replay_opts *opts,
2770 + int subject_len,
2771 + const char *subject)
2772 {
2773 if (copy_file(rebase_path_message(), rebase_path_squash_msg(), 0666))
2774 return error(_("could not copy '%s' to '%s'"),
2775 rebase_path_squash_msg(), rebase_path_message());
2750 - unlink(git_path_merge_msg(the_repository));
2751 - if (copy_file(git_path_merge_msg(the_repository), rebase_path_message(), 0666))
2776 + unlink(git_path_merge_msg(r));
2777 + if (copy_file(git_path_merge_msg(r), rebase_path_message(), 0666))
2778 return error(_("could not copy '%s' to '%s'"),
2779 rebase_path_message(),
2754 - git_path_merge_msg(the_repository));
2755 - return error_with_patch(commit, subject, subject_len, opts, 1, 0);
2780 + git_path_merge_msg(r));
2781 + return error_with_patch(r, commit, subject, subject_len, opts, 1, 0);
2782 }
2783
2758 -static int do_exec(const char *command_line)
2784 +static int do_exec(struct repository *r, const char *command_line)
2785 {
2786 struct argv_array child_env = ARGV_ARRAY_INIT;
2787 const char *child_argv[] = { NULL, NULL };
@@ -2770,10 +2796,10 @@ static int do_exec(const char *command_line)
2796 child_env.argv);
2797
2798 /* force re-reading of the cache */
2773 - if (discard_cache() < 0 || read_cache() < 0)
2799 + if (discard_index(r->index) < 0 || read_index(r->index) < 0)
2800 return error(_("could not read index"));
2801
2776 - dirty = require_clean_work_tree(the_repository, "rebase", NULL, 1, 1);
2802 + dirty = require_clean_work_tree(r, "rebase", NULL, 1, 1);
2803
2804 if (status) {
2805 warning(_("execution failed: %s\n%s"
@@ -2839,9 +2865,9 @@ static int safe_append(const char *filename, const char *fmt, ...)
2865 return 0;
2866 }
2867
2842 -static int do_label(const char *name, int len)
2868 +static int do_label(struct repository *r, const char *name, int len)
2869 {
2844 - struct ref_store *refs = get_main_ref_store(the_repository);
2870 + struct ref_store *refs = get_main_ref_store(r);
2871 struct ref_transaction *transaction;
2872 struct strbuf ref_name = STRBUF_INIT, err = STRBUF_INIT;
2873 struct strbuf msg = STRBUF_INIT;
@@ -2882,7 +2908,9 @@ static int do_label(const char *name, int len)
2908 static const char *reflog_message(struct replay_opts *opts,
2909 const char *sub_action, const char *fmt, ...);
2910
2885 -static int do_reset(const char *name, int len, struct replay_opts *opts)
2911 +static int do_reset(struct repository *r,
2912 + const char *name, int len,
2913 + struct replay_opts *opts)
2914 {
2915 struct strbuf ref_name = STRBUF_INIT;
2916 struct object_id oid;
@@ -2928,13 +2956,13 @@ static int do_reset(const char *name, int len, struct replay_opts *opts)
2956 memset(&unpack_tree_opts, 0, sizeof(unpack_tree_opts));
2957 setup_unpack_trees_porcelain(&unpack_tree_opts, "reset");
2958 unpack_tree_opts.head_idx = 1;
2931 - unpack_tree_opts.src_index = &the_index;
2932 - unpack_tree_opts.dst_index = &the_index;
2959 + unpack_tree_opts.src_index = r->index;
2960 + unpack_tree_opts.dst_index = r->index;
2961 unpack_tree_opts.fn = oneway_merge;
2962 unpack_tree_opts.merge = 1;
2963 unpack_tree_opts.update = 1;
2964
2937 - if (read_cache_unmerged()) {
2965 + if (read_index_unmerged(r->index)) {
2966 rollback_lock_file(&lock);
2967 strbuf_release(&ref_name);
2968 return error_resolve_conflict(_(action_name(opts)));
@@ -2956,9 +2984,9 @@ static int do_reset(const char *name, int len, struct replay_opts *opts)
2984 }
2985
2986 tree = parse_tree_indirect(&oid);
2959 - prime_cache_tree(&the_index, tree);
2987 + prime_cache_tree(r->index, tree);
2988
2961 - if (write_locked_index(&the_index, &lock, COMMIT_LOCK) < 0)
2989 + if (write_locked_index(r->index, &lock, COMMIT_LOCK) < 0)
2990 ret = error(_("could not write index"));
2991 free((void *)desc.buffer);
2992
@@ -2991,7 +3019,9 @@ static struct commit *lookup_label(const char *label, int len,
3019 return commit;
3020 }
3021
2994 -static int do_merge(struct commit *commit, const char *arg, int arg_len,
3022 +static int do_merge(struct repository *r,
3023 + struct commit *commit,
3024 + const char *arg, int arg_len,
3025 int flags, struct replay_opts *opts)
3026 {
3027 int run_commit_flags = (flags & TODO_EDIT_MERGE_MSG) ?
@@ -3058,7 +3088,7 @@ static int do_merge(struct commit *commit, const char *arg, int arg_len,
3088 ret = error(_("octopus merge cannot be executed on "
3089 "top of a [new root]"));
3090 else
3061 - ret = fast_forward_to(&to_merge->item->object.oid,
3091 + ret = fast_forward_to(r, &to_merge->item->object.oid,
3092 &head_commit->object.oid, 0,
3093 opts);
3094 goto leave_merge;
@@ -3077,11 +3107,11 @@ static int do_merge(struct commit *commit, const char *arg, int arg_len,
3107 write_author_script(message);
3108 find_commit_subject(message, &body);
3109 len = strlen(body);
3080 - ret = write_message(body, len, git_path_merge_msg(the_repository), 0);
3110 + ret = write_message(body, len, git_path_merge_msg(r), 0);
3111 unuse_commit_buffer(commit, message);
3112 if (ret) {
3113 error_errno(_("could not write '%s'"),
3084 - git_path_merge_msg(the_repository));
3114 + git_path_merge_msg(r));
3115 goto leave_merge;
3116 }
3117 } else {
@@ -3103,11 +3133,11 @@ static int do_merge(struct commit *commit, const char *arg, int arg_len,
3133 len = buf.len;
3134 }
3135
3106 - ret = write_message(p, len, git_path_merge_msg(the_repository), 0);
3136 + ret = write_message(p, len, git_path_merge_msg(r), 0);
3137 strbuf_release(&buf);
3138 if (ret) {
3139 error_errno(_("could not write '%s'"),
3110 - git_path_merge_msg(the_repository));
3140 + git_path_merge_msg(r));
3141 goto leave_merge;
3142 }
3143 }
@@ -3143,7 +3173,7 @@ static int do_merge(struct commit *commit, const char *arg, int arg_len,
3173
3174 if (can_fast_forward) {
3175 rollback_lock_file(&lock);
3146 - ret = fast_forward_to(&commit->object.oid,
3176 + ret = fast_forward_to(r, &commit->object.oid,
3177 &head_commit->object.oid, 0, opts);
3178 goto leave_merge;
3179 }
@@ -3168,7 +3198,7 @@ static int do_merge(struct commit *commit, const char *arg, int arg_len,
3198 argv_array_push(&cmd.args, "--no-log");
3199 argv_array_push(&cmd.args, "--no-stat");
3200 argv_array_push(&cmd.args, "-F");
3171 - argv_array_push(&cmd.args, git_path_merge_msg(the_repository));
3201 + argv_array_push(&cmd.args, git_path_merge_msg(r));
3202 if (opts->gpg_sign)
3203 argv_array_push(&cmd.args, opts->gpg_sign);
3204
@@ -3178,22 +3208,23 @@ static int do_merge(struct commit *commit, const char *arg, int arg_len,
3208 oid_to_hex(&j->item->object.oid));
3209
3210 strbuf_release(&ref_name);
3181 - unlink(git_path_cherry_pick_head(the_repository));
3211 + unlink(git_path_cherry_pick_head(r));
3212 rollback_lock_file(&lock);
3213
3214 rollback_lock_file(&lock);
3215 ret = run_command(&cmd);
3216
3217 /* force re-reading of the cache */
3188 - if (!ret && (discard_cache() < 0 || read_cache() < 0))
3218 + if (!ret && (discard_index(r->index) < 0 ||
3219 + read_index(r->index) < 0))
3220 ret = error(_("could not read index"));
3221 goto leave_merge;
3222 }
3223
3224 merge_commit = to_merge->item;
3225 write_message(oid_to_hex(&merge_commit->object.oid), GIT_SHA1_HEXSZ,
3195 - git_path_merge_head(the_repository), 0);
3196 - write_message("no-ff", 5, git_path_merge_mode(the_repository), 0);
3226 + git_path_merge_head(r), 0);
3227 + write_message("no-ff", 5, git_path_merge_mode(r), 0);
3228
3229 bases = get_merge_bases(head_commit, merge_commit);
3230 if (bases && oideq(&merge_commit->object.oid,
@@ -3207,7 +3238,7 @@ static int do_merge(struct commit *commit, const char *arg, int arg_len,
3238 commit_list_insert(j->item, &reversed);
3239 free_commit_list(bases);
3240
3210 - read_cache();
3241 + read_index(r->index);
3242 init_merge_options(&o);
3243 o.branch1 = "HEAD";
3244 o.branch2 = ref_name.buf;
@@ -3232,23 +3263,23 @@ static int do_merge(struct commit *commit, const char *arg, int arg_len,
3263 */
3264 ret = !ret;
3265
3235 - if (active_cache_changed &&
3236 - write_locked_index(&the_index, &lock, COMMIT_LOCK)) {
3266 + if (r->index->cache_changed &&
3267 + write_locked_index(r->index, &lock, COMMIT_LOCK)) {
3268 ret = error(_("merge: Unable to write new index file"));
3269 goto leave_merge;
3270 }
3271
3272 rollback_lock_file(&lock);
3273 if (ret)
3243 - repo_rerere(the_repository, opts->allow_rerere_auto);
3274 + repo_rerere(r, opts->allow_rerere_auto);
3275 else
3276 /*
3277 * In case of problems, we now want to return a positive
3278 * value (a negative one would indicate that the `merge`
3279 * command needs to be rescheduled).
3280 */
3250 - ret = !!run_git_commit(git_path_merge_msg(the_repository), opts,
3251 - run_commit_flags);
3281 + ret = !!run_git_commit(r, git_path_merge_msg(r), opts,
3282 + run_commit_flags);
3283
3284 leave_merge:
3285 strbuf_release(&ref_name);
@@ -3425,7 +3456,9 @@ N_("Could not execute the todo command\n"
3456 " git rebase --edit-todo\n"
3457 " git rebase --continue\n");
3458
3428 -static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)
3459 +static int pick_commits(struct repository *r,
3460 + struct todo_list *todo_list,
3461 + struct replay_opts *opts)
3462 {
3463 int res = 0, reschedule = 0;
3464
@@ -3433,7 +3466,7 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)
3466 if (opts->allow_ff)
3467 assert(!(opts->signoff || opts->no_commit ||
3468 opts->record_origin || opts->edit));
3436 - if (read_and_refresh_cache(opts))
3469 + if (read_and_refresh_cache(r, opts))
3470 return -1;
3471
3472 while (todo_list->current < todo_list->nr) {
@@ -3469,7 +3502,7 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)
3502 setenv("GIT_REFLOG_ACTION", reflog_message(opts,
3503 command_to_string(item->command), NULL),
3504 1);
3472 - res = do_pick_commit(item->command, item->commit,
3505 + res = do_pick_commit(r, item->command, item->commit,
3506 opts, is_final_fixup(todo_list));
3507 if (is_rebase_i(opts) && res < 0) {
3508 /* Reschedule */
@@ -3489,7 +3522,7 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)
3522 _("Stopped at %s... %.*s\n"),
3523 short_commit_name(commit),
3524 item->arg_len, item->arg);
3492 - return error_with_patch(commit,
3525 + return error_with_patch(r, commit,
3526 item->arg, item->arg_len, opts, res,
3527 !res);
3528 }
@@ -3499,7 +3532,7 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)
3532 if (res && is_fixup(item->command)) {
3533 if (res == 1)
3534 intend_to_amend();
3502 - return error_failed_squash(item->commit, opts,
3535 + return error_failed_squash(r, item->commit, opts,
3536 item->arg_len, item->arg);
3537 } else if (res && is_rebase_i(opts) && item->commit) {
3538 int to_amend = 0;
@@ -3518,7 +3551,7 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)
3551 oideq(&opts->squash_onto, &oid))))
3552 to_amend = 1;
3553
3521 - return res | error_with_patch(item->commit,
3554 + return res | error_with_patch(r, item->commit,
3555 item->arg, item->arg_len, opts,
3556 res, to_amend);
3557 }
@@ -3528,7 +3561,7 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)
3561 struct stat st;
3562
3563 *end_of_arg = '\0';
3531 - res = do_exec(item->arg);
3564 + res = do_exec(r, item->arg);
3565 *end_of_arg = saved;
3566
3567 /* Reread the todo file if it has changed. */
@@ -3545,13 +3578,13 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)
3578 todo_list->current = -1;
3579 }
3580 } else if (item->command == TODO_LABEL) {
3548 - if ((res = do_label(item->arg, item->arg_len)))
3581 + if ((res = do_label(r, item->arg, item->arg_len)))
3582 reschedule = 1;
3583 } else if (item->command == TODO_RESET) {
3551 - if ((res = do_reset(item->arg, item->arg_len, opts)))
3584 + if ((res = do_reset(r, item->arg, item->arg_len, opts)))
3585 reschedule = 1;
3586 } else if (item->command == TODO_MERGE) {
3554 - if ((res = do_merge(item->commit,
3587 + if ((res = do_merge(r, item->commit,
3588 item->arg, item->arg_len,
3589 item->flags, opts)) < 0)
3590 reschedule = 1;
@@ -3560,7 +3593,7 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)
3593 peek_command(todo_list, 1));
3594 if (res > 0)
3595 /* failed with merge conflicts */
3563 - return error_with_patch(item->commit,
3596 + return error_with_patch(r, item->commit,
3597 item->arg,
3598 item->arg_len, opts,
3599 res, 0);
@@ -3576,7 +3609,8 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)
3609 if (save_todo(todo_list, opts))
3610 return -1;
3611 if (item->commit)
3579 - return error_with_patch(item->commit,
3612 + return error_with_patch(r,
3613 + item->commit,
3614 item->arg,
3615 item->arg_len, opts,
3616 res, 0);
@@ -3641,7 +3675,7 @@ cleanup_head_ref:
3675 struct object_id orig, head;
3676
3677 memset(&log_tree_opt, 0, sizeof(log_tree_opt));
3644 - repo_init_revisions(the_repository, &log_tree_opt, NULL);
3678 + repo_init_revisions(r, &log_tree_opt, NULL);
3679 log_tree_opt.diff = 1;
3680 log_tree_opt.diffopt.output_format =
3681 DIFF_FORMAT_DIFFSTAT;
@@ -3708,16 +3742,17 @@ static int continue_single_pick(void)
3742 return run_command_v_opt(argv, RUN_GIT_CMD);
3743 }
3744
3711 -static int commit_staged_changes(struct replay_opts *opts,
3745 +static int commit_staged_changes(struct repository *r,
3746 + struct replay_opts *opts,
3747 struct todo_list *todo_list)
3748 {
3749 unsigned int flags = ALLOW_EMPTY | EDIT_MSG;
3750 unsigned int final_fixup = 0, is_clean;
3751
3717 - if (has_unstaged_changes(the_repository, 1))
3752 + if (has_unstaged_changes(r, 1))
3753 return error(_("cannot rebase: You have unstaged changes."));
3754
3720 - is_clean = !has_uncommitted_changes(the_repository, 0);
3755 + is_clean = !has_uncommitted_changes(r, 0);
3756
3757 if (file_exists(rebase_path_amend())) {
3758 struct strbuf rev = STRBUF_INIT;
@@ -3817,7 +3852,7 @@ static int commit_staged_changes(struct replay_opts *opts,
3852 }
3853
3854 if (is_clean) {
3820 - const char *cherry_pick_head = git_path_cherry_pick_head(the_repository);
3855 + const char *cherry_pick_head = git_path_cherry_pick_head(r);
3856
3857 if (file_exists(cherry_pick_head) && unlink(cherry_pick_head))
3858 return error(_("could not remove CHERRY_PICK_HEAD"));
@@ -3825,7 +3860,7 @@ static int commit_staged_changes(struct replay_opts *opts,
3860 return 0;
3861 }
3862
3828 - if (run_git_commit(final_fixup ? NULL : rebase_path_message(),
3863 + if (run_git_commit(r, final_fixup ? NULL : rebase_path_message(),
3864 opts, flags))
3865 return error(_("could not commit staged changes."));
3866 unlink(rebase_path_amend());
@@ -3845,12 +3880,12 @@ static int commit_staged_changes(struct replay_opts *opts,
3880 return 0;
3881 }
3882
3848 -int sequencer_continue(struct replay_opts *opts)
3883 +int sequencer_continue(struct repository *r, struct replay_opts *opts)
3884 {
3885 struct todo_list todo_list = TODO_LIST_INIT;
3886 int res;
3887
3853 - if (read_and_refresh_cache(opts))
3888 + if (read_and_refresh_cache(r, opts))
3889 return -1;
3890
3891 if (read_populate_opts(opts))
@@ -3858,7 +3893,7 @@ int sequencer_continue(struct replay_opts *opts)
3893 if (is_rebase_i(opts)) {
3894 if ((res = read_populate_todo(&todo_list, opts)))
3895 goto release_todo_list;
3861 - if (commit_staged_changes(opts, &todo_list))
3896 + if (commit_staged_changes(r, opts, &todo_list))
3897 return -1;
3898 } else if (!file_exists(get_todo_path(opts)))
3899 return continue_single_pick();
@@ -3867,14 +3902,14 @@ int sequencer_continue(struct replay_opts *opts)
3902
3903 if (!is_rebase_i(opts)) {
3904 /* Verify that the conflict has been resolved */
3870 - if (file_exists(git_path_cherry_pick_head(the_repository)) ||
3871 - file_exists(git_path_revert_head(the_repository))) {
3905 + if (file_exists(git_path_cherry_pick_head(r)) ||
3906 + file_exists(git_path_revert_head(r))) {
3907 res = continue_single_pick();
3908 if (res)
3909 goto release_todo_list;
3910 }
3911 if (index_differs_from("HEAD", NULL, 0)) {
3877 - res = error_dirty_index(opts);
3912 + res = error_dirty_index(r->index, opts);
3913 goto release_todo_list;
3914 }
3915 todo_list.current++;
@@ -3888,27 +3923,30 @@ int sequencer_continue(struct replay_opts *opts)
3923 strbuf_release(&buf);
3924 }
3925
3891 - res = pick_commits(&todo_list, opts);
3926 + res = pick_commits(r, &todo_list, opts);
3927 release_todo_list:
3928 todo_list_release(&todo_list);
3929 return res;
3930 }
3931
3897 -static int single_pick(struct commit *cmit, struct replay_opts *opts)
3932 +static int single_pick(struct repository *r,
3933 + struct commit *cmit,
3934 + struct replay_opts *opts)
3935 {
3936 setenv(GIT_REFLOG_ACTION, action_name(opts), 0);
3900 - return do_pick_commit(opts->action == REPLAY_PICK ?
3937 + return do_pick_commit(r, opts->action == REPLAY_PICK ?
3938 TODO_PICK : TODO_REVERT, cmit, opts, 0);
3939 }
3940
3904 -int sequencer_pick_revisions(struct replay_opts *opts)
3941 +int sequencer_pick_revisions(struct repository *r,
3942 + struct replay_opts *opts)
3943 {
3944 struct todo_list todo_list = TODO_LIST_INIT;
3945 struct object_id oid;
3946 int i, res;
3947
3948 assert(opts->revs);
3911 - if (read_and_refresh_cache(opts))
3949 + if (read_and_refresh_cache(r, opts))
3950 return -1;
3951
3952 for (i = 0; i < opts->revs->pending.nr; i++) {
@@ -3920,8 +3958,8 @@ int sequencer_pick_revisions(struct replay_opts *opts)
3958 continue;
3959
3960 if (!get_oid(name, &oid)) {
3923 - if (!lookup_commit_reference_gently(the_repository, &oid, 1)) {
3924 - enum object_type type = oid_object_info(the_repository,
3961 + if (!lookup_commit_reference_gently(r, &oid, 1)) {
3962 + enum object_type type = oid_object_info(r,
3963 &oid,
3964 NULL);
3965 return error(_("%s: can't cherry-pick a %s"),
@@ -3950,7 +3988,7 @@ int sequencer_pick_revisions(struct replay_opts *opts)
3988 return error(_("empty commit set passed"));
3989 if (get_revision(opts->revs))
3990 BUG("unexpected extra commit from walk");
3953 - return single_pick(cmit, opts);
3991 + return single_pick(r, cmit, opts);
3992 }
3993
3994 /*
@@ -3969,7 +4007,7 @@ int sequencer_pick_revisions(struct replay_opts *opts)
4007 if (save_opts(opts))
4008 return -1;
4009 update_abort_safety_file();
3972 - res = pick_commits(&todo_list, opts);
4010 + res = pick_commits(r, &todo_list, opts);
4011 todo_list_release(&todo_list);
4012 return res;
4013 }
@@ -4373,7 +4411,8 @@ static int make_script_with_merges(struct pretty_print_context *pp,
4411 return 0;
4412 }
4413
4376 -int sequencer_make_script(FILE *out, int argc, const char **argv,
4414 +int sequencer_make_script(struct repository *r, FILE *out,
4415 + int argc, const char **argv,
4416 unsigned flags)
4417 {
4418 char *format = NULL;
@@ -4385,7 +4424,7 @@ int sequencer_make_script(FILE *out, int argc, const char **argv,
4424 const char *insn = flags & TODO_LIST_ABBREVIATE_CMDS ? "p" : "pick";
4425 int rebase_merges = flags & TODO_LIST_REBASE_MERGES;
4426
4388 - repo_init_revisions(the_repository, &revs, NULL);
4427 + repo_init_revisions(r, &revs, NULL);
4428 revs.verbose_header = 1;
4429 if (!rebase_merges)
4430 revs.max_parents = 1;
@@ -4850,7 +4889,7 @@ int complete_action(struct replay_opts *opts, unsigned flags,
4889 if (require_clean_work_tree(the_repository, "rebase", "", 1, 1))
4890 return -1;
4891
4853 - return sequencer_continue(opts);
4892 + return sequencer_continue(the_repository, opts);
4893 }
4894
4895 struct subject2item_entry {
sequencer.h
+10 -5
@@ -5,6 +5,7 @@
5 #include "strbuf.h"
6
7 struct commit;
8 +struct repository;
9
10 const char *git_path_commit_editmsg(void);
11 const char *git_path_seq_dir(void);
@@ -74,8 +75,9 @@ int write_message(const void *buf, size_t len, const char *filename,
75
76 /* Call this to setup defaults before parsing command line options */
77 void sequencer_init_config(struct replay_opts *opts);
77 -int sequencer_pick_revisions(struct replay_opts *opts);
78 -int sequencer_continue(struct replay_opts *opts);
78 +int sequencer_pick_revisions(struct repository *repo,
79 + struct replay_opts *opts);
80 +int sequencer_continue(struct repository *repo, struct replay_opts *opts);
81 int sequencer_rollback(struct replay_opts *opts);
82 int sequencer_remove_state(struct replay_opts *opts);
83
@@ -89,7 +91,8 @@ int sequencer_remove_state(struct replay_opts *opts);
91 * commits should be rebased onto the new base, this flag needs to be passed.
92 */
93 #define TODO_LIST_REBASE_COUSINS (1U << 4)
92 -int sequencer_make_script(FILE *out, int argc, const char **argv,
94 +int sequencer_make_script(struct repository *repo, FILE *out,
95 + int argc, const char **argv,
96 unsigned flags);
97
98 int sequencer_add_exec_commands(const char *command);
@@ -112,7 +115,7 @@ extern const char sign_off_header[];
115 */
116 void append_signoff(struct strbuf *msgbuf, size_t ignore_footer, unsigned flag);
117
115 -void append_conflicts_hint(struct strbuf *msgbuf);
118 +void append_conflicts_hint(struct index_state *istate, struct strbuf *msgbuf);
119 int message_is_empty(const struct strbuf *sb,
120 enum commit_msg_cleanup_mode cleanup_mode);
121 int template_untouched(const struct strbuf *sb, const char *template_file,
@@ -128,7 +131,9 @@ int prepare_branch_to_be_rebased(struct replay_opts *opts, const char *commit);
131
132 #define SUMMARY_INITIAL_COMMIT (1 << 0)
133 #define SUMMARY_SHOW_AUTHOR_DATE (1 << 1)
131 -void print_commit_summary(const char *prefix, const struct object_id *oid,
134 +void print_commit_summary(struct repository *repo,
135 + const char *prefix,
136 + const struct object_id *oid,
137 unsigned int flags);
138 #endif
139