I'm trying to add an extra tag for the commit to be able later to select this commit by git describe with --match pattern;
When I use --match to catch usual commits with one tag everything works fine.
But when I try to --match commit with two tags by pattern "deployed", I get very weird tag like, for example:
I have commit: b946bdf (tag: [email protected]) Publish
I add "deployed" tag: b946bdf (tag: [email protected], tag: deployed) Publish
Then I run git describe --abbrev=0 --match "deployed"
And the result of this command is [email protected]
If I try to use --abbrev=1 I get [email protected]
And the most interesting that the -9-g1e5c94cc55fded72114b801bd47d8d29e7721255 is not even a has of this commit. I have no idea why and where from I get this weird identifier.
I want to get a clean tag like [email protected]
What I'm doing wrong?
The
--matchoption togit describetakes a shell-style glob pattern, such asa*z. It then runs the tags listed bygit tagsthrough a shell-style matcher.1 Hence, given the glob patterna*z, tags namedabuzzandavelozwould match, but a tag namedarbiterorfuzzwould not.Your glob pattern is
deployed, and since there are no wildcard characters allowed, the only allowed tag by this--matchoption isdeployeditself. You do have a tag nameddeployed, and you gave only one--match, so this is the only one allowed.If I create such a tag, I can use it:
This tag can't be used for any earlier revision, of course:
Deleting the tag produces an appropriate error:
I cannot explain your output. There have been bugs in
git describe; the release notes for Git 2.15.0 point one out, for instance. But this would not produce the output you show (I think). What version of Git are you using?1This is actually all built in to
git describeitself, which doesn't have to rungit tags. The effect is the same, though. Note that shell glob patterns may need quoting to protect them from the shell, depending on your shell.