Re: [PATCH 5/6] push: use same rules as git-rev-parse to resolve refspecs
- From
Steffen Prohaska <prohaska@zib.de>
- Date
- Nov 12, 2007, 20:48 UTC
- Message-ID
- <DEDBC16B-0BDD-4671-8446-EFD0B32969BF@zib.de>
- In-Reply-To
- <7v1wav44z8.fsf@gitster.siamese.dyndns.org>
On Nov 12, 2007, at 8:51 PM, Junio C Hamano wrote:
Show 22 quoted lines
> Steffen Prohaska <prohaska@zib.de> writes: > >> diff --git a/remote.c b/remote.c >> index bec2ba1..28d8eb7 100644 >> --- a/remote.c >> +++ b/remote.c >> @@ -519,10 +519,7 @@ static int count_refspec_match(const char >> *pattern, >> char *name = refs->name; >> int namelen = strlen(name); >> >> - if (namelen < patlen || >> - memcmp(name + namelen - patlen, pattern, patlen)) >> - continue; >> - if (namelen != patlen && name[namelen - patlen - 1] != '/') >> + if (!ref_abbrev_matches_full_with_rules(pattern, name, >> ref_rev_parse_rules)) >> continue; > > I vaguely recall that in the old round this check used to be > without negation '!' in the front. I think this version is > correct.
Yes. I started with a syntax inspired by strcmp. But later the function got match in its name. I think returning a match with 'true' is more natural; and reserving '-1, 0, 1' for compare (as in strcmp). Therefore I changed the return value.
With '!' is correct now. Without '!' was correct before.
Steffen