Subject: Re: git-commit goes awry after git-add -u

From: Junio C Hamano <[email-masked]>
Date: Wed, 15 Aug 2007 13:49:30 -0700

Salikh Zakirov <[email-masked]> writes:

> I have observed incorret behaviour of git-commit after git-add -u, where
> it records deletions of files not related to the files touched by commit.

Does this fix the issue?

Ideally remove_file_from_cache() should have the invalidate call
inside just like add_file_to_cache() does, but there was a
technical reason it couldn't that I do not recall offhand, so I
am playing it safe here with this tentative patch to see if the
cause is a cache-tree corruption.

---
 builtin-add.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/builtin-add.c b/builtin-add.c
index 1591171..a5fae7c 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -115,6 +115,7 @@ static void update_callback(struct diff_queue_struct *q,
 			break;
 		case DIFF_STATUS_DELETED:
 			remove_file_from_cache(path);
+			cache_tree_invalidate_path(active_cache_tree, path);
 			if (verbose)
 				printf("remove '%s'\n", path);
 			break;