Accept tags in HEAD or MERGE_HEAD
HEAD and MERGE_HEAD (among other branch tips) should never hold a
tag. That can only be caused by broken tools and is cumbersome to fix
by an end user with:
$ git update-ref HEAD $(git rev-parse HEAD^{commit})
which may look like a magic to a new person.
Be easy, warn users (so broken tools can be fixed if they bother to
report) and move on.
Be robust, if the given SHA-1 cannot be resolved to a commit object,
die (therefore return value is always valid).
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
894642f68d
commit
baf18fc261
7
commit.h
7
commit.h
@ -38,6 +38,13 @@ struct commit *lookup_commit_reference_gently(const unsigned char *sha1,
|
||||
int quiet);
|
||||
struct commit *lookup_commit_reference_by_name(const char *name);
|
||||
|
||||
/*
|
||||
* Look up object named by "sha1", dereference tag as necessary,
|
||||
* get a commit and return it. If "sha1" does not dereference to
|
||||
* a commit, use ref_name to report an error and die.
|
||||
*/
|
||||
struct commit *lookup_commit_or_die(const unsigned char *sha1, const char *ref_name);
|
||||
|
||||
int parse_commit_buffer(struct commit *item, const void *buffer, unsigned long size);
|
||||
int parse_commit(struct commit *item);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user