Re: [JGIT PATCH 4/4] LsTree: Enable pattern matching in LsTree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Robin Rosenberg <robin.rosenberg@xxxxxxxxxx> wrote:
> diff --git a/org.spearce.jgit/src/org/spearce/jgit/treewalk/filter/WildCardTreeFilter.java b/org.spearce.jgit/src/org/spearce/jgit/treewalk/filter/WildCardTreeFilter.java
> index ce6da5e..8b22e25 100644
> --- a/org.spearce.jgit/src/org/spearce/jgit/treewalk/filter/WildCardTreeFilter.java
> +++ b/org.spearce.jgit/src/org/spearce/jgit/treewalk/filter/WildCardTreeFilter.java
> @@ -76,7 +76,7 @@ public class WildCardTreeFilter extends TreeFilter {
>  		if (walker.isRecursive() && walker.isSubtree())
>  			return true;
>  		matcher.reset();
> -		matcher.append(walker.getPathString());
> +		matcher.append(walker.getName());
>  		if (matcher.isMatch())
>  			return true;
>  		return false;

Are we only supporting `jgit ls-tree . '*.c'` ?
Or do we want to allow `jgit ls-tree . 'src/*.c'`?

ls-tree is only a little sample program that is not likely to have
a lot of real-world users calling it; but is a good demonstration
of how to use TreeWalk.  So I really don't care either way.

The WildCardTreeFilter on the other hand could be applied to a
RevWalk, such as to grab history for not just 'foo.c' but anything
that matches 'f*.c'.  But then you have to ask, why is the filter
limited to testing only the last component of the path?  Why can't
it test 'src/f*.c'?

Otherwise everything in your series up until here makes sense and
looks good to me.  Be nice if the tree filter wasn't so abusive in
needing to look at every path in the project, as that would really
hurt if it was applied to a RevWalk.  But its not required to be
fast, if you ask for fnmatch paths, you get what you asked for...

-- 
Shawn.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux