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

Re: [PATCH] Documentation/git-ls-tree.txt: Add a caveat about prefixing pathspec

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 21, 2008, 08:00 UTC
Message-ID
<7v1w1nvf7q.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20080721075618.14163.45309.stgit@localhost>
Petr Baudis <pasky@suse.cz> writes:
> +Note that within a subdirectory of the working copy, 'git ls-tree'
> +will automatically prepend the subdirectory prefix to the specified
> +paths and assume just the prefix was specified in case no paths were
> +given --- no matter what the tree object is!
Don't be negative upfront.  Explain why this is a good thing first.
	... were given.  This is useful when you are deep in a
	subdirectory and want to inspect the list of files in an arbitrary
	commit.  E.g.
		$ cd some/deep/path
		$ git ls-tree --name-only -r HEAD~20
	will list the files in some/deep/path (i.e. where you are) 20
	commits ago, just like running "/bin/ls" there will give you the
	list of files you have right now.
Show 8 quoted lines
> +Thus, within a subdirectory, 'git ls-tree' behaves as expected
> +only when run on a root tree object (e.g. with a 'HEAD' tree-ish,
> +but not anymore when passed 'HEAD:Documentation' instead).
> +
> +
>  OPTIONS
>  -------
>  <tree-ish>::
Previous: Petr BaudisNext: Petr Baudis
Message 7 of 20 in “Add a notice to the doc of git-ls-tree.”
  1. Add a notice to the doc of git-ls-tree.Steve Frécinaux, Jul 20, 2008
  2. Petr BaudisJul 20, 2008
  3. Steve FrécinauxJul 20, 2008
  4. Junio C HamanoJul 20, 2008
  5. Petr BaudisJul 20, 2008
  6. Documentation/git-ls-tree.txt: Add a caveat about prefixing pathspecPetr Baudis, Jul 21, 2008
  7. Junio C HamanoJul 21, 2008
  8. Petr BaudisJul 21, 2008
  9. Junio C HamanoJul 22, 2008
  10. Petr BaudisJul 22, 2008
  11. Petr BaudisJul 28, 2008
  12. Junio C HamanoJul 28, 2008
  13. Junio C HamanoJul 28, 2008
  14. Steve FrécinauxJul 21, 2008
  15. Junio C HamanoJul 20, 2008
  16. Petr BaudisJul 21, 2008
  17. Junio C HamanoJul 21, 2008
  18. Petr BaudisJul 21, 2008
  19. Junio C HamanoJul 21, 2008
  20. Petr BaudisJul 21, 2008

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.