threads / patch / 13685

patchcommit --interactive: properly update the index before commiting

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

## tl;dr

One message between May 27, 2008 and May 27, 2008. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Gerrit Pape· May 27, 2008, 08:59 UTC · lore

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(-)
Show changes to builtin-commit.c +2 −0
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

← back to recent threads