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

Re: [PATCH] git-diff-*: Allow "--name-only -z" as alias for "--name-only-z"

From
Linus Torvalds <torvalds@osdl.org>
Date
Jul 15, 2005, 05:12 UTC
Message-ID
<Pine.LNX.4.58.0507142205580.19183@g5.osdl.org>
In-Reply-To
<7vmzop56fo.fsf@assigned-by-dhcp.cox.net>
On Thu, 14 Jul 2005, Junio C Hamano wrote:
Show 5 quoted lines
> 
> That said, I have been hating that diff options parsing for
> quite a while, and I've been thinking about cleaning it up along
> the lines I'll outline here, but have not done anything about
> it.  Care to help me out?

I didn't do what you suggested, but I _did_ split the "format" up into "format + line_termination", which in my opinion cleaned up part of it a _lot_.

So now "-z" only sets "line_termination" to NUL. "format" starts out as "DIFF_FORMAT_RAW" (which is the old HUMAN/MACHINE format - the difference between those two are now the line termination) but can be "PATCH" and "NAME".

Now, DIFF_FORMAT_PATCH + -z wouldn't seem to make any sense at all, but you can actually do so, and it actually makes some amount of sense for the case of

	git-diff-tree -v -p -z HEAD

where the "-z" means that the commit _message_ will be terminated by a NUL character, while the "-v" obviously means that the commit message will be printed at all, and the "-p" means that the diff gets printed as a patch.

But the diff obviously gets printed with newlines (as does any newlines _within_ the commit message), not with lines terminated by NUL's.

So "--name-only-z" no longer exists. It's "-z --name-only" (in any order, quite naturally).

			Linus
Previous: Matthias UrlichsNext: Junio C Hamano
Message 6 of 7 in “git-diff-*: Allow "--name-only -z" as alias for "--name-only-z"”
  1. git-diff-*: Allow "--name-only -z" as alias for "--name-only-z"Matthias Urlichs, Jul 14, 2005
  2. Junio C HamanoJul 14, 2005
  3. Matthias UrlichsJul 14, 2005
  4. Junio C HamanoJul 14, 2005
  5. Matthias UrlichsJul 14, 2005
  6. Linus TorvaldsJul 15, 2005
  7. Junio C HamanoJul 15, 2005

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.