Merge branch 'jc/add-u-A-default-to-top' into maint
[gitweb.git] / wt-status.c
index c327fe8128fdb2e380db15f526056a22862ac33f..3e3b8c098924d655bccb395e95cee832abb1d39f 100644 (file)
@@ -1319,6 +1319,12 @@ static int grab_1st_switch(unsigned char *osha1, unsigned char *nsha1,
        hashcpy(cb->nsha1, nsha1);
        for (end = target; *end && *end != '\n'; end++)
                ;
+       if (!memcmp(target, "HEAD", end - target)) {
+               /* HEAD is relative. Resolve it to the right reflog entry. */
+               strbuf_addstr(&cb->buf,
+                             find_unique_abbrev(nsha1, DEFAULT_ABBREV));
+               return 1;
+       }
        strbuf_add(&cb->buf, target, end - target);
        return 1;
 }