[PATCH] Add 'raw' blob_plain link in history overview

Subsystems: the rest

STALE3269d

6 messages, 2 authors, 2017-08-21 · open the first message on its own page

[PATCH] Add 'raw' blob_plain link in history overview

From: Job Snijders <hidden>
Date: 2017-08-02 18:59:09

We often work with very large plain text files in our repositories and
found it friendlier to the users if we can click directly to the raw
version of such files.

This patch adds a 'raw' blob_plain link in history overview.

Signed-off-by: Job Snijders <redacted>
---
 gitweb/gitweb.perl | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 3d4a8ee27..ad79c518e 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -5961,8 +5961,11 @@ sub git_history_body {
 		                          href(action=>"commit", hash=>$commit), $ref);
 		print "</td>\n" .
 		      "<td class=\"link\">" .
-		      $cgi->a({-href => href(action=>$ftype, hash_base=>$commit, file_name=>$file_name)}, $ftype) . " | " .
-		      $cgi->a({-href => href(action=>"commitdiff", hash=>$commit)}, "commitdiff");
+		      $cgi->a({-href => href(action=>$ftype, hash_base=>$commit, file_name=>$file_name)}, $ftype) . " | ";
+		if ($ftype eq 'blob') {
+			print $cgi->a({-href => href(action=>"blob_plain", hash_base=>$commit, file_name=>$file_name)}, "raw") . " | ";
+		}
+		print $cgi->a({-href => href(action=>"commitdiff", hash=>$commit)}, "commitdiff");
 
 		if ($ftype eq 'blob') {
 			my $blob_current = $file_hash;

Re: [PATCH] Add 'raw' blob_plain link in history overview

From: Job Snijders <hidden>
Date: 2017-08-20 18:03:41

bump? 

On Wed, Aug 02, 2017 at 08:59:01PM +0200, Job Snijders wrote:
quoted hunk
We often work with very large plain text files in our repositories and
found it friendlier to the users if we can click directly to the raw
version of such files.

This patch adds a 'raw' blob_plain link in history overview.

Signed-off-by: Job Snijders <redacted>
---
 gitweb/gitweb.perl | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 3d4a8ee27..ad79c518e 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -5961,8 +5961,11 @@ sub git_history_body {
 		                          href(action=>"commit", hash=>$commit), $ref);
 		print "</td>\n" .
 		      "<td class=\"link\">" .
-		      $cgi->a({-href => href(action=>$ftype, hash_base=>$commit, file_name=>$file_name)}, $ftype) . " | " .
-		      $cgi->a({-href => href(action=>"commitdiff", hash=>$commit)}, "commitdiff");
+		      $cgi->a({-href => href(action=>$ftype, hash_base=>$commit, file_name=>$file_name)}, $ftype) . " | ";
+		if ($ftype eq 'blob') {
+			print $cgi->a({-href => href(action=>"blob_plain", hash_base=>$commit, file_name=>$file_name)}, "raw") . " | ";
+		}
+		print $cgi->a({-href => href(action=>"commitdiff", hash=>$commit)}, "commitdiff");
 
 		if ($ftype eq 'blob') {
 			my $blob_current = $file_hash;

Re: [PATCH] Add 'raw' blob_plain link in history overview

From: Giuseppe Bilotta <hidden>
Date: 2017-08-21 10:20:05

Hello,

On Sun, Aug 20, 2017 at 8:03 PM, Job Snijders [off-list ref] wrote:
bump?
(As a side note, I have also noticed that gitweb patches tend to go
unreviewed for long)
On Wed, Aug 02, 2017 at 08:59:01PM +0200, Job Snijders wrote:
quoted
We often work with very large plain text files in our repositories and
found it friendlier to the users if we can click directly to the raw
version of such files.

This patch adds a 'raw' blob_plain link in history overview.

Signed-off-by: Job Snijders <redacted>
---
 gitweb/gitweb.perl | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 3d4a8ee27..ad79c518e 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -5961,8 +5961,11 @@ sub git_history_body {
                                        href(action=>"commit", hash=>$commit), $ref);
              print "</td>\n" .
                    "<td class=\"link\">" .
-                   $cgi->a({-href => href(action=>$ftype, hash_base=>$commit, file_name=>$file_name)}, $ftype) . " | " .
-                   $cgi->a({-href => href(action=>"commitdiff", hash=>$commit)}, "commitdiff");
+                   $cgi->a({-href => href(action=>$ftype, hash_base=>$commit, file_name=>$file_name)}, $ftype) . " | ";
+             if ($ftype eq 'blob') {
+                     print $cgi->a({-href => href(action=>"blob_plain", hash_base=>$commit, file_name=>$file_name)}, "raw") . " | ";
+             }
+             print $cgi->a({-href => href(action=>"commitdiff", hash=>$commit)}, "commitdiff");

              if ($ftype eq 'blob') {
                      my $blob_current = $file_hash;
Arguably, the addition of the 'raw' link should be done in the same
conditional that also adds the 'diff to current' link, before the diff
to current link.
This would be more consistent with the tree view (which puts the raw
link last), while still preserving the alignment of the link position
independently of the existence of the 'diff to current' link. (Bonus
extra: smaller patch)

-- 
Giuseppe "Oblomov" Bilotta

Re: [PATCH] Add 'raw' blob_plain link in history overview

From: Job Snijders <hidden>
Date: 2017-08-21 10:44:34

On Mon, Aug 21, 2017 at 12:19:38PM +0200, Giuseppe Bilotta wrote:
quoted
quoted
This patch adds a 'raw' blob_plain link in history overview.
Arguably, the addition of the 'raw' link should be done in the same
conditional that also adds the 'diff to current' link, before the diff
to current link.
This would be more consistent with the tree view (which puts the raw
link last), while still preserving the alignment of the link position
independently of the existence of the 'diff to current' link. (Bonus
extra: smaller patch)
Thank you for your feedback, good point. Please see below:

---

Add a 'raw' blob_plain link in history overview

Signed-off-by: Job Snijders <redacted>
---
 gitweb/gitweb.perl | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 9208f42ed..c43bbe331 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -5967,6 +5967,9 @@ sub git_history_body {
 		      $cgi->a({-href => href(action=>"commitdiff", hash=>$commit)}, "commitdiff");
 
 		if ($ftype eq 'blob') {
+			print " | " .
+				$cgi->a({-href => href(action=>"blob_plain", hash_base=>$commit, file_name=>$file_name)}, "raw");
+
 			my $blob_current = $file_hash;
 			my $blob_parent  = git_get_hash_by_path($commit, $file_name);
 			if (defined $blob_current && defined $blob_parent &&

Re: [PATCH] Add 'raw' blob_plain link in history overview

From: Giuseppe Bilotta <hidden>
Date: 2017-08-21 14:07:28

Hello,

On Mon, Aug 21, 2017 at 12:44 PM, Job Snijders [off-list ref] wrote:
On Mon, Aug 21, 2017 at 12:19:38PM +0200, Giuseppe Bilotta wrote:
Thank you for your feedback, good point. Please see below:
This looks fine
quoted hunk
---

Add a 'raw' blob_plain link in history overview

Signed-off-by: Job Snijders <redacted>
---
 gitweb/gitweb.perl | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 9208f42ed..c43bbe331 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -5967,6 +5967,9 @@ sub git_history_body {
                      $cgi->a({-href => href(action=>"commitdiff", hash=>$commit)}, "commitdiff");

                if ($ftype eq 'blob') {
+                       print " | " .
+                               $cgi->a({-href => href(action=>"blob_plain", hash_base=>$commit, file_name=>$file_name)}, "raw");
Nitpick: gitweb uses tabs for nested indents, but spaces for
alignment. For this line here, the last tab should be replace with
spaces (to align the $ with the quotes above.)

With that fixed, you can add

Reviewed-by: Giuseppe Bilotta <redacted>


-- 
Giuseppe "Oblomov" Bilotta

Re: [PATCH] Add 'raw' blob_plain link in history overview

From: Job Snijders <hidden>
Date: 2017-08-21 14:13:15

Add 'raw' blob_plain link in history overview

Reviewed-by: Giuseppe Bilotta <redacted>
Signed-off-by: Job Snijders <redacted>

---
 gitweb/gitweb.perl | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 9208f42ed..959f04b49 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -5967,6 +5967,9 @@ sub git_history_body {
 		      $cgi->a({-href => href(action=>"commitdiff", hash=>$commit)}, "commitdiff");
 
 		if ($ftype eq 'blob') {
+			print " | " .
+			      $cgi->a({-href => href(action=>"blob_plain", hash_base=>$commit, file_name=>$file_name)}, "raw");
+
 			my $blob_current = $file_hash;
 			my $blob_parent  = git_get_hash_by_path($commit, $file_name);
 			if (defined $blob_current && defined $blob_parent &&
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help