summaryrefslogtreecommitdiff
path: root/builtin/commit.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-02-05 22:34:58 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-02-05 22:34:58 (GMT)
commit9a5315edfdf662c4d9bf444ebc297bc802fa5e04 (patch)
treef5a719c28ba9445bd857be710a1955c5c4883634 /builtin/commit.c
parent381e8e9de142b636e4a25b6df113d70168e21a34 (diff)
parentc480eeb574e649a19f27dc09a994e45f9b2c2622 (diff)
downloadgit-9a5315edfdf662c4d9bf444ebc297bc802fa5e04.zip
git-9a5315edfdf662c4d9bf444ebc297bc802fa5e04.tar.gz
git-9a5315edfdf662c4d9bf444ebc297bc802fa5e04.tar.bz2
Merge branch 'js/patch-mode-in-others-in-c'
The effort to move "git-add--interactive" to C continues. * js/patch-mode-in-others-in-c: commit --interactive: make it work with the built-in `add -i` built-in add -p: implement the "worktree" patch modes built-in add -p: implement the "checkout" patch modes built-in stash: use the built-in `git add -p` if so configured legacy stash -p: respect the add.interactive.usebuiltin setting built-in add -p: implement the "stash" and "reset" patch modes built-in add -p: prepare for patch modes other than "stage"
Diffstat (limited to 'builtin/commit.c')
-rw-r--r--builtin/commit.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index 646e845..c70ad01 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -367,7 +367,7 @@ static const char *prepare_index(int argc, const char **argv, const char *prefix
die(_("index file corrupt"));
if (interactive) {
- char *old_index_env = NULL;
+ char *old_index_env = NULL, *old_repo_index_file;
hold_locked_index(&index_lock, LOCK_DIE_ON_ERROR);
refresh_cache_or_die(refresh_flags);
@@ -375,12 +375,16 @@ static const char *prepare_index(int argc, const char **argv, const char *prefix
if (write_locked_index(&the_index, &index_lock, 0))
die(_("unable to create temporary index"));
+ old_repo_index_file = the_repository->index_file;
+ the_repository->index_file =
+ (char *)get_lock_file_path(&index_lock);
old_index_env = xstrdup_or_null(getenv(INDEX_ENVIRONMENT));
- setenv(INDEX_ENVIRONMENT, get_lock_file_path(&index_lock), 1);
+ setenv(INDEX_ENVIRONMENT, the_repository->index_file, 1);
if (interactive_add(argc, argv, prefix, patch_interactive) != 0)
die(_("interactive add failed"));
+ the_repository->index_file = old_repo_index_file;
if (old_index_env && *old_index_env)
setenv(INDEX_ENVIRONMENT, old_index_env, 1);
else