Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] PathMatcher behaviour is inconsistent with "git check-attr"

Hello Matthias,
Thanks for the guide. I've created an account at accounts.eclipse.org and signed the legal stuff.
But when I try to login with the same login/password to Gerrit, it says

  Invalid username or password.

I'm pretty sure I specify the same login/password pair as for accounts.eclipse.org. Isn't Gerrit 
account automatically created with accounts.eclipse.org account?
--
Dmitry Pavlenko,
TMate Software,
http://subgit.com/ - git-svn bridge

On Wednesday 28 June 2017 21:30:01 Matthias Sohn wrote:
> On Wed, Jun 28, 2017 at 9:11 PM, Dmitry Pavlenko <pavlenko@xxxxxxxxxxxxx>
> 
> wrote:
> > Hello,
> > There's a case when PathMatcher behaviour differs from "git check-attr".
> > If I create .gitattributes
> > file with the following content:
> > 
> > images/** attr=value
> > 
> > and then run
> > 
> >   $ git check-attr attr images
> >   images/: attr: unspecified
> >   
> >   $ git check-attr attr images/
> >   images/: attr: unspecified
> >   
> >   $ git check-attr attr images/x
> >   images/x: attr: value
> > 
> > If I do the same with PathMatcher.createPathMatcher(), with every
> > reasonable parameters it says that
> > all the paths above match to the pattern "images/**". So it's an
> > inconsistency with Git behaviour.
> > 
> > It's not a surprise because near line 234 of PathMatcher.java there's a
> > comment
> > 
> >                                        if (matcher == matchers.size() - 2
> >                                        
> >                                                        &&
> > 
> > matchers.get(matcher + 1) == WILD)
> > 
> >                                                // ** can match *nothing*:
> > a/b/** match also a/b
> > 
> >                                                return true;
> > 
> > stating that a/b/** should match a/b, what's wrong.
> > 
> > I've attached a patch fixing the problem for all my cases, but I was
> > surprised why the code has
> > 
> >   matchers.size() - 2
> > 
> > and
> > 
> >   matcher + 1
> > 
> > instead of
> > 
> >   matchers.size() - 1
> > 
> > and
> > 
> >   matcher
> > 
> > I've changed it for the latter and the code still works. For me it makes
> > more sense as it checks
> > whether current segment is double star and it is actually the last one.
> > 
> > Could you please have a look at those 4 lines and maybe apply my changes?
> 
> Thanks for your bug report and patch contribution.
> 
> Please sign the Eclipse contribution license agreement (CLA) [1] and follow
> the contributor guide [2]
> to push your patch to Gerrit which we use for code review.
> 
> [1] https://eclipse.org/legal/CLA.php
>      https://accounts.eclipse.org/user/838/eca
> [2] https://wiki.eclipse.org/EGit/Contributor_Guide#Contributing_Patches
> 
> -Matthias



Back to the top