Re: [RFC PATCH v2] builtin/shortlog: explicitly set hash algo when there is no repo
- From
Wolfgang Müller <wolf@oriole.systems>
- Date
- Oct 15, 2024, 17:51 UTC
- Message-ID
- <2j4vvyo2nthifofp3susoq5qmbyoocht7pjw6bzrxoffuui2ca@pbpxtwnyrr66>
- In-Reply-To
- <CAPig+cSGzgfa+0MbRD10vktmx3O3v3q_TremWs7dANrwALf2Fg@mail.gmail.com>
On 2024-10-15 13:20, Eric Sunshine wrote:
> t/test-lib-functions.sh has a handy nongit() function for running a > command in a non-Git directory: > > nongit git shortlog --author=author <log 2>out
Ah, nice, I'll be using that instead, then.
> By the way, what is the purpose of capturing output to file "out"? > That file is never consulted.
Oh, my bad, that was a leftover from local testing.
> Also, can the original crash be reproduced without having to invoke > the additional `git log`? In my tests, this is sufficient: > > echo | nongit git shortlog --author=author
Yeah, same as above. I'll take that into account for the next version, thanks!
Thinking more about this, any opinion on the specific test for --author? It is a succinct test but also relies on the fact that it "just happens" to be one of the flags handled in parse_revision_opt(). In fact, any such flag (even non-existing ones, like "--foo") would crash shortlog right now. I'm wondering whether there's a more universal way of testing this.
-- Wolf