git@vger.kernel.org mailing list mirror (one of many)
 help / Atom feed
* [PATCH] doc/read-tree: remove obsolete remark
@ 2018-01-09 15:30 Andreas G. Schacker
  2018-01-09 19:36 ` Junio C Hamano
  2018-01-11 10:49 ` Jeff King
  0 siblings, 2 replies; 7+ messages in thread
From: Andreas G. Schacker @ 2018-01-09 15:30 UTC (permalink / raw)
  To: git; +Cc: Andreas G. Schacker

Earlier versions of `git read-tree` required the `--prefix` option value
to end with a slash. This restriction was eventually lifted without a
corresponding amendment to the documentation.

Signed-off-by: Andreas G. Schacker <andreas.schacker@gmail.com>
---
 Documentation/git-read-tree.txt | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-read-tree.txt b/Documentation/git-read-tree.txt
index 72bd809fb..f2a07d54d 100644
--- a/Documentation/git-read-tree.txt
+++ b/Documentation/git-read-tree.txt
@@ -81,12 +81,11 @@ OPTIONS
 * when both sides add a path identically.  The resolution
   is to add that path.
 
---prefix=<prefix>/::
+--prefix=<prefix>::
 	Keep the current index contents, and read the contents
 	of the named tree-ish under the directory at `<prefix>`.
 	The command will refuse to overwrite entries that already
-	existed in the original index file. Note that the `<prefix>/`
-	value must end with a slash.
+	existed in the original index file.
 
 --exclude-per-directory=<gitignore>::
 	When running the command with `-u` and `-m` options, the
-- 
2.15.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] doc/read-tree: remove obsolete remark
  2018-01-09 15:30 [PATCH] doc/read-tree: remove obsolete remark Andreas G. Schacker
@ 2018-01-09 19:36 ` Junio C Hamano
  2018-01-11 10:49 ` Jeff King
  1 sibling, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2018-01-09 19:36 UTC (permalink / raw)
  To: Andreas G. Schacker; +Cc: git

"Andreas G. Schacker" <andreas.schacker@gmail.com> writes:

> Earlier versions of `git read-tree` required the `--prefix` option value
> to end with a slash. This restriction was eventually lifted without a
> corresponding amendment to the documentation.
>
> Signed-off-by: Andreas G. Schacker <andreas.schacker@gmail.com>
> ---

Thanks.  "read-tree --prefix=foo- $tree" is allowed these days,
indeed.  Will queue.

What is curious is that 34110cd4 ("Make 'unpack_trees()' have a
separate source and destination index", 2008-03-06) seems to be the
one that removed the check, and the removed contents do not seem to
have much in common with the stated goal of the commit.



>  Documentation/git-read-tree.txt | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/git-read-tree.txt b/Documentation/git-read-tree.txt
> index 72bd809fb..f2a07d54d 100644
> --- a/Documentation/git-read-tree.txt
> +++ b/Documentation/git-read-tree.txt
> @@ -81,12 +81,11 @@ OPTIONS
>  * when both sides add a path identically.  The resolution
>    is to add that path.
>  
> ---prefix=<prefix>/::
> +--prefix=<prefix>::
>  	Keep the current index contents, and read the contents
>  	of the named tree-ish under the directory at `<prefix>`.
>  	The command will refuse to overwrite entries that already
> -	existed in the original index file. Note that the `<prefix>/`
> -	value must end with a slash.
> +	existed in the original index file.
>  
>  --exclude-per-directory=<gitignore>::
>  	When running the command with `-u` and `-m` options, the

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] doc/read-tree: remove obsolete remark
  2018-01-09 15:30 [PATCH] doc/read-tree: remove obsolete remark Andreas G. Schacker
  2018-01-09 19:36 ` Junio C Hamano
@ 2018-01-11 10:49 ` Jeff King
  2018-01-11 19:02   ` Junio C Hamano
  1 sibling, 1 reply; 7+ messages in thread
From: Jeff King @ 2018-01-11 10:49 UTC (permalink / raw)
  To: Andreas G. Schacker; +Cc: Junio C Hamano, git

On Tue, Jan 09, 2018 at 04:30:34PM +0100, Andreas G. Schacker wrote:

> Earlier versions of `git read-tree` required the `--prefix` option value
> to end with a slash. This restriction was eventually lifted without a
> corresponding amendment to the documentation.

Makes sense.

> ---prefix=<prefix>/::
> +--prefix=<prefix>::
>  	Keep the current index contents, and read the contents
>  	of the named tree-ish under the directory at `<prefix>`.
>  	The command will refuse to overwrite entries that already
> -	existed in the original index file. Note that the `<prefix>/`
> -	value must end with a slash.
> +	existed in the original index file.

Is it worth mentioning in the new world order that the slash is not
implied? I.e., that you probably do want to say "--prefix=foo/" if you
want the subdirectory "foo", but do not want to match "foobar"?

-Peff

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] doc/read-tree: remove obsolete remark
  2018-01-11 10:49 ` Jeff King
@ 2018-01-11 19:02   ` Junio C Hamano
  2018-01-11 22:21     ` Jeff King
  0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2018-01-11 19:02 UTC (permalink / raw)
  To: Jeff King; +Cc: Andreas G. Schacker, git

Jeff King <peff@peff.net> writes:

> On Tue, Jan 09, 2018 at 04:30:34PM +0100, Andreas G. Schacker wrote:
>
>> Earlier versions of `git read-tree` required the `--prefix` option value
>> to end with a slash. This restriction was eventually lifted without a
>> corresponding amendment to the documentation.
>
> Makes sense.
>
>> ---prefix=<prefix>/::
>> +--prefix=<prefix>::
>>  	Keep the current index contents, and read the contents
>>  	of the named tree-ish under the directory at `<prefix>`.
>>  	The command will refuse to overwrite entries that already
>> -	existed in the original index file. Note that the `<prefix>/`
>> -	value must end with a slash.
>> +	existed in the original index file.
>
> Is it worth mentioning in the new world order that the slash is not
> implied? I.e., that you probably do want to say "--prefix=foo/" if you
> want the subdirectory "foo", but do not want to match "foobar"?

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?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] doc/read-tree: remove obsolete remark
  2018-01-11 19:02   ` Junio C Hamano
@ 2018-01-11 22:21     ` Jeff King
  2018-01-11 23:14       ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Jeff King @ 2018-01-11 22:21 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Andreas G. Schacker, git

On Thu, Jan 11, 2018 at 11:02:04AM -0800, Junio C Hamano wrote:

> >> ---prefix=<prefix>/::
> >> +--prefix=<prefix>::
> >>  	Keep the current index contents, and read the contents
> >>  	of the named tree-ish under the directory at `<prefix>`.
> >>  	The command will refuse to overwrite entries that already
> >> -	existed in the original index file. Note that the `<prefix>/`
> >> -	value must end with a slash.
> >> +	existed in the original index file.
> >
> > Is it worth mentioning in the new world order that the slash is not
> > implied? I.e., that you probably do want to say "--prefix=foo/" if you
> > want the subdirectory "foo", but do not want to match "foobar"?
> 
> 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.

-Peff

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] doc/read-tree: remove obsolete remark
  2018-01-11 22:21     ` Jeff King
@ 2018-01-11 23:14       ` Junio C Hamano
  2018-01-12  0:35         ` Jeff King
  0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2018-01-11 23:14 UTC (permalink / raw)
  To: Jeff King; +Cc: Andreas G. Schacker, git

Jeff King <peff@peff.net> writes:

> On Thu, Jan 11, 2018 at 11:02:04AM -0800, Junio C Hamano wrote:
>
>> >> ---prefix=<prefix>/::
>> >> +--prefix=<prefix>::
>> >>  	Keep the current index contents, and read the contents
>> >>  	of the named tree-ish under the directory at `<prefix>`.
>> >>  	The command will refuse to overwrite entries that already
>> >> -	existed in the original index file. Note that the `<prefix>/`
>> >> -	value must end with a slash.
>> >> +	existed in the original index file.
>> >
>> > Is it worth mentioning in the new world order that the slash is not
>> > implied? I.e., that you probably do want to say "--prefix=foo/" if you
>> > want the subdirectory "foo", but do not want to match "foobar"?
>> 
>> 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?


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] doc/read-tree: remove obsolete remark
  2018-01-11 23:14       ` Junio C Hamano
@ 2018-01-12  0:35         ` Jeff King
  0 siblings, 0 replies; 7+ messages in thread
From: Jeff King @ 2018-01-12  0:35 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Andreas G. Schacker, git

On Thu, Jan 11, 2018 at 03:14:07PM -0800, Junio C Hamano wrote:

> >> 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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-09 15:30 [PATCH] doc/read-tree: remove obsolete remark Andreas G. Schacker
2018-01-09 19:36 ` Junio C Hamano
2018-01-11 10:49 ` Jeff King
2018-01-11 19:02   ` Junio C Hamano
2018-01-11 22:21     ` Jeff King
2018-01-11 23:14       ` Junio C Hamano
2018-01-12  0:35         ` Jeff King

git@vger.kernel.org mailing list mirror (one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.org/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox