# [PATCH] gitweb: Remove excessively redundant entries from git_difftree_body

5 messages from 2006-09-28 to 2006-10-02. Participants: Luben Tuikov, Junio C Hamano, Jakub Narebski.
Thread: https://gitlist.dev/t/5726

## Luben Tuikov, 2006-09-28 00:23

Subject: [PATCH] gitweb: Remove excessively redundant entries from git_difftree_body
Message-ID: <20060928002325.70519.qmail@web31815.mail.mud.yahoo.com>
URL: https://gitlist.dev/e/20060928002325.70519.qmail%40web31815.mail.mud.yahoo.com

```
1) All entries on the left are blobs and clicking on them
leads to blobs.  No more diff or blob depending on what
happened (modified or mode changed) to the file -- this goes
to the right, in the "link" column.

2) Remove redundant "blob" from the link column on the right.
This can now be had by clicking on the entry itself.

This reduces and simplifies the code.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
---
 gitweb/gitweb.perl |   92 +++++++++++++++++++---------------------------------
 1 files changed, 34 insertions(+), 58 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 56638f2..c87f60e 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1692,47 +1692,39 @@ sub git_difftree_body {
 			my $mode_chng = "<span class=\"file_status new\">[new $to_file_type";
 			$mode_chng   .= " with mode: $to_mode_str" if $to_mode_str;
 			$mode_chng   .= "]</span>";
-			print "<td>" .
-			      $cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
+			print "<td>";
+			print $cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
 			                             hash_base=>$hash, file_name=>$diff{'file'}),
-			              -class => "list"}, esc_html($diff{'file'})) .
-			      "</td>\n" .
-			      "<td>$mode_chng</td>\n" .
-			      "<td class=\"link\">" .
-			      $cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
-			                             hash_base=>$hash, file_name=>$diff{'file'})},
-			              "blob");
+				       -class => "list"}, esc_html($diff{'file'}));
+			print "</td>\n";
+			print "<td>$mode_chng</td>\n";
+			print "<td class=\"link\">";
 			if ($action eq 'commitdiff') {
 				# link to patch
 				$patchno++;
-				print " | " .
-				      $cgi->a({-href => "#patch$patchno"}, "patch");
+				print $cgi->a({-href => "#patch$patchno"}, "patch");
 			}
 			print "</td>\n";
 
 		} elsif ($diff{'status'} eq "D") { # deleted
 			my $mode_chng = "<span class=\"file_status deleted\">[deleted $from_file_type]</span>";
-			print "<td>" .
-			      $cgi->a({-href => href(action=>"blob", hash=>$diff{'from_id'},
+			print "<td>";
+			print $cgi->a({-href => href(action=>"blob", hash=>$diff{'from_id'},
 			                             hash_base=>$parent, file_name=>$diff{'file'}),
-			               -class => "list"}, esc_html($diff{'file'})) .
-			      "</td>\n" .
-			      "<td>$mode_chng</td>\n" .
-			      "<td class=\"link\">" .
-			      $cgi->a({-href => href(action=>"blob", hash=>$diff{'from_id'},
-			                             hash_base=>$parent, file_name=>$diff{'file'})},
-			              "blob") .
-			      " | ";
+			               -class => "list"}, esc_html($diff{'file'}));
+			print "</td>\n";
+			print "<td>$mode_chng</td>\n";
+			print "<td class=\"link\">";
 			if ($action eq 'commitdiff') {
 				# link to patch
 				$patchno++;
-				print " | " .
-				      $cgi->a({-href => "#patch$patchno"}, "patch");
+				print $cgi->a({-href => "#patch$patchno"}, "patch");
+				print " | ";
 			}
 			print $cgi->a({-href => href(action=>"history", hash_base=>$parent,
 			                             file_name=>$diff{'file'})},
-			              "history") .
-			      "</td>\n";
+			              "history");
+			print "</td>\n";
 
 		} elsif ($diff{'status'} eq "M" || $diff{'status'} eq "T") { # modified, or type changed
 			my $mode_chnge = "";
@@ -1751,42 +1743,29 @@ sub git_difftree_body {
 				$mode_chnge .= "]</span>\n";
 			}
 			print "<td>";
-			if ($diff{'to_id'} ne $diff{'from_id'}) { # modified
-				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{'file'}),
-				              -class => "list"}, esc_html($diff{'file'}));
-			} else { # only mode changed
-				print $cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
-				                             hash_base=>$hash, file_name=>$diff{'file'}),
-				              -class => "list"}, esc_html($diff{'file'}));
-			}
-			print "</td>\n" .
-			      "<td>$mode_chnge</td>\n" .
-			      "<td class=\"link\">" .
-			      $cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
-			                             hash_base=>$hash, file_name=>$diff{'file'})},
-			              "blob");
+			print $cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
+						     hash_base=>$hash, file_name=>$diff{'file'}),
+				       -class => "list"}, esc_html($diff{'file'}));
+			print "</td>\n";
+			print "<td>$mode_chnge</td>\n";
+			print "<td class=\"link\">";
 			if ($diff{'to_id'} ne $diff{'from_id'}) { # modified
 				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{'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{'file'})},
+						      "diff");
 				}
+				print " | ";
 			}
-			print " | " .
-				$cgi->a({-href => href(action=>"history",
-				                       hash_base=>$hash, file_name=>$diff{'file'})},
-				        "history");
+			print $cgi->a({-href => href(action=>"history",
+						     hash_base=>$hash, file_name=>$diff{'file'})},
+				      "history");
 			print "</td>\n";
 
 		} elsif ($diff{'status'} eq "R" || $diff{'status'} eq "C") { # renamed or copied
@@ -1806,10 +1785,7 @@ sub git_difftree_body {
 			                             hash=>$diff{'from_id'}, file_name=>$diff{'from_file'}),
 			              -class => "list"}, esc_html($diff{'from_file'})) .
 			      " with " . (int $diff{'similarity'}) . "% similarity$mode_chng]</span></td>\n" .
-			      "<td class=\"link\">" .
-			      $cgi->a({-href => href(action=>"blob", hash_base=>$hash,
-			                             hash=>$diff{'to_id'}, file_name=>$diff{'to_file'})},
-			              "blob");
+			      "<td class=\"link\">";
 			if ($diff{'to_id'} ne $diff{'from_id'}) {
 				if ($action eq 'commitdiff') {
 					# link to patch
-- 
1.4.2.1.g271e


```

## Junio C Hamano, 2006-09-28 02:07

Subject: Re: [PATCH] gitweb: Remove excessively redundant entries from git_difftree_body
Message-ID: <7vmz8k7nhc.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vmz8k7nhc.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20060928002325.70519.qmail@web31815.mail.mud.yahoo.com>

```
Luben Tuikov <ltuikov@yahoo.com> writes:

> 1) All entries on the left are blobs and clicking on them
> leads to blobs.  No more diff or blob depending on what
> happened (modified or mode changed) to the file -- this goes
> to the right, in the "link" column.
>
> 2) Remove redundant "blob" from the link column on the right.
> This can now be had by clicking on the entry itself.
>
> This reduces and simplifies the code.
>
> Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>

We lost blobdiff from commitdiff page with this patch, which I
think it probably is a good change.  We can say "when we display
a pathname you can click it to get the blob or tree".

By the way, just like your "blob" and "tree" link removal, I
think we can lose "commit" link in shortlog.  The list looks
rather cluttered with three links; we could replace it with
"snapshot" link if we wanted to.

I am neutral about doing that for long log pages.  The commit
titles are links there as well, but they do not look like "one
of the columns that can be clicked in a single line per row
table" as in shortlog page.  The page could also get "snapshot"
links.

```

## Luben Tuikov, 2006-09-28 18:28

Subject: Re: [PATCH] gitweb: Remove excessively redundant entries from git_difftree_body
Message-ID: <20060928182843.83600.qmail@web31802.mail.mud.yahoo.com>
URL: https://gitlist.dev/e/20060928182843.83600.qmail%40web31802.mail.mud.yahoo.com
In-Reply-To: <7vmz8k7nhc.fsf@assigned-by-dhcp.cox.net>

```
--- Junio C Hamano <junkio@cox.net> wrote:
> We lost blobdiff from commitdiff page with this patch, which I
> think it probably is a good change.  We can say "when we display
> a pathname you can click it to get the blob or tree".

I think so too.

> By the way, just like your "blob" and "tree" link removal, I
> think we can lose "commit" link in shortlog.  The list looks
> rather cluttered with three links; we could replace it with
> "snapshot" link if we wanted to.

I agree.

   Luben

> I am neutral about doing that for long log pages.  The commit
> titles are links there as well, but they do not look like "one
> of the columns that can be clicked in a single line per row
> table" as in shortlog page.  The page could also get "snapshot"
> links.
> 
> 
> 
> 
> 

```

## Jakub Narebski, 2006-10-01 19:20

Subject: Re: [PATCH] gitweb: Remove excessively redundant entries from git_difftree_body
Message-ID: <efp4d6$a7b$1@sea.gmane.org>
URL: https://gitlist.dev/e/efp4d6%24a7b%241%40sea.gmane.org
In-Reply-To: <7vmz8k7nhc.fsf@assigned-by-dhcp.cox.net>

```
Junio C Hamano wrote:

> Luben Tuikov <ltuikov@yahoo.com> writes:
> 
>> 1) All entries on the left are blobs and clicking on them
>> leads to blobs.  No more diff or blob depending on what
>> happened (modified or mode changed) to the file -- this goes
>> to the right, in the "link" column.
>>
>> 2) Remove redundant "blob" from the link column on the right.
>> This can now be had by clicking on the entry itself.
>>
>> This reduces and simplifies the code.
>>
>> Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
> 
> We lost blobdiff from commitdiff page with this patch, which I
> think it probably is a good change.  We can say "when we display
> a pathname you can click it to get the blob or tree".

In my opinion it is a bad change. We now have "patch" inner-link
to anchor in commitdiff view, but it's equivalent in commit view
i.e. diff aka blobdiff vanished.
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

```

## Luben Tuikov, 2006-10-02 19:48

Subject: Re: [PATCH] gitweb: Remove excessively redundant entries from git_difftree_body
Message-ID: <20061002194847.285.qmail@web31811.mail.mud.yahoo.com>
URL: https://gitlist.dev/e/20061002194847.285.qmail%40web31811.mail.mud.yahoo.com
In-Reply-To: <efp4d6$a7b$1@sea.gmane.org>

```
--- Jakub Narebski <jnareb@gmail.com> wrote:
> Junio C Hamano wrote:
> 
> > Luben Tuikov <ltuikov@yahoo.com> writes:
> > 
> >> 1) All entries on the left are blobs and clicking on them
> >> leads to blobs.  No more diff or blob depending on what
> >> happened (modified or mode changed) to the file -- this goes
> >> to the right, in the "link" column.
> >>
> >> 2) Remove redundant "blob" from the link column on the right.
> >> This can now be had by clicking on the entry itself.
> >>
> >> This reduces and simplifies the code.
> >>
> >> Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
> > 
> > We lost blobdiff from commitdiff page with this patch, which I
> > think it probably is a good change.  We can say "when we display
> > a pathname you can click it to get the blob or tree".
> 
> In my opinion it is a bad change. We now have "patch" inner-link
> to anchor in commitdiff view, but it's equivalent in commit view
> i.e. diff aka blobdiff vanished.

All which can be easily had.

    Luben

```
