Re: [PATCH] cvsimport move over to using git for each ref to read refs V3
- From
Junio C Hamano <junkio@cox.net>
- Date
- Sep 20, 2006, 16:55 UTC
- Message-ID
- <7vodtaiijt.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <20060920163704.GA27407@shadowen.org>
Andy Whitcroft <apw@shadowen.org> writes:
Show 15 quoted lines
> + 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
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)