Skip to content

Commit

Permalink
Merge branch 'aw/cvsimport'
Browse files Browse the repository at this point in the history
* aw/cvsimport:
  cvsimport: move over to using git-for-each-ref to read refs.
  • Loading branch information
Junio C Hamano committed Oct 25, 2006
2 parents 40eaac5 + 1f24c58 commit 01fe679
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions git-cvsimport.perl
Original file line number Diff line number Diff line change
Expand Up @@ -495,22 +495,17 @@ ($$)
$tip_at_start = `git-rev-parse --verify HEAD`;

# Get the last import timestamps
opendir(D,"$git_dir/refs/heads");
while(defined(my $head = readdir(D))) {
next if $head =~ /^\./;
open(F,"$git_dir/refs/heads/$head")
or die "Bad head branch: $head: $!\n";
chomp(my $ftag = <F>);
close(F);
open(F,"git-cat-file commit $ftag |");
while(<F>) {
next unless /^author\s.*\s(\d+)\s[-+]\d{4}$/;
$branch_date{$head} = $1;
last;
}
close(F);
my $fmt = '($ref, $author) = (%(refname), %(author));';
open(H, "git-for-each-ref --perl --format='$fmt' refs/heads |") or
die "Cannot run git-for-each-ref: $!\n";
while(defined(my $entry = <H>)) {
my ($ref, $author);
eval($entry) || die "cannot eval refs list: $@";
my ($head) = ($ref =~ m|^refs/heads/(.*)|);
$author =~ /^.*\s(\d+)\s[-+]\d{4}$/;
$branch_date{$head} = $1;
}
closedir(D);
close(H);
}

-d $git_dir
Expand Down

0 comments on commit 01fe679

Please sign in to comment.