git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Björn Steinbrink" <B.Steinbrink@gmx.de>
To: Eric Wong <normalperson@yhbt.net>
Cc: Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org, Anton Gyllenberg <anton@iki.fi>
Subject: Re: [PATCH] git-svn: fix ls-tree usage with dash-prefixed paths
Date: Tue, 31 Mar 2009 09:11:00 +0200	[thread overview]
Message-ID: <20090331071100.GA3307@atjola.homenet> (raw)
In-Reply-To: <20090330225834.GA24254@dcvr.yhbt.net>

On 2009.03.30 15:58:34 -0700, Eric Wong wrote:
> Junio C Hamano <gitster@pobox.com> wrote:
> > Eric Wong <normalperson@yhbt.net> writes:
> > > From the ls-tree documentation, I was under the impression that "--"
> > > matching "--dashed" was intended:
> > >
> > >   When paths are given, show them (note that this isn't really raw
> > >   pathnames, but rather a list of patterns to match).
> > >
> > > It doesn't make sense to me match like this, either; but I do think it
> > > was intended and it will break things if people depend on the
> > > existing behavior.

I guess that paragraph was meant to explain why "git ls-tree HEAD
Documentation" and "git ls-tree HEAD Documentation/" give different
results.  The first one shows the entry for the tree object, while the
second one shows the contents of the tree object. In contrast to "ls"
which would descend into the directory in both cases.

> > Ok, but then the decision to descend into --dashed should be consistent
> > with that policy, no?  Right now, it appears that giving "--" alone says
> > "Anything under --dashed can never match that pattern, so I wouldn't
> > bother recursing into it".
> 
> Right.  Except in the case when there are multiple files inside --dashed/
> as Björn's email illustrated.  So there seems to be a bug in the way
> the number of files inside --dashed/ affects what "--" does when used
> with "--dashed/1" (if --dashed/2 also exists).  Very confusing :x

It's not the number of files that matters. With just one file, you just
don't notice the buggy behaviour, because showing all files is the same
as showing the specified file.

And interestingly, the problem doesn't seem to be in
show_tree/show_recursive, but in match_tree_entry.

With "git ls-tree HEAD gitweb/git-favicon.png g" we descend into gitweb/
and at some point we get:

match = "g"
base = "gitweb/"

And we have:
if (baselen >= matchlen) {
	if (strncmp(base, match, matchlen))
		continue;
	/* The base is a subdirectory of a path which was specified */
	return 1;
}

So we return 1 there. The code doesn't do what the comment says, so I
guess we can be pretty sure that the behaviour is not intended.

Björn

  reply	other threads:[~2009-03-31  7:12 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
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 [this message]
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=20090331071100.GA3307@atjola.homenet \
    --to=b.steinbrink@gmx.de \
    --cc=anton@iki.fi \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --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).