aboutsummaryrefslogtreecommitdiff
path: root/commit.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-10-21 10:49:26 -0700
committerJunio C Hamano <gitster@pobox.com>2011-10-21 10:49:26 -0700
commitd25a265220f7e9a50693d0ec4bb05c7be0539d69 (patch)
tree34bf878cbc1181b0614ad7ba210d48f0ad550fa3 /commit.c
parente63f87a6f7a4e55f50e67b112f26d9a1e4e7f3ab (diff)
parentbaf18fc261ca475343fe3cb9cd2c0dded4bc1bb7 (diff)
downloadgit-d25a265220f7e9a50693d0ec4bb05c7be0539d69.tar.gz
git-d25a265220f7e9a50693d0ec4bb05c7be0539d69.tar.xz
Merge branch 'nd/maint-autofix-tag-in-head' into maint
* nd/maint-autofix-tag-in-head: Accept tags in HEAD or MERGE_HEAD merge: remove global variable head[] merge: use return value of resolve_ref() to determine if HEAD is invalid merge: keep stash[] a local variable Conflicts: builtin/merge.c
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/commit.c b/commit.c
index 97b43279c..9f4cc636d 100644
--- a/commit.c
+++ b/commit.c
@@ -39,6 +39,18 @@ struct commit *lookup_commit_reference(const unsigned char *sha1)
return lookup_commit_reference_gently(sha1, 0);
}
+struct commit *lookup_commit_or_die(const unsigned char *sha1, const char *ref_name)
+{
+ struct commit *c = lookup_commit_reference(sha1);
+ if (!c)
+ die(_("could not parse %s"), ref_name);
+ if (hashcmp(sha1, c->object.sha1)) {
+ warning(_("%s %s is not a commit!"),
+ ref_name, sha1_to_hex(sha1));
+ }
+ return c;
+}
+
struct commit *lookup_commit(const unsigned char *sha1)
{
struct object *obj = lookup_object(sha1);