{"thread":{"id":"47576","subject":"[PATCH] doc/read-tree: remove obsolete remark","startedAt":"2018-01-09T15:33:06Z","lastAt":"2018-01-12T00:35:11Z","messageCount":7,"participants":["Andreas G. Schacker","Junio C Hamano","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"336261","messageId":"20180109153034.22970-1-andreas.schacker@gmail.com","threadId":"47576","inReplyTo":null,"subject":"[PATCH] doc/read-tree: remove obsolete remark","fromName":"Andreas G. Schacker","fromEmail":"andreas.schacker@gmail.com","sentAt":"2018-01-09T15:30:34Z","receivedAt":"2018-01-09T15:33:06Z","isPatch":true,"sender":{"key":"andreas.schacker@gmail.com","avatar":null},"body":"Earlier versions of `git read-tree` required the `--prefix` option value\nto end with a slash. This restriction was eventually lifted without a\ncorresponding amendment to the documentation.\n\nSigned-off-by: Andreas G. Schacker <andreas.schacker@gmail.com>\n---\n Documentation/git-read-tree.txt | 5 ++---\n 1 file changed, 2 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-read-tree.txt b/Documentation/git-read-tree.txt\nindex 72bd809fb..f2a07d54d 100644\n--- a/Documentation/git-read-tree.txt\n+++ b/Documentation/git-read-tree.txt\n@@ -81,12 +81,11 @@ OPTIONS\n * when both sides add a path identically.  The resolution\n   is to add that path.\n \n---prefix=<prefix>/::\n+--prefix=<prefix>::\n \tKeep the current index contents, and read the contents\n \tof the named tree-ish under the directory at `<prefix>`.\n \tThe command will refuse to overwrite entries that already\n-\texisted in the original index file. Note that the `<prefix>/`\n-\tvalue must end with a slash.\n+\texisted in the original index file.\n \n --exclude-per-directory=<gitignore>::\n \tWhen running the command with `-u` and `-m` options, the\n-- \n2.15.1\n\n"},{"id":"336307","messageId":"xmqq373e6cyy.fsf@gitster.mtv.corp.google.com","threadId":"47576","inReplyTo":"20180109153034.22970-1-andreas.schacker@gmail.com","subject":"Re: [PATCH] doc/read-tree: remove obsolete remark","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-01-09T19:36:53Z","receivedAt":"2018-01-09T19:37:00Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Andreas G. Schacker\" <andreas.schacker@gmail.com> writes:\n\n> Earlier versions of `git read-tree` required the `--prefix` option value\n> to end with a slash. This restriction was eventually lifted without a\n> corresponding amendment to the documentation.\n>\n> Signed-off-by: Andreas G. Schacker <andreas.schacker@gmail.com>\n> ---\n\nThanks.  \"read-tree --prefix=foo- $tree\" is allowed these days,\nindeed.  Will queue.\n\nWhat is curious is that 34110cd4 (\"Make 'unpack_trees()' have a\nseparate source and destination index\", 2008-03-06) seems to be the\none that removed the check, and the removed contents do not seem to\nhave much in common with the stated goal of the commit.\n\n\n\n>  Documentation/git-read-tree.txt | 5 ++---\n>  1 file changed, 2 insertions(+), 3 deletions(-)\n>\n> diff --git a/Documentation/git-read-tree.txt b/Documentation/git-read-tree.txt\n> index 72bd809fb..f2a07d54d 100644\n> --- a/Documentation/git-read-tree.txt\n> +++ b/Documentation/git-read-tree.txt\n> @@ -81,12 +81,11 @@ OPTIONS\n>  * when both sides add a path identically.  The resolution\n>    is to add that path.\n>  \n> ---prefix=<prefix>/::\n> +--prefix=<prefix>::\n>  \tKeep the current index contents, and read the contents\n>  \tof the named tree-ish under the directory at `<prefix>`.\n>  \tThe command will refuse to overwrite entries that already\n> -\texisted in the original index file. Note that the `<prefix>/`\n> -\tvalue must end with a slash.\n> +\texisted in the original index file.\n>  \n>  --exclude-per-directory=<gitignore>::\n>  \tWhen running the command with `-u` and `-m` options, the\n"},{"id":"336452","messageId":"20180111104914.GA5897@sigill.intra.peff.net","threadId":"47576","inReplyTo":"20180109153034.22970-1-andreas.schacker@gmail.com","subject":"Re: [PATCH] doc/read-tree: remove obsolete remark","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2018-01-11T10:49:14Z","receivedAt":"2018-01-11T10:49:23Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jan 09, 2018 at 04:30:34PM +0100, Andreas G. Schacker wrote:\n\n> Earlier versions of `git read-tree` required the `--prefix` option value\n> to end with a slash. This restriction was eventually lifted without a\n> corresponding amendment to the documentation.\n\nMakes sense.\n\n> ---prefix=<prefix>/::\n> +--prefix=<prefix>::\n>  \tKeep the current index contents, and read the contents\n>  \tof the named tree-ish under the directory at `<prefix>`.\n>  \tThe command will refuse to overwrite entries that already\n> -\texisted in the original index file. Note that the `<prefix>/`\n> -\tvalue must end with a slash.\n> +\texisted in the original index file.\n\nIs it worth mentioning in the new world order that the slash is not\nimplied? I.e., that you probably do want to say \"--prefix=foo/\" if you\nwant the subdirectory \"foo\", but do not want to match \"foobar\"?\n\n-Peff\n"},{"id":"336472","messageId":"xmqqbmi0z0b7.fsf@gitster.mtv.corp.google.com","threadId":"47576","inReplyTo":"20180111104914.GA5897@sigill.intra.peff.net","subject":"Re: [PATCH] doc/read-tree: remove obsolete remark","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-01-11T19:02:04Z","receivedAt":"2018-01-11T19:02:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Tue, Jan 09, 2018 at 04:30:34PM +0100, Andreas G. Schacker wrote:\n>\n>> Earlier versions of `git read-tree` required the `--prefix` option value\n>> to end with a slash. This restriction was eventually lifted without a\n>> corresponding amendment to the documentation.\n>\n> Makes sense.\n>\n>> ---prefix=<prefix>/::\n>> +--prefix=<prefix>::\n>>  \tKeep the current index contents, and read the contents\n>>  \tof the named tree-ish under the directory at `<prefix>`.\n>>  \tThe command will refuse to overwrite entries that already\n>> -\texisted in the original index file. Note that the `<prefix>/`\n>> -\tvalue must end with a slash.\n>> +\texisted in the original index file.\n>\n> Is it worth mentioning in the new world order that the slash is not\n> implied? I.e., that you probably do want to say \"--prefix=foo/\" if you\n> want the subdirectory \"foo\", but do not want to match \"foobar\"?\n\nDoesn't \"git read-tree --prefix=previous HEAD^\" add paths like\n\"previous/Documentation/Makefile\" to the index, i.e. instead of\nforcing you to have the required slash at the end, we give one for\nfree when it is missing?\n"},{"id":"336485","messageId":"20180111222155.GA13570@sigill.intra.peff.net","threadId":"47576","inReplyTo":"xmqqbmi0z0b7.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH] doc/read-tree: remove obsolete remark","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2018-01-11T22:21:55Z","receivedAt":"2018-01-11T22:22:07Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jan 11, 2018 at 11:02:04AM -0800, Junio C Hamano wrote:\n\n> >> ---prefix=<prefix>/::\n> >> +--prefix=<prefix>::\n> >>  \tKeep the current index contents, and read the contents\n> >>  \tof the named tree-ish under the directory at `<prefix>`.\n> >>  \tThe command will refuse to overwrite entries that already\n> >> -\texisted in the original index file. Note that the `<prefix>/`\n> >> -\tvalue must end with a slash.\n> >> +\texisted in the original index file.\n> >\n> > Is it worth mentioning in the new world order that the slash is not\n> > implied? I.e., that you probably do want to say \"--prefix=foo/\" if you\n> > want the subdirectory \"foo\", but do not want to match \"foobar\"?\n> \n> Doesn't \"git read-tree --prefix=previous HEAD^\" add paths like\n> \"previous/Documentation/Makefile\" to the index, i.e. instead of\n> forcing you to have the required slash at the end, we give one for\n> free when it is missing?\n\nYes, I think it does what you'd want with that path. But it would not do\nwhat you want by adding \"previous-file\". Which seems like a gotcha that\nshould be mentioned.\n\n-Peff\n"},{"id":"336486","messageId":"xmqqd12gxa2o.fsf@gitster.mtv.corp.google.com","threadId":"47576","inReplyTo":"20180111222155.GA13570@sigill.intra.peff.net","subject":"Re: [PATCH] doc/read-tree: remove obsolete remark","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-01-11T23:14:07Z","receivedAt":"2018-01-11T23:14:28Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Thu, Jan 11, 2018 at 11:02:04AM -0800, Junio C Hamano wrote:\n>\n>> >> ---prefix=<prefix>/::\n>> >> +--prefix=<prefix>::\n>> >>  \tKeep the current index contents, and read the contents\n>> >>  \tof the named tree-ish under the directory at `<prefix>`.\n>> >>  \tThe command will refuse to overwrite entries that already\n>> >> -\texisted in the original index file. Note that the `<prefix>/`\n>> >> -\tvalue must end with a slash.\n>> >> +\texisted in the original index file.\n>> >\n>> > Is it worth mentioning in the new world order that the slash is not\n>> > implied? I.e., that you probably do want to say \"--prefix=foo/\" if you\n>> > want the subdirectory \"foo\", but do not want to match \"foobar\"?\n>> \n>> Doesn't \"git read-tree --prefix=previous HEAD^\" add paths like\n>> \"previous/Documentation/Makefile\" to the index, i.e. instead of\n>> forcing you to have the required slash at the end, we give one for\n>> free when it is missing?\n>\n> Yes, I think it does what you'd want with that path. But it would not do\n> what you want by adding \"previous-file\". Which seems like a gotcha that\n> should be mentioned.\n\nI am a bit puzzled.  \n\nDo you mean a user who types \"git read-tree --prefix=v1- HEAD^\" may\nbe expecting to see that the blob object \"HEAD^:Makefile\" added at\npath \"v1-Makefile\" etc?\n\n"},{"id":"336487","messageId":"20180112003503.GA14128@sigill.intra.peff.net","threadId":"47576","inReplyTo":"xmqqd12gxa2o.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH] doc/read-tree: remove obsolete remark","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2018-01-12T00:35:04Z","receivedAt":"2018-01-12T00:35:11Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jan 11, 2018 at 03:14:07PM -0800, Junio C Hamano wrote:\n\n> >> Doesn't \"git read-tree --prefix=previous HEAD^\" add paths like\n> >> \"previous/Documentation/Makefile\" to the index, i.e. instead of\n> >> forcing you to have the required slash at the end, we give one for\n> >> free when it is missing?\n> >\n> > Yes, I think it does what you'd want with that path. But it would not do\n> > what you want by adding \"previous-file\". Which seems like a gotcha that\n> > should be mentioned.\n> \n> I am a bit puzzled.  \n> \n> Do you mean a user who types \"git read-tree --prefix=v1- HEAD^\" may\n> be expecting to see that the blob object \"HEAD^:Makefile\" added at\n> path \"v1-Makefile\" etc?\n\nSorry, I was somewhat turned around in my example, thinking that we were\nmatching existing entries by prefix here and not putting entries into a\nnew prefix[1].\n\nBut yes, your example hits the point that I think is left unsaid: does\n\"--prefix=sub\" mean the same thing as \"--prefix=sub/\", or is it a true\nstring prefix? Reading more carefully, though, we say \"under the\ndirectory at <prefix>\" in the earlier part, which is probably\nsufficient.\n\nNote that this _is_ different than \"git checkout-index --prefix\", which\nis a strict string prefix (i.e., you can checkout \"--prefix=v1-\" and get\n\"v1-Makefile\").\n\n-Peff\n\n[1] I was trying to figure out which feature of Git I was confusing it\n    with, but couldn't find one. I think I may have just been thinking\n    of checkout-index (which is not about matching existing paths, but\n    does have the different behavior). Normally matching of existing\n    paths is done with pathspecs, which I think should all use directory\n    boundaries for prefix-matching.\n"}]}