Code

commit: abort commit if interactive add failed
authorJeff King <peff@peff.net>
Fri, 3 Apr 2009 19:28:56 +0000 (15:28 -0400)
committerJunio C Hamano <gitster@pobox.com>
Sun, 5 Apr 2009 07:37:32 +0000 (00:37 -0700)
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 <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-commit.c

index 6cbdd55f168507259a17b64a19ad29310c6d3397..fde7b891d9d015acfeb1ee3b9ab42ff1eafd49b6 100644 (file)
@@ -224,7 +224,8 @@ static char *prepare_index(int argc, const char **argv, const char *prefix)
        const char **pathspec = NULL;
 
        if (interactive) {
-               interactive_add(argc, argv, prefix);
+               if (interactive_add(argc, argv, prefix) != 0)
+                       die("interactive add failed");
                if (read_cache() < 0)
                        die("index file corrupt");
                commit_style = COMMIT_AS_IS;