Skip to content

Commit d5350fd

Browse files
g-papegitster
authored andcommitted
commit --interactive: properly update the index before commiting
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1f684dc commit d5350fd

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

builtin-commit.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ static char *prepare_index(int argc, const char **argv, const char *prefix)
219219

220220
if (interactive) {
221221
interactive_add(argc, argv, prefix);
222+
if (read_cache() < 0)
223+
die("index file corrupt");
222224
commit_style = COMMIT_AS_IS;
223225
return get_index_file();
224226
}

0 commit comments

Comments
 (0)