threads / rfc / 5385

RFC patchgitweb: Restore old git_blame using git-annotate under "annotate"

Subject: [PATCH/RFC] gitweb: Restore old git_blame using git-annotate under "annotate"

## tl;dr

2 messages between Aug 25, 2006 and Aug 26, 2006. Diffs are folded; open one to read it.

replies: 1people: 1as markdown or json

Jakub Narebski· Aug 25, 2006, 23:47 UTC · lore

Rename git_blame to git_annotate, and git_blame2 to git_blame. Link git_annotate under "annotate" action. Add link to "blame in git_annotate, and to "annotate" in git_blame.

git_annotate doesn't work correctly yet - error during parsing some lines. Needs investigation.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
Not for work, just for testing and comparing the two implementations.
Applies cleanly to 'next' (v1.4.2-g6580c6b).
 gitweb/gitweb.perl |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
Show changes to gitweb/gitweb.perl +10 −3
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index a6d6637..6344263 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -229,7 +229,8 @@ if (defined $searchtext) {
 
 # dispatch
 my %actions = (
-	"blame" => \&git_blame2,
+	"blame" => \&git_blame,
+	"annotate" => \&git_annotate,
 	"blobdiff" => \&git_blobdiff,
 	"blobdiff_plain" => \&git_blobdiff_plain,
 	"blob" => \&git_blob,
@@ -2166,7 +2167,7 @@ sub git_tag {
 	git_footer_html();
 }
 
-sub git_blame2 {
+sub git_blame {
 	my $fd;
 	my $ftype;
 
@@ -2193,6 +2194,9 @@ sub git_blame2 {
 		$cgi->a({-href => href(action=>"blob", hash=>$hash, hash_base=>$hash_base, file_name=>$file_name)},
 		        "blob") .
 		" | " .
+		$cgi->a({-href => href(action=>"annotate", hash=>$hash, hash_base=>$hash_base, file_name=>$file_name)},
+		        "annotate") .
+		" | " .
 		$cgi->a({-href => href(action=>"blame", file_name=>$file_name)},
 		        "head");
 	git_print_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
@@ -2236,7 +2240,7 @@ HTML
 	git_footer_html();
 }
 
-sub git_blame {
+sub git_annotate {
 	my $fd;
 
 	if (!gitweb_check_feature('blame')) {
@@ -2258,6 +2262,9 @@ sub git_blame {
 		$cgi->a({-href => href(action=>"blob", hash=>$hash, hash_base=>$hash_base, file_name=>$file_name)},
 		        "blob") .
 		" | " .
+		$cgi->a({-href => href(action=>"blame", hash=>$hash, hash_base=>$hash_base, file_name=>$file_name)},
+		        "blame") .
+		" | " .
 		$cgi->a({-href => href(action=>"blame", file_name=>$file_name)},
 		        "head");
 	git_print_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
-- 
1.4.1.1
Jakub Narebski· Aug 26, 2006, 00:13 UTC · re: Jakub Narebski · lore

[PATCH] gitweb: git_annotate didn't expect negative numeric timezone

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
This fixes error in git_annotate mentioned in parent post.
 gitweb/gitweb.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to gitweb/gitweb.perl +1 −1
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 6344263..e5a0db5 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2298,7 +2298,7 @@ HTML
 		chomp $line;
 		$line_class_num = ($line_class_num + 1) % $line_class_len;
 
-		if ($line =~ m/^([0-9a-fA-F]{40})\t\(\s*([^\t]+)\t(\d+) \+\d\d\d\d\t(\d+)\)(.*)$/) {
+		if ($line =~ m/^([0-9a-fA-F]{40})\t\(\s*([^\t]+)\t(\d+) [+-]\d\d\d\d\t(\d+)\)(.*)$/) {
 			$long_rev = $1;
 			$author   = $2;
 			$time     = $3;
-- 
1.4.1.1

← back to recent threads