git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 15, 2007, 20:49 UTC
Message-ID
<7v643gplph.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<f9v1t6$uph$1@sea.gmane.org>
Salikh Zakirov <salikh@gmail.com> 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;
Previous: Salikh ZakirovNext: Junio C Hamano
Message 3 of 6 in “git-commit goes awry after git-add -u”
  1. Salikh ZakirovAug 15, 2007
  2. Salikh ZakirovAug 15, 2007
  3. Junio C HamanoAug 15, 2007
  4. Fix "git add -u" data corruption.Junio C Hamano, Aug 15, 2007
  5. Zakirov SalikhAug 16, 2007
  6. Salikh ZakirovAug 15, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.