Skip to content

Commit 4f6a32f

Browse files
peffgitster
authored andcommitted
commit: abort commit if interactive add failed
Previously we ignored the result of calling add_interactive, which meant that if an error occurred we simply committed whatever happened to be in the index. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e1dc49b commit 4f6a32f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

builtin-commit.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@ static char *prepare_index(int argc, const char **argv, const char *prefix)
224224
const char **pathspec = NULL;
225225

226226
if (interactive) {
227-
interactive_add(argc, argv, prefix);
227+
if (interactive_add(argc, argv, prefix) != 0)
228+
die("interactive add failed");
228229
if (read_cache() < 0)
229230
die("index file corrupt");
230231
commit_style = COMMIT_AS_IS;

0 commit comments

Comments
 (0)