summaryrefslogtreecommitdiff
path: root/git-annotate.perl
diff options
context:
space:
mode:
authorRyan Anderson <ryan@michonline.com>2006-03-05 21:43:53 -0500
committerJunio C Hamano <junkio@cox.net>2006-03-05 22:01:28 -0800
commit5fcab3d7db9bb29f3897a593da69d6ae83a405ef (patch)
treec4e1cc285dc8780437b30b79dffffb57cab57997 /git-annotate.perl
parentbd494fc76be09ab61f8285f1299e2474b0554a81 (diff)
downloadgit-5fcab3d7db9bb29f3897a593da69d6ae83a405ef.tar.gz
annotate: Support annotation of files on other revisions.
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>
Diffstat (limited to 'git-annotate.perl')
-rwxr-xr-xgit-annotate.perl6
1 files changed, 4 insertions, 2 deletions
diff --git a/git-annotate.perl b/git-annotate.perl
index b113def97b..feea0a2d81 100755
--- a/git-annotate.perl
+++ b/git-annotate.perl
@@ -99,7 +99,7 @@ while (my $bound = pop @stack) {
}
}
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: $!";
@@ -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): " . $!;
@@ -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";
}