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

Re: log/show: relative pathnames do not work in rev:path

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Dec 18, 2007, 21:53 UTC
Message-ID
<alpine.LFD.0.9999.0712181347140.21557@woody.linux-foundation.org>
In-Reply-To
<200712182224.28152.jnareb@gmail.com>
On Tue, 18 Dec 2007, Jakub Narebski wrote:
Show 6 quoted lines
> 
> What cwd? <path> in <tree-ish>:<path> syntax is "relative" to <tree-ish>.
> IMHO "<tree-ish>:<path>" should be considered (and is considered) as
> one object: current working directory doesn't matter at all there,
> contrary to "<tree-ish> -- <pathspec>" where it is natural that <pathspec>
> is relative to current working directory.
Indeed.

The <treeish>:<path> syntax *is* relative, but it's relative to the exact *treeish* that is given. It has nothing what-so-ever to do with the current working directory, since the user has explicitly given an exact tree object, and trying to fake that out would be actively wrong.

That said, I can kind of understand the wish for something like this, and I suspect that we could make the "commit->tree" translation take the current path into account. In other words, maybe we should have something like this:

	/*
	 * This sequence currently works
	 */
	[torvalds@woody git]$ git rev-parse HEAD
	f9c5a80cdf2265f2df7712fad9f1fb7ef68b4768
	[torvalds@woody git]$ git rev-parse HEAD^{tree}
	051fb0c0dff4371f97f8ad9407f9f1fd335b1682
	[torvalds@woody git]$ git rev-parse HEAD^{tree}:t
	49d8bcd7a2df5c17193b1d002c4a8489d4fa990c
	/*
	 * .. but this would be new
	 */
	[torvalds@woody git]$ cd t
	[torvalds@woody t]$ git rev-parse HEAD^{tree}
	49d8bcd7a2df5c17193b1d002c4a8489d4fa990c

where the magic is *not* done by any "SHA1 path lookup" at all, but is simply done by the commit->tree lookup. At least at that point it would make logical sense (although it would probably be quite painful to implement).

			Linus
Previous: Jakub NarebskiNext: Dana How
Message 12 of 43 in “log/show: relative pathnames do not work in rev:path”
  1. Alex RiesenDec 18, 2007
  2. Jakub NarebskiDec 18, 2007
  3. Alex RiesenDec 18, 2007
  4. Simple support for tree entry specification with relative pathnamesAlex Riesen, Dec 18, 2007
  5. Introduce pathexpand: syntax-level chdir into the given cwdAlex Riesen, Dec 18, 2007
  6. Use pathexpand to preparse the relative pathnames in blob referencesAlex Riesen, Dec 18, 2007
  7. Dana HowDec 18, 2007
  8. Jeff KingDec 19, 2007
  9. Dana HowDec 18, 2007
  10. Alex RiesenDec 18, 2007
  11. Jakub NarebskiDec 18, 2007
  12. Linus TorvaldsDec 18, 2007
  13. Dana HowDec 18, 2007
  14. Alex RiesenDec 18, 2007
  15. Junio C HamanoDec 18, 2007
  16. Dana HowDec 18, 2007
  17. Johannes SchindelinDec 18, 2007
  18. Junio C HamanoDec 19, 2007
  19. Alex RiesenDec 18, 2007
  20. Johannes SchindelinDec 18, 2007
  21. Dana HowDec 18, 2007
  22. Johannes SchindelinDec 18, 2007
  23. Linus TorvaldsDec 19, 2007
  24. Dana HowDec 19, 2007
  25. Alex RiesenDec 19, 2007
  26. Jakub NarebskiDec 19, 2007
  27. Dana HowDec 19, 2007
  28. Jakub NarebskiDec 19, 2007
  29. sha1_name: grok <revision>:./<relative-path>Johannes Schindelin, Dec 19, 2007
  30. Jeff KingDec 19, 2007
  31. Dana HowDec 19, 2007
  32. Alex RiesenDec 19, 2007
  33. Junio C HamanoDec 20, 2007
  34. Johannes SchindelinDec 20, 2007
  35. Nguyen Thai Ngoc DuyDec 21, 2007
  36. Junio C HamanoDec 21, 2007
  37. Nguyen Thai Ngoc DuyDec 21, 2007
  38. Johannes SchindelinDec 22, 2007
  39. Jakub NarebskiDec 18, 2007
  40. Dana HowDec 18, 2007
  41. Junio C HamanoDec 18, 2007
  42. Jakub NarebskiDec 18, 2007
  43. Alex RiesenDec 19, 2007

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.