Re: [PATCH 2/2] pretty: add merge and exclude options to %(describe)
- From
René Scharfe. <l.s.r@web.de>
- Date
- Feb 28, 2021, 11:22 UTC
- Message-ID
- <878d2515-a937-f6d7-9d77-45c38f547893@web.de>
- In-Reply-To
- <xmqqsg5uletz.fsf@gitster.g>
Am 17.02.21 um 19:38 schrieb Junio C Hamano:
> I wonder, in addition to "match" and "exclude", if we want to allow > "always" as well.
I added "match" because that describe option is used by GIT-VERSION-GEN, so I imagine it's generally useful for version names in spec files. Not sure why I misspelled it "merge" in the subject, though. o_O
"exclude" is not in there, but I threw it in anyway, as the example in 77d21f29ea (describe: teach describe negative pattern matches, 2017-01-18) made sense to me. It complements "match" nicely.
I had "always" in proof-of-concept patch because I hadn't decided what to do with commits that git describe doesn't find a description for, and wanted to check the full output of git log --pretty='%(describe)'. For a release tarball of a repo that lacks tags it would be easier to use %h instead of %(describe:always) -- or tag the release.
That's why I didn't include "always" in the latest patches, but if it turns out to be useful for someone then I wouldn't them adding it.
Show 9 quoted lines
> Also, looking further into the future, I wonder if we should aim to > eventually unify %h and %H as well as %(describe) into one, > i.e. various ways to spell a commit object name, given that there is > a separate effort underway to unify pretty and for-each-ref format > strings. > > E.g. %(objectname) is the same as %H, and %(objectname:short) is the > same as %h, so this might be %(objectname:describe), or something > along the line.
According to the glossary and object name is:
The unique identifier of an object. The
object name is usually represented by a 40 character
hexadecimal string. Also colloquially called SHA-1.And that's how I understand it as well. The object layer with it's hashes on one hand and descriptions based on refs and commit relations on the other are separate things in my mind. %(describe) falling back to %h when :always is given makes sense to me; %(objectname) "falling forward" to show describe output feels like a layering violation.
René