git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: "git tag --contains <id>" is too chatty, if <id> is invalid

From
Jeff King <peff@peff.net>
Date
Jan 18, 2016, 21:54 UTC
Message-ID
<20160118215433.GB24136@sigill.intra.peff.net>
In-Reply-To
<569D580F.4070302@gmx.de>
On Mon, Jan 18, 2016 at 10:24:31PM +0100, Toralf Förster wrote:
>  very first line is "error: malformed object name <id>" which tells all, or ?
Yeah, I agree that showing the "-h" help is a bit much.

This is a side effect of looking up in the commit in the parse-options callback. It has to signal an error to the option parser, and then the option parser always shows the help on an error.

I think we'd need to do one of:
  1. call die() in the option-parsing callback (this is probably a bad
     precedent, as the callbacks might be reused from a place that wants
     to behave differently)
  2. have the callback just store the argument string, and then resolve
     the commit later (and die or whatever if it doesn't exist). This
     pushes more work onto the caller, but in this case it's all done by
     the ref-filter code, so it could presumably happen during another
     part of the ref-filter setup.
  3. teach parse-options to accept some specific non-zero return code
     that means "return an error, but don't show the usage"

I think any one of those would be a good project for somebody looking to get their feet wet in working on git. I think (2) is the cleanest.

-Peff
Previous: Toralf Förster
Message 2 of 2 in “"git tag --contains <id>" is too chatty, if <id> is invalid”
  1. Toralf FörsterJan 18, 2016
  2. Jeff KingJan 18, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.