summaryrefslogtreecommitdiff
path: root/sha1-name.c
diff options
context:
space:
mode:
Diffstat (limited to 'sha1-name.c')
-rw-r--r--sha1-name.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/sha1-name.c b/sha1-name.c
index 200eb373ad..75d1c32606 100644
--- a/sha1-name.c
+++ b/sha1-name.c
@@ -908,14 +908,9 @@ static int get_oid_basic(struct repository *r, const char *str, int len,
real_ref, flags, at_time, nth, oid, NULL,
&co_time, &co_tz, &co_cnt)) {
if (!len) {
- if (starts_with(real_ref, "refs/heads/")) {
- str = real_ref + 11;
- len = strlen(real_ref + 11);
- } else {
- /* detached HEAD */
+ if (!skip_prefix(real_ref, "refs/heads/", &str))
str = "HEAD";
- len = 4;
- }
+ len = strlen(str);
}
if (at_time) {
if (!(flags & GET_OID_QUIETLY)) {