summaryrefslogtreecommitdiff
path: root/git-annotate.perl
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <junkio@cox.net>2006-03-05 22:38:22 -0800
committerLibravatar Junio C Hamano <junkio@cox.net>2006-03-05 22:38:22 -0800
commit3bcd59a546333ae355c87577ba63f8dccd50a519 (patch)
tree8a097c34b5a520ebe1189bdb2398c599148ffeb5 /git-annotate.perl
parentMerge part of 'jc/pack' into 'next' (diff)
parentTweak asciidoc output to work with broken docbook-xsl (diff)
downloadtgif-3bcd59a546333ae355c87577ba63f8dccd50a519.tar.xz
Merge branch 'fd/asciidoc' into next
* fd/asciidoc: Tweak asciidoc output to work with broken docbook-xsl annotate-blame test: add evil merge. annotate-blame test: don't "source", but say "." annotate/blame tests updates. annotate: Support annotation of files on other revisions. git/Documentation: fix SYNOPSIS style bugs blame: avoid "diff -u0". git-blame: Use the same tests for git-blame as for git-annotate blame and annotate: show localtime with timezone. blame: avoid -lm by not using log(). git-blame: Make the output human readable get_revision(): do not dig deeper when we know we are at the end. documentation: add 'see also' sections to git-rm and git-add contrib/emacs/Makefile: Provide tool for byte-compiling files. gitignore: Ignore some more boring things.
Diffstat (limited to 'git-annotate.perl')
-rwxr-xr-xgit-annotate.perl14
1 files changed, 11 insertions, 3 deletions
diff --git a/git-annotate.perl b/git-annotate.perl
index d93ee19c7e..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";
}
@@ -418,7 +420,13 @@ sub format_date {
return $_[0];
}
my ($timestamp, $timezone) = split(' ', $_[0]);
- return strftime("%Y-%m-%d %H:%M:%S " . $timezone, gmtime($timestamp));
+ my $minutes = abs($timezone);
+ $minutes = int($minutes / 100) * 60 + ($minutes % 100);
+ if ($timezone < 0) {
+ $minutes = -$minutes;
+ }
+ my $t = $timestamp + $minutes * 60;
+ return strftime("%Y-%m-%d %H:%M:%S " . $timezone, gmtime($t));
}
# Copied from git-send-email.perl - We need a Git.pm module..