diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-10-13 19:03:19 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-10-13 19:03:19 -0700 |
commit | 0fd8cb3fec7abb36505a150fe5cfa9b1d8b85496 (patch) | |
tree | e8ff37c5dce1e0eb7e33da89d487fcb21bbec6c0 /commit.c | |
parent | 6fdab32e14e2bca05ae6471502bcdfd35b381564 (diff) | |
parent | baf18fc261ca475343fe3cb9cd2c0dded4bc1bb7 (diff) | |
download | git-0fd8cb3fec7abb36505a150fe5cfa9b1d8b85496.tar.gz git-0fd8cb3fec7abb36505a150fe5cfa9b1d8b85496.tar.xz |
Merge branch 'nd/maint-autofix-tag-in-head'
* 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.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -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); |