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

Re: git diff flags

From
Jeff King <peff@peff.net>
Date
May 8, 2010, 04:06 UTC
Message-ID
<20100508040602.GA14998@coredump.intra.peff.net>
In-Reply-To
<19428.27908.870639.422432@winooski.ccs.neu.edu>
On Fri, May 07, 2010 at 03:41:56PM -0400, Eli Barzilay wrote:
> There's something strange with how `git diff' parses its flags:
Yep.
>   git diff --some-bogus-flag
>   --> complains as expected
Yep.
>   git diff --follow
>   --> works but there's no mention of this in the man page, and it
>       doesn't look like it's doing anything

--follow is a "diff option" even though it is about revision traversal. This is an artifact of the implementation, where rename-following happens at a low level where we have only diff_options. It should be possible to fix, though (parse the option at the revision layer, but have it set the diff_options flag).

>   git diff -C -M
>   --> works as expected too
Yep.
>   git diff -CM
>   --> doesn't say anything (but it does exit with an error code)

The revision and diff parsers do not use parse_options, and thus don't understand things like bundling. Even if they did, -C takes an optional argument. In this case, the argument format is bogus, so it aborts, but for some reason there is no error message (it is the same with -B, -M, and -C).

>   git diff -CM --I-can-write-anything here!
>   --> does the same

Because we barfed at -CM already. It only looks funny because we didn't bother to print a message.

Patches welcome.
-Peff
Previous: Eli BarzilayNext: Jeff King
Message 2 of 3 in “git diff flags”
  1. Eli BarzilayMay 7, 2010
  2. Jeff KingMay 8, 2010
  3. Jeff KingMay 8, 2010

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.