diff options
Diffstat (limited to 'sha1_name.c')
-rw-r--r-- | sha1_name.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sha1_name.c b/sha1_name.c index 65ad066d9b..78c093f79e 100644 --- a/sha1_name.c +++ b/sha1_name.c @@ -677,11 +677,13 @@ static int peel_onion(const char *name, int len, unsigned char *sha1) return -1; sp++; /* beginning of type name, or closing brace for empty */ - if (!strncmp(commit_type, sp, 6) && sp[6] == '}') + if (!prefixcmp(sp, "commit}")) expected_type = OBJ_COMMIT; - else if (!strncmp(tree_type, sp, 4) && sp[4] == '}') + else if (!prefixcmp(sp, "tag}")) + expected_type = OBJ_TAG; + else if (!prefixcmp(sp, "tree}")) expected_type = OBJ_TREE; - else if (!strncmp(blob_type, sp, 4) && sp[4] == '}') + else if (!prefixcmp(sp, "blob}")) expected_type = OBJ_BLOB; else if (!prefixcmp(sp, "object}")) expected_type = OBJ_ANY; @@ -1130,13 +1132,13 @@ int get_sha1(const char *name, unsigned char *sha1) } /* - * Many callers know that the user meant to name a committish by + * Many callers know that the user meant to name a commit-ish by * syntactical positions where the object name appears. Calling this * function allows the machinery to disambiguate shorter-than-unique - * abbreviated object names between committish and others. + * abbreviated object names between commit-ish and others. * * Note that this does NOT error out when the named object is not a - * committish. It is merely to give a hint to the disambiguation + * commit-ish. It is merely to give a hint to the disambiguation * machinery. */ int get_sha1_committish(const char *name, unsigned char *sha1) |