aboutsummaryrefslogtreecommitdiff
path: root/builtin-commit.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2008-02-14 12:18:23 -0500
committerJunio C Hamano <gitster@pobox.com>2008-02-16 00:12:56 -0800
commit959ba670ad7173bcb73afaca69625a5635f63b8b (patch)
tree655b222daa13108dd01cfce5f444282f7e2f3c8c /builtin-commit.c
parent1fe32cb9d0807e6da468dc7bf96d427b2f38c1c4 (diff)
downloadgit-959ba670ad7173bcb73afaca69625a5635f63b8b.tar.gz
git-959ba670ad7173bcb73afaca69625a5635f63b8b.tar.xz
commit: discard index after setting up partial commit
There may still be some entries from the original index that should be discarded before we show the status. In particular, if a file was added in the index but not included in the partial commit, it would still show up in the status listing as staged for commit. Ultimately the correct fix is to keep the two states in separate index_state variables. Then we can avoid having to reload the cache from the temporary file altogether, and just point wt_status_print at the correct index. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-commit.c')
-rw-r--r--builtin-commit.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/builtin-commit.c b/builtin-commit.c
index a43f20199..45232a11c 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -317,6 +317,10 @@ static char *prepare_index(int argc, const char **argv, const char *prefix)
if (write_cache(fd, active_cache, active_nr) ||
close_lock_file(&false_lock))
die("unable to write temporary index file");
+
+ discard_cache();
+ read_cache_from(false_lock.filename);
+
return false_lock.filename;
}