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

[PATCH] commit --interactive: properly update the index before commiting

From
Gerrit Pape <pape@smarden.org>
Date
May 27, 2008, 08:59 UTC
Message-ID
<20080527085916.23645.qmail@8ea7804c723d58.315fe32.mid.smarden.org>

When adding files through git commit --interactive, and 'quit' afterwards, the message in the editor of the commit message indicates that many (maybe all) files are deleted from the tree. Dismissing that and running git commit afterwards does the right thing. This commit fixes git commit --interactive to properly update the index before commiting.

Reported by Jiří Paleček through
 http://bugs.debian.org/480429
Signed-off-by: Gerrit Pape <pape@smarden.org>
---
 builtin-commit.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/builtin-commit.c b/builtin-commit.c
index 07872c8..b294c1f 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -223,6 +223,8 @@ static char *prepare_index(int argc, const char **argv, const char *prefix)
 
 	if (interactive) {
 		interactive_add(argc, argv, prefix);
+		if (read_cache() < 0)
+			die("index file corrupt");
 		commit_style = COMMIT_AS_IS;
 		return get_index_file();
 	}
-- 
1.5.5.1
Message 1 of 1 in “commit --interactive: properly update the index before commiting”
  1. commit --interactive: properly update the index before commitingGerrit Pape, May 27, 2008

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.