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

Re: git-format-patch possible regressions

From
Linus Torvalds <torvalds@osdl.org>
Date
May 25, 2006, 19:43 UTC
Message-ID
<Pine.LNX.4.64.0605251233300.5623@g5.osdl.org>
In-Reply-To
<e5bfff550605251223g2cf8cfb9vfa18d016b369188d@mail.gmail.com>
On Thu, 25 May 2006, Marco Costalba wrote:
> 
> 2) Unhandled ranges list
> 
> $ git-format-patch -s HEAD^..HEAD HEAD^^..HEAD^
You _really_ shouldn't use this "mix two ranges" format.
It may have "worked" before, but it
 - worked differently from all other git ranges
 - it was really an implementation detail (handling each argument 
   separately)

The "x..y" format is defined to mean the same thing "y ^x", and that means that "HEAD^..HEAD HEAD^^..HEAD^" really does mean the same thing as "^HEAD^ ^HEAD^^ HEAD HEAD^", which in turn means the same thing as "^HEAD^ HEAD" from a reachability standpoint (since HEAD^ is by definition reachable from HEAD, adding it won't change the revision list, and the same goes for ^HEAD^^ vs ^HEAD^).

So thus "HEAD^..HEAD HEAD^^..HEAD^" really _is_ the same thing as "HEAD^..HEAD", and any tool that thought otherwise was just being very confused.

Now, we could choose to try to make "a..b" mean something else (ie make the "^a" part only meaningful for that particular "sub-query"), and yes, in many ways that would be a more intuitive thing, but it's not how git revision descriptions work currently, and if we make that change we should do it across the board.

(It's not an easy change to make, but it should be possible by having multiple separate NECESSARY/UNNECESSARY bits, and make the revision walking logic a whole lot more complicated than it already is).

So I'd argue that you should really do something like
	( git-rev-list a..b ; git-rev-list c..d ) |
		git-format-patch --stdin
in qgit if you want the ranges to be truly independent.

(And no, I don't think git-format-patch takes a "--stdin" argument, but it might not be unreasonable to add it as a generic revision walking argument for scripting like this).

			Linus
Previous: Marco CostalbaNext: Marco Costalba
Message 2 of 14 in “git-format-patch possible regressions”
  1. Marco CostalbaMay 25, 2006
  2. Linus TorvaldsMay 25, 2006
  3. Marco CostalbaMay 25, 2006
  4. Junio C HamanoMay 25, 2006
  5. Marco CostalbaMay 25, 2006
  6. Johannes SchindelinMay 25, 2006
  7. Johannes SchindelinMay 25, 2006
  8. Junio C HamanoMay 25, 2006
  9. Johannes SchindelinMay 25, 2006
  10. Marco CostalbaMay 26, 2006
  11. Junio C HamanoMay 26, 2006
  12. Jakub NarebskiMay 26, 2006
  13. Marco CostalbaMay 27, 2006
  14. Johannes SchindelinMay 28, 2006

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.