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

Re: git status -s -v: no override

From
Jeff King <peff@peff.net>
Date
Apr 16, 2011, 01:37 UTC
Message-ID
<20110416013723.GA23105@sigill.intra.peff.net>
In-Reply-To
<20110416004544.GA5628@elie>
On Fri, Apr 15, 2011 at 07:45:45PM -0500, Jonathan Nieder wrote:
Show 7 quoted lines
> Jeff King wrote:
> 
> > There is no option that means "counteract -s or --porcelain seen earlier
> > on the command line and use the default long format", which I think is
> > what you want.
> 
> Doesn't "git status $opts --no-short --no-porcelain" work?

Hmm. That does work (with either option, or both), but it is somewhat of an accident. There is an enum specifying the format the user wants. We hand it to parse-options for those options, telling it that the value is an int. Parse-options will treat --no-foo on an int as setting it to 0.

The enumeration list does not have explicit integer values, but does happen to have the constant for the long format first, which in ANSI C guarantees it to be 0.

So yeah, it works, but I will admit to being surprised by it. And certainly as a user, I wouldn't have thought of that.

I think it probably should have been a tristate like:
 --format={long,short,porcelain}

all along, though I don't know that it is a particularly big deal. We can still do that if we want, and just keep --short and --porcelain as aliases.

-Peff
Previous: Jonathan NiederNext: Jonathan Nieder
Message 4 of 10 in “git status -s -v: no override”
  1. Jacek MasiulaniecApr 15, 2011
  2. Jeff KingApr 16, 2011
  3. Jonathan NiederApr 16, 2011
  4. Jeff KingApr 16, 2011
  5. status: store format option as an intJonathan Nieder, Apr 16, 2011
  6. Jonathan NiederApr 16, 2011
  7. Junio C HamanoApr 16, 2011
  8. Jonathan NiederApr 16, 2011
  9. Jeff KingApr 16, 2011
  10. status: store format option as an intJonathan Nieder, May 15, 2011

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.