summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1fe32cb)
raw | patch | inline | side by side (parent: 1fe32cb)
author | Jeff King <peff@peff.net> | |
Thu, 14 Feb 2008 17:18:23 +0000 (12:18 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 16 Feb 2008 08:12:56 +0000 (00:12 -0800) |
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>
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>
builtin-commit.c | patch | blob | history | |
t/t7502-status.sh | patch | blob | history |
diff --git a/builtin-commit.c b/builtin-commit.c
index a43f2019959a950639f013ff534610e228d8c149..45232a11c408530e7ca011f7262532df236c2576 100644 (file)
--- a/builtin-commit.c
+++ b/builtin-commit.c
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;
}
diff --git a/t/t7502-status.sh b/t/t7502-status.sh
index b64ce30ff1c28a44b24eb6dd07a2cd9e260e0326..e00607490bcb0439c6557003a3419d84823a8f00 100755 (executable)
--- a/t/t7502-status.sh
+++ b/t/t7502-status.sh
'
+cat <<EOF >expect
+# On branch master
+# Changes to be committed:
+# (use "git reset HEAD <file>..." to unstage)
+#
+# modified: dir1/modified
+#
+# Untracked files:
+# (use "git add <file>..." to include in what will be committed)
+#
+# dir1/untracked
+# dir2/
+# expect
+# output
+# untracked
+EOF
+test_expect_success 'status of partial commit excluding new file in index' '
+ git status dir1/modified >output &&
+ diff -u expect output
+'
+
test_done