From: Junio C Hamano <gitster@pobox.com>
To: Eric Wong <normalperson@yhbt.net>
Cc: git@vger.kernel.org, Anton Gyllenberg <anton@iki.fi>
Subject: Re: [PATCH] git-svn: fix ls-tree usage with dash-prefixed paths
Date: Sun, 29 Mar 2009 23:44:08 -0700 [thread overview]
Message-ID: <7v3acvldc7.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: 20090329215651.GA4355@dcvr.yhbt.net
Eric Wong <normalperson@yhbt.net> writes:
> Junio C Hamano <gitster@pobox.com> wrote:
>> Eric Wong <normalperson@yhbt.net> writes:
>>
>> > To find the blob object name given a tree and pathname, we were
>> > incorrectly calling "git ls-tree" with a "--" argument followed
>> > by the pathname of the file we wanted to get.
>> >
>> > git ls-tree <TREE> -- --dashed/path/name.c
>> >
>> > Unlike many command-line interfaces, the "--" alone does not
>> > symbolize the end of non-option arguments on the command-line.
>> >
>> > ls-tree interprets the "--" as a prefix to match against, thus
>> > the entire contents of the --dashed/* hierarchy would be
>> > returned because the "--" matches "--dashed" and every path
>> > under it.
>>
>> The above makes only half a sense to me. In an empty directory:
>
> Ah, I think you missed this line:
>
> "the entire contents of the --dashed/* hierarchy would be"
Actually, that was what I was trying to demonstrate to be false. Notice
the empty output from the first ls-tree with only -- and no other pathspec
on the command line. "--" should not match "--dashed/*" anything (but
also notice that I said "should" here).
>> $ git init
>> Initialized empty Git repository in /tmp/empty/.git
>> $ mkdir -p ./--dashed/path
>> $ >./--dashed/path/name
>
> # Add a second file
> >./--dashed/path/ame
I think that is an independent bug. Not just "--" but it appears "--d"
seems to hit it (and this is an ancient bug---even v1.0.0 seems to have
it).
> [1] But if we had time travel we could just release git before any other
> SCM and hopefully not have to deal with SVN at all :)
;-)
I suspect that ls-tree needs a fix, not about "--" but about the pathspec
filtering. It appears that the part that decides if a subtree is worth
traversing into uses the correct "is a pathspec pattern match leading path
components?" semantics (i.e. "--dashed" matches but "--" doesn't), but
after traversing into subtrees, the part that emits the output uses a
broken semantics "does the path have any pathspec patter as its prefix?"
It shouldn't check for "prefix", but for "leading path components", in
other words, the match must happen at directory boundaries.
And I do not think *this* bug is too late to fix. We should fix it.
next prev parent reply other threads:[~2009-03-30 6:45 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-26 10:31 svn clone Checksum mismatch question Gilbert Liddell
2009-03-26 13:02 ` Björn Steinbrink
2009-03-26 13:28 ` Gilbert Liddell
2009-03-26 13:54 ` Sverre Rabbelier
2009-03-26 14:18 ` Gilbert Liddell
2009-03-26 14:34 ` Johannes Schindelin
2009-03-26 14:35 ` Anton Gyllenberg
2009-03-27 11:18 ` Anton Gyllenberg
2009-03-29 6:08 ` Eric Wong
2009-03-29 6:10 ` [PATCH] git-svn: fix ls-tree usage with dash-prefixed paths Eric Wong
2009-03-29 20:33 ` Junio C Hamano
2009-03-29 21:56 ` Eric Wong
2009-03-30 6:44 ` Junio C Hamano [this message]
2009-03-30 17:41 ` Eric Wong
2009-03-30 18:05 ` Junio C Hamano
2009-03-30 22:58 ` Eric Wong
2009-03-31 7:11 ` Björn Steinbrink
2009-03-31 7:31 ` Björn Steinbrink
2009-03-31 9:41 ` Björn Steinbrink
2009-03-31 15:05 ` [PATCH] tree_entry_interesting: Only recurse when the pathspec is a leading path component Björn Steinbrink
2009-04-02 4:32 ` Junio C Hamano
2009-04-02 4:41 ` [PATCH] match_tree_entry(): a pathspec only matches at directory boundaries Junio C Hamano
2009-04-02 16:36 ` Linus Torvalds
2009-04-02 11:38 ` [PATCH] tree_entry_interesting: Only recurse when the pathspec is a leading path component Björn Steinbrink
2009-04-03 16:25 ` Junio C Hamano
2009-03-30 5:28 ` [PATCH] git-svn: fix ls-tree usage with dash-prefixed paths Björn Steinbrink
2009-03-30 7:26 ` svn clone Checksum mismatch question Anton Gyllenberg
2009-03-26 14:34 ` Peter Harris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7v3acvldc7.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=anton@iki.fi \
--cc=git@vger.kernel.org \
--cc=normalperson@yhbt.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).