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

Re: [PATCH] sha1_name(): accept ':directory/' to get at the cache_tree

From
Alex Riesen <fork0@t-online.de>
Date
Dec 22, 2006, 16:09 UTC
Message-ID
<20061222160944.GA4651@steel.home>
In-Reply-To
<Pine.LNX.4.63.0612221316550.19693@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin, Fri, Dec 22, 2006 13:18:55 +0100:
Show 21 quoted lines
> > > If the cache tree is not up-to-date, it will be updated first. So, now
> > > 
> > > 	$ git show :Documentation/
> > > 
> > > will in effect show what files/directories are in the index' version
> > > of the directory Documentation. The three commands
> > > 
> > > 	$ git show :./
> > > 	$ git show :.
> > > 	$ git show :
> > > 
> > > are all equivalent and show the index' idea of the root directory.
> > 
> > That is a bit unexpected if you're not in the root directory of
> > repository, but in some subdir of the working directory.
> > Why root? Why not the current directory relative to root?
> 
> Why root? Because you are not asking for the working directory. Use "ls" 
> for that. You are asking for the index. If you git-show a commit, you 
> don't expect the output to be restricted by the subdirectory you're in, 
> either, right?

Of course I do. You're breaking a very well-known and widely used idiom here: the "." means current or at least somehow related to the current directory. Why would you expect "git show :." to show everything from root on if your current directory is "Documentation"? Yes, it is a commit which "git show" displays, but the patches/diffs are restricted by filenames, and that is where the old rules come into play. And I would actually expect ":/" to filter from the root on, and ":." to mean the current directory.

Previous: Johannes Schindelin
Message 10 of 10 in “sha1_name(): accept ':directory/' to get at the cache_tree”
  1. sha1_name(): accept ':directory/' to get at the cache_treeJohannes Schindelin, Dec 22, 2006
  2. Junio C HamanoDec 22, 2006
  3. Jakub NarebskiDec 22, 2006
  4. Johannes SchindelinDec 22, 2006
  5. Jakub NarebskiDec 22, 2006
  6. Johannes SchindelinDec 22, 2006
  7. Johannes SchindelinDec 22, 2006
  8. Alex RiesenDec 22, 2006
  9. Johannes SchindelinDec 22, 2006
  10. Alex RiesenDec 22, 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.