@matheusbsbs / matheus-bagliano / commits / 5fcab3d7db
Fork 0

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>

Ryan Anderson committed Mar 5, 2006 at 21:43 UTC 5fcab3d7db9bb29f3897a593da69d6ae83a405ef
1 file changed +4 -2
git-annotate.perl
+4 -2
@@ -99,7 +99,7 @@ while (my $bound = pop @stack) {
99 }
100 }
101 push @revqueue, $head;
102 -init_claim( defined $starting_rev ? $starting_rev : 'dirty');
102 +init_claim( defined $starting_rev ? $head : 'dirty');
103 unless (defined $starting_rev) {
104 my $diff = open_pipe("git","diff","-R", "HEAD", "--",$filename)
105 or die "Failed to call git diff to check for dirty state: $!";
@@ -345,6 +345,7 @@ sub git_cat_file {
345 return () unless defined $rev && defined $filename;
346
347 my $blob = git_ls_tree($rev, $filename);
348 + die "Failed to find a blob for $filename in rev $rev\n" if !defined $blob;
349
350 my $catfile = open_pipe("git","cat-file", "blob", $blob)
351 or die "Failed to git-cat-file blob $blob (rev $rev, file $filename): " . $!;
@@ -367,12 +368,13 @@ sub git_ls_tree {
368
369 my ($mode, $type, $blob, $tfilename);
370 while(<$lstree>) {
371 + chomp;
372 ($mode, $type, $blob, $tfilename) = split(/\s+/, $_, 4);
373 last if ($tfilename eq $filename);
374 }
375 close($lstree);
376
375 - return $blob if $filename eq $filename;
377 + return $blob if ($tfilename eq $filename);
378 die "git-ls-tree failed to find blob for $filename";
379
380 }