The docs seem to say that doing
git show-ref --head --tags
would show both the HEAD ref and all the tag refs. However, doing
both --head and either of --tags or --heads would filter out the HEAD
ref.
Signed-off-by: Doug Bell <[email protected]>
---
I think this patch could be done better if I refactor the show_ref() sub
a bit...
This commit passes the current test suite. Where would I put new
tests for this? I can't find an existing show-ref test to append to.
I would be happy to write show-ref tests if there aren't any already.
builtin/show-ref.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/builtin/show-ref.c b/builtin/show-ref.c
index 8d9b76a..5954e9b 100644
--- a/builtin/show-ref.c
+++ b/builtin/show-ref.c
@@ -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 && !strncmp(refname, "HEAD\0", 5))
+ goto match;
+
if (tags_only || heads_only) {
int match;
--
1.8.3.101.g727a46b.dirty
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html