diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2018-09-21 15:57:32 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-09-21 16:48:11 (GMT) |
commit | 35843b1123e2772c5db6d7db5abf279c3253ae57 (patch) | |
tree | 2ddded58ca61d8a808a407fceb5c55a043cbf135 /builtin | |
parent | 58bf2a4cc7a929d2fe0ff30eda86fcec54aef0f8 (diff) | |
download | git-35843b1123e2772c5db6d7db5abf279c3253ae57.zip git-35843b1123e2772c5db6d7db5abf279c3253ae57.tar.gz git-35843b1123e2772c5db6d7db5abf279c3253ae57.tar.bz2 |
rerere.c: remove implicit dependency on the_index
The reason rerere(), rerere_forget() and rerere_remaining() take a
struct repository instead of struct index_state is not obvious from
the patch:
Deep in update_paths() and find_conflict(), hold_locked_index() and
read_index() are called. These functions assumes the index path at
$GIT_DIR/index which is not always true when you take an arbitrary
index state. Taking a repository will allow us to point to the right
index path later when we replace them with repo_ versions.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/am.c | 4 | ||||
-rw-r--r-- | builtin/commit.c | 2 | ||||
-rw-r--r-- | builtin/merge.c | 2 | ||||
-rw-r--r-- | builtin/rerere.c | 6 |
4 files changed, 7 insertions, 7 deletions
diff --git a/builtin/am.c b/builtin/am.c index 5e866d1..4c7a5bc 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -1604,7 +1604,7 @@ static int fall_back_threeway(const struct am_state *state, const char *index_pa o.verbosity = 0; if (merge_recursive_generic(&o, &our_tree, &their_tree, 1, bases, &result)) { - rerere(state->allow_rerere_autoupdate); + repo_rerere(the_repository, state->allow_rerere_autoupdate); free(their_tree_name); return error(_("Failed to merge in the changes.")); } @@ -1899,7 +1899,7 @@ static void am_resolve(struct am_state *state) goto next; } - rerere(0); + repo_rerere(the_repository, 0); do_commit(state); diff --git a/builtin/commit.c b/builtin/commit.c index 0d9828e..bf06fbf 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -1651,7 +1651,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix) "new_index file. Check that disk is not full and quota is\n" "not exceeded, and then \"git reset HEAD\" to recover.")); - rerere(0); + repo_rerere(the_repository, 0); run_command_v_opt(argv_gc_auto, RUN_GIT_CMD); run_commit_hook(use_editor, get_index_file(), "post-commit", NULL); if (amend && !no_post_rewrite) { diff --git a/builtin/merge.c b/builtin/merge.c index 5f79fc5..3c003ce 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -899,7 +899,7 @@ static int suggest_conflicts(void) fputs(msgbuf.buf, fp); strbuf_release(&msgbuf); fclose(fp); - rerere(allow_rerere_auto); + repo_rerere(the_repository, allow_rerere_auto); printf(_("Automatic merge failed; " "fix conflicts and then commit the result.\n")); return 1; diff --git a/builtin/rerere.c b/builtin/rerere.c index 0bc4029..1ca271b 100644 --- a/builtin/rerere.c +++ b/builtin/rerere.c @@ -70,7 +70,7 @@ int cmd_rerere(int argc, const char **argv, const char *prefix) flags = RERERE_NOAUTOUPDATE; if (argc < 1) - return rerere(flags); + return repo_rerere(the_repository, flags); if (!strcmp(argv[0], "forget")) { struct pathspec pathspec; @@ -78,7 +78,7 @@ int cmd_rerere(int argc, const char **argv, const char *prefix) warning("'git rerere forget' without paths is deprecated"); parse_pathspec(&pathspec, 0, PATHSPEC_PREFER_CWD, prefix, argv + 1); - return rerere_forget(&pathspec); + return rerere_forget(the_repository, &pathspec); } if (!strcmp(argv[0], "clear")) { @@ -91,7 +91,7 @@ int cmd_rerere(int argc, const char **argv, const char *prefix) for (i = 0; i < merge_rr.nr; i++) printf("%s\n", merge_rr.items[i].string); } else if (!strcmp(argv[0], "remaining")) { - rerere_remaining(&merge_rr); + rerere_remaining(the_repository, &merge_rr); for (i = 0; i < merge_rr.nr; i++) { if (merge_rr.items[i].util != RERERE_RESOLVED) printf("%s\n", merge_rr.items[i].string); |