threads / patch / 5727

patchgitweb: Add history and blame to git_difftree_body()

Subject: [PATCH] gitweb: Add history and blame to git_difftree_body()

## tl;dr

4 messages between Sep 28, 2006 and Oct 2, 2006. Diffs are folded; open one to read it.

replies: 3people: 2as markdown or json

Luben Tuikov· Sep 28, 2006, 00:24 UTC · lore

Add blame and history to Deleted files. Add blame and history to Modified or Type changed files. Add blame and history to Renamed or Copied files.

This allows us to do
	blame->commit->blame->commit->blame->...
instead of
	blame->commit->file->blame->commit->file->blame->...
which is longer and easier to get wrong.
Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
---
 gitweb/gitweb.perl |   35 +++++++++++++++++++++++------------
 1 files changed, 23 insertions(+), 12 deletions(-)
Show changes to gitweb/gitweb.perl +23 −12
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index c87f60e..f772fa3 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1721,9 +1721,12 @@ sub git_difftree_body {
 				print $cgi->a({-href => "#patch$patchno"}, "patch");
 				print " | ";
 			}
+			print $cgi->a({-href => href(action=>"blame", hash_base=>$parent,
+						     file_name=>$diff{'file'})},
+				      "blame") . " | ";
 			print $cgi->a({-href => href(action=>"history", hash_base=>$parent,
-			                             file_name=>$diff{'file'})},
-			              "history");
+						     file_name=>$diff{'file'})},
+				      "history");
 			print "</td>\n";
 
 		} elsif ($diff{'status'} eq "M" || $diff{'status'} eq "T") { # modified, or type changed
@@ -1763,8 +1766,11 @@ sub git_difftree_body {
 				}
 				print " | ";
 			}
-			print $cgi->a({-href => href(action=>"history",
-						     hash_base=>$hash, file_name=>$diff{'file'})},
+			print $cgi->a({-href => href(action=>"blame", hash_base=>$hash,
+						     file_name=>$diff{'file'})},
+				      "blame") . " | ";
+			print $cgi->a({-href => href(action=>"history", hash_base=>$hash,
+						     file_name=>$diff{'file'})},
 				      "history");
 			print "</td>\n";
 
@@ -1790,17 +1796,22 @@ sub git_difftree_body {
 				if ($action eq 'commitdiff') {
 					# link to patch
 					$patchno++;
-					print " | " .
-						$cgi->a({-href => "#patch$patchno"}, "patch");
+					print $cgi->a({-href => "#patch$patchno"}, "patch");
 				} else {
-					print " | " .
-						$cgi->a({-href => href(action=>"blobdiff",
-						                       hash=>$diff{'to_id'}, hash_parent=>$diff{'from_id'},
-						                       hash_base=>$hash, hash_parent_base=>$parent,
-						                       file_name=>$diff{'to_file'}, file_parent=>$diff{'from_file'})},
-						        "diff");
+					print $cgi->a({-href => href(action=>"blobdiff",
+								     hash=>$diff{'to_id'}, hash_parent=>$diff{'from_id'},
+								     hash_base=>$hash, hash_parent_base=>$parent,
+								     file_name=>$diff{'to_file'}, file_parent=>$diff{'from_file'})},
+						      "diff");
 				}
+				print " | ";
 			}
+			print $cgi->a({-href => href(action=>"blame", hash_base=>$parent,
+						     file_name=>$diff{'from_file'})},
+				      "blame") . " | ";
+			print $cgi->a({-href => href(action=>"history", hash_base=>$parent,
+						     file_name=>$diff{'from_file'})},
+				      "history");
 			print "</td>\n";
 
 		} # we should not encounter Unmerged (U) or Unknown (X) status
-- 
1.4.2.1.g271e
Jakub Narebski· Oct 1, 2006, 16:41 UTC · re: Luben Tuikov · lore

Re: [PATCH] gitweb: Add history and blame to git_difftree_body()

Luben Tuikov wrote:
> Add blame and history to Deleted files.
> Add blame and history to Modified or Type changed files.
> Add blame and history to Renamed or Copied files.
Blame has to be added conditionally (gitweb_have_blame).
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
Luben Tuikov· Oct 2, 2006, 19:32 UTC · re: Jakub Narebski · lore

Re: [PATCH] gitweb: Add history and blame to git_difftree_body()

--- Jakub Narebski <jnareb@gmail.com> wrote:
Show 7 quoted lines
> Luben Tuikov wrote:
> 
> > Add blame and history to Deleted files.
> > Add blame and history to Modified or Type changed files.
> > Add blame and history to Renamed or Copied files.
> 
> Blame has to be added conditionally (gitweb_have_blame).

Can you please not edit the CC field when you reply? I can see that only the GIT mailing list was left, but my email had been removed.

Thanks,
   Luben
Jakub Narebski· Oct 2, 2006, 19:55 UTC · re: Luben Tuikov · lore

Re: [PATCH] gitweb: Add history and blame to git_difftree_body()

Luben Tuikov wrote:
Show 10 quoted lines
> --- Jakub Narebski <jnareb@gmail.com> wrote:
> > Luben Tuikov wrote:
> > 
> > > Add blame and history to Deleted files.
> > > Add blame and history to Modified or Type changed files.
> > > Add blame and history to Renamed or Copied files.
> > 
> > Blame has to be added conditionally (gitweb_have_blame).
> 
> Can you please not edit the CC field when you reply?

I do not edit Cc: field. I reply via GMane NNTP (Usenet) interface.

> I can see that only the GIT mailing list was left,
> but my email had been removed.
It was not removed, it was not added.
-- 
Jakub Narebski
Poland

← back to recent threads