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

Re: [PATCH] doc/read-tree: remove obsolete remark

From
Jeff King <peff@peff.net>
Date
Jan 12, 2018, 00:35 UTC
Message-ID
<20180112003503.GA14128@sigill.intra.peff.net>
In-Reply-To
<xmqqd12gxa2o.fsf@gitster.mtv.corp.google.com>
On Thu, Jan 11, 2018 at 03:14:07PM -0800, Junio C Hamano wrote:
Show 14 quoted lines
> >> Doesn't "git read-tree --prefix=previous HEAD^" add paths like
> >> "previous/Documentation/Makefile" to the index, i.e. instead of
> >> forcing you to have the required slash at the end, we give one for
> >> free when it is missing?
> >
> > Yes, I think it does what you'd want with that path. But it would not do
> > what you want by adding "previous-file". Which seems like a gotcha that
> > should be mentioned.
> 
> I am a bit puzzled.  
> 
> Do you mean a user who types "git read-tree --prefix=v1- HEAD^" may
> be expecting to see that the blob object "HEAD^:Makefile" added at
> path "v1-Makefile" etc?

Sorry, I was somewhat turned around in my example, thinking that we were matching existing entries by prefix here and not putting entries into a new prefix[1].

But yes, your example hits the point that I think is left unsaid: does "--prefix=sub" mean the same thing as "--prefix=sub/", or is it a true string prefix? Reading more carefully, though, we say "under the directory at <prefix>" in the earlier part, which is probably sufficient.

Note that this _is_ different than "git checkout-index --prefix", which is a strict string prefix (i.e., you can checkout "--prefix=v1-" and get "v1-Makefile").

-Peff
[1] I was trying to figure out which feature of Git I was confusing it
    with, but couldn't find one. I think I may have just been thinking
    of checkout-index (which is not about matching existing paths, but
    does have the different behavior). Normally matching of existing
    paths is done with pathspecs, which I think should all use directory
    boundaries for prefix-matching.
Previous: Junio C Hamano
Message 7 of 7 in “doc/read-tree: remove obsolete remark”
  1. doc/read-tree: remove obsolete remarkAndreas G. Schacker, Jan 9, 2018
  2. Junio C HamanoJan 9, 2018
  3. Jeff KingJan 11, 2018
  4. Junio C HamanoJan 11, 2018
  5. Jeff KingJan 11, 2018
  6. Junio C HamanoJan 11, 2018
  7. Jeff KingJan 12, 2018

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.