git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Junio C HamanoNext: Junio C Hamano
Message 11 of 18 in “improve refspec handling in push, refactor matching in fetch”
  1. 0/6 improve refspec handling in push, refactor matching in fetchSteffen Prohaska, Nov 11, 2007
  2. 1/6 push: mention --verbose option in documentationSteffen Prohaska, Nov 11, 2007
  3. 2/6 push: teach push to pass --verbose option to transport layerSteffen Prohaska, Nov 11, 2007
  4. 3/6 push: support pushing HEAD to real branch nameSteffen Prohaska, Nov 11, 2007
  5. 4/6 add ref_abbrev_matches_full_with_rules()Steffen Prohaska, Nov 11, 2007
  6. 5/6 push: use same rules as git-rev-parse to resolve refspecsSteffen Prohaska, Nov 11, 2007
  7. 6/6 refactor fetch's ref matching to use ref_abbrev_matches_full_with_rules()Steffen Prohaska, Nov 11, 2007
  8. Jakub NarebskiNov 11, 2007
  9. Steffen ProhaskaNov 11, 2007
  10. Junio C HamanoNov 12, 2007
  11. Steffen ProhaskaNov 12, 2007
  12. Junio C HamanoNov 12, 2007
  13. Steffen ProhaskaNov 12, 2007
  14. Andreas EricssonNov 11, 2007
  15. 3/6 push: support pushing HEAD to real branch nameSteffen Prohaska, Nov 11, 2007
  16. Steffen ProhaskaNov 11, 2007
  17. Steffen ProhaskaNov 11, 2007
  18. Junio C HamanoNov 11, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.