Merge branch 'jc/revision-range-unpeel' into maint
[gitweb.git] / builtin / show-ref.c
index 8d9b76a02fd115c0285216c27c5232f345d0582d..87806ad5b088f5c905757a4fab3c3499ec20a308 100644 (file)
@@ -31,6 +31,9 @@ static int show_ref(const char *refname, const unsigned char *sha1, int flag, vo
        const char *hex;
        unsigned char peeled[20];
 
+       if (show_head && !strcmp(refname, "HEAD"))
+               goto match;
+
        if (tags_only || heads_only) {
                int match;
 
@@ -103,7 +106,7 @@ static int add_existing(const char *refname, const unsigned char *sha1, int flag
  */
 static int exclude_existing(const char *match)
 {
-       static struct string_list existing_refs = STRING_LIST_INIT_NODUP;
+       static struct string_list existing_refs = STRING_LIST_INIT_DUP;
        char buf[1024];
        int matchlen = match ? strlen(match) : 0;
 
@@ -167,9 +170,10 @@ static const struct option show_ref_options[] = {
        OPT_BOOLEAN(0, "verify", &verify, N_("stricter reference checking, "
                    "requires exact ref path")),
        { OPTION_BOOLEAN, 'h', NULL, &show_head, NULL,
-         N_("show the HEAD reference"),
+         N_("show the HEAD reference, even if it would be filtered out"),
          PARSE_OPT_NOARG | PARSE_OPT_HIDDEN },
-       OPT_BOOLEAN(0, "head", &show_head, N_("show the HEAD reference")),
+       OPT_BOOLEAN(0, "head", &show_head,
+         N_("show the HEAD reference, even if it would be filtered out")),
        OPT_BOOLEAN('d', "dereference", &deref_tags,
                    N_("dereference tags into object IDs")),
        { OPTION_CALLBACK, 's', "hash", &abbrev, N_("n"),