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

Re: [PATCH] Add an optional <mode> argument to commit/status -u|--untracked-files option

From
Jeff King <peff@peff.net>
Date
Jun 3, 2008, 22:27 UTC
Message-ID
<20080603222704.GA20256@sigill.intra.peff.net>
In-Reply-To
<4845B4E8.1040402@trolltech.com>
On Tue, Jun 03, 2008 at 11:17:28PM +0200, Marius Storm-Olsen wrote:
Show 11 quoted lines
> You are right. This is the joy of the parse-options() handling of  
> short-options with optional arguments.
>
> -us before meant:
>     1) commit
>     2) show all untracked files
>     3) sign-of the commit
>
> I guess it would be possible to reparse the options without the -u, if  
> the argument is not one of the three (none,normal,all), but I'm not sure 
> it's _that_ critical. Opinions?

I think it would be reasonable to make "-u" mean the same as always, and for "--untracked-files" to have an optional argument. There isn't direct support for that construct in parse_options, but you could just make it two separate options that happen to tweak the same value (though I guess they would be displayed separately in the auto-generated usage).

Some GNU utils use this strategy to extend existing options. E.g., "ls -p" comes from XSI and takes no argument, but the long-option form of --indicator-style=<none|slash|file-type|classify> gives more options.

That makes it a little less pleasant to type the extended version, but compatibility is maintained. Though I tend to wonder about this option in particular...isn't this generally a user preference? Should it perhaps be found in the config file instead?

-Peff
Previous: しらいしななこNext: Alex Riesen
Message 8 of 11 in “Add an optional <mode> argument to commit/status -u|--untracked-files option”
  1. Add an optional <mode> argument to commit/status -u|--untracked-files optionMarius Storm-Olsen, Jun 3, 2008
  2. Add configuration option for default untracked files modeMarius Storm-Olsen, Jun 3, 2008
  3. Junio C HamanoJun 3, 2008
  4. Marius Storm-OlsenJun 3, 2008
  5. Jeff KingJun 3, 2008
  6. Marius Storm-OlsenJun 3, 2008
  7. しらいしななこJun 3, 2008
  8. Jeff KingJun 3, 2008
  9. Alex RiesenJun 6, 2008
  10. Marius Storm-OlsenJun 6, 2008
  11. Jeff KingJun 3, 2008

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.