All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Whitcroft <apw@shadowen.org>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] cvsimport move over to using git for each ref to read refs V3
Date: Wed, 20 Sep 2006 18:00:33 +0100	[thread overview]
Message-ID: <451173B1.4060305@shadowen.org> (raw)
In-Reply-To: <7vodtaiijt.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano wrote:
> 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

  reply	other threads:[~2006-09-20 17:01 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-20  8:52 [PATCH] cvsimport move over to using git for each ref to read refs Andy Whitcroft
2006-09-20  9:23 ` Jakub Narebski
2006-09-20 10:26   ` Andy Whitcroft
2006-09-20 10:31     ` [PATCH 1/2] for each ref add a raw timestamp field type Andy Whitcroft
2006-09-20 10:31     ` [PATCH 2/2] cvsimport move over to using git for each ref to read refs V2 Andy Whitcroft
2006-09-20 11:00     ` [PATCH] cvsimport move over to using git for each ref to read refs Jakub Narebski
2006-09-20 15:53     ` Junio C Hamano
2006-09-20 16:12       ` Andy Whitcroft
2006-09-20 16:37         ` [PATCH] cvsimport move over to using git for each ref to read refs V3 Andy Whitcroft
2006-09-20 16:55           ` Junio C Hamano
2006-09-20 17:00             ` Andy Whitcroft [this message]
2006-09-20 17:17               ` Junio C Hamano
2006-09-20 16:45         ` [PATCH] cvsimport move over to using git for each ref to read refs Junio C Hamano
2006-09-21 12:06           ` Andy Whitcroft
2006-09-22  4:57             ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=451173B1.4060305@shadowen.org \
    --to=apw@shadowen.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.