Skip to content

Commit

Permalink
annotate: Support annotation of files on other revisions.
Browse files Browse the repository at this point in the history
This is a bug fix, and cleans up one or two other things spotted during the
course of tracking down the main bug here.

[jc: the part that updates test-suite is split out to the next
 one. Also I dropped "use Data::Dumper;" which seemed leftover
 from debugging session.]

Signed-off-by: Ryan Anderson <ryan@michonline.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Ryan Anderson authored and Junio C Hamano committed Mar 6, 2006
1 parent bd494fc commit 5fcab3d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions git-annotate.perl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ ()
}
}
push @revqueue, $head;
init_claim( defined $starting_rev ? $starting_rev : 'dirty');
init_claim( defined $starting_rev ? $head : 'dirty');
unless (defined $starting_rev) {
my $diff = open_pipe("git","diff","-R", "HEAD", "--",$filename)
or die "Failed to call git diff to check for dirty state: $!";
Expand Down Expand Up @@ -345,6 +345,7 @@ sub git_cat_file {
return () unless defined $rev && defined $filename;

my $blob = git_ls_tree($rev, $filename);
die "Failed to find a blob for $filename in rev $rev\n" if !defined $blob;

my $catfile = open_pipe("git","cat-file", "blob", $blob)
or die "Failed to git-cat-file blob $blob (rev $rev, file $filename): " . $!;
Expand All @@ -367,12 +368,13 @@ sub git_ls_tree {

my ($mode, $type, $blob, $tfilename);
while(<$lstree>) {
chomp;
($mode, $type, $blob, $tfilename) = split(/\s+/, $_, 4);
last if ($tfilename eq $filename);
}
close($lstree);

return $blob if $filename eq $filename;
return $blob if ($tfilename eq $filename);
die "git-ls-tree failed to find blob for $filename";

}
Expand Down

0 comments on commit 5fcab3d

Please sign in to comment.