summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7263881)
raw | patch | inline | side by side (parent: 7263881)
author | Junio C Hamano <gitster@pobox.com> | |
Sun, 23 Dec 2007 03:22:29 +0000 (19:22 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 23 Dec 2007 03:45:06 +0000 (19:45 -0800) |
When amending initial commit without editor, the command
incorrectly barfed because the check to see if there is anything
to commit referenced the non-existent HEAD^1.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
incorrectly barfed because the check to see if there is anything
to commit referenced the non-existent HEAD^1.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-commit.c | patch | blob | history |
diff --git a/builtin-commit.c b/builtin-commit.c
index 96410de55ddbc52eb116049b4f6a2792a5386cb4..eebd4cf066852e5113d2dc339f7853a3f3752f30 100644 (file)
--- a/builtin-commit.c
+++ b/builtin-commit.c
if (no_edit) {
struct rev_info rev;
- unsigned char sha1[40];
+ unsigned char sha1[20];
const char *parent = "HEAD";
fclose(fp);
if (!active_nr && read_cache() < 0)
die("Cannot read index");
- if (get_sha1("HEAD", sha1) != 0)
- return !!active_nr;
-
if (amend)
parent = "HEAD^1";
+ if (get_sha1(parent, sha1))
+ return !!active_nr;
+
init_revisions(&rev, "");
rev.abbrev = 0;
setup_revisions(0, NULL, &rev, parent);