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

Re: [PATCH] cvsimport move over to using git for each ref to read refs V3

From
Andy Whitcroft <apw@shadowen.org>
Date
Sep 20, 2006, 17:00 UTC
Message-ID
<451173B1.4060305@shadowen.org>
In-Reply-To
<7vodtaiijt.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
Show 22 quoted lines
> Andy Whitcroft <apw@shadowen.org> writes:
> 
>> +	my $fmt = '($ref, $author) = (%(refname), %(author));';
>> +	open(H, "git-for-each-ref --perl --format='$fmt'|") or
>> +		die "Cannot run git-for-each-ref: $!\n";
>> +	while(defined(my $entry = <H>)) {
>> +		my ($ref, $author);
>> +		eval($entry) || die "cannot eval refs list: $@";
>> +
>> +		next if ($ref !~ m@^refs/heads/(.*)$@);
>> +		my ($head) = ($1);
>> +		$author =~ /^.*\s(\d+)\s[-+]\d{4}$/;
>> +		$branch_date{$head} = $1;
>>  	}
>> -	closedir(D);
>> +	close(H);
>>  }
> 
> for-each-ref let's you limit the refs by leading path, so I do
> not think "next if" inside the loop is needed if you say
> 
> 	for-each-ref --perl --format=$fmt refs/heads
Stupid boy :)
> 
> Any reason you did not like my version that allows you to get
> rid of the while() loop altogether?  (hint: replace eval in my
> example with "print" and see what you are evaling)

To my mind we avoid the 'mozilla repo' issue of 1000's of heads busting some string length limit, or requiring some _vast_ string to hold it (as perl is likely to cope). Given we are sifting a small percentage of the data out of it.

Let me know which way you want it and we'll go that way :).
-apw
Previous: Junio C HamanoNext: Junio C Hamano
Message 11 of 15 in “cvsimport move over to using git for each ref to read refs”
  1. cvsimport move over to using git for each ref to read refsAndy Whitcroft, Sep 20, 2006
  2. Jakub NarebskiSep 20, 2006
  3. Andy WhitcroftSep 20, 2006
  4. 1/2 for each ref add a raw timestamp field typeAndy Whitcroft, Sep 20, 2006
  5. 2/2 cvsimport move over to using git for each ref to read refs V2Andy Whitcroft, Sep 20, 2006
  6. Jakub NarebskiSep 20, 2006
  7. Junio C HamanoSep 20, 2006
  8. Andy WhitcroftSep 20, 2006
  9. cvsimport move over to using git for each ref to read refs V3Andy Whitcroft, Sep 20, 2006
  10. Junio C HamanoSep 20, 2006
  11. Andy WhitcroftSep 20, 2006
  12. Junio C HamanoSep 20, 2006
  13. Junio C HamanoSep 20, 2006
  14. Andy WhitcroftSep 21, 2006
  15. Junio C HamanoSep 22, 2006

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.