Skip to contentSkip to conversation

Add 'raw' blob_plain link in history overview

PATCH In review Job Snijders 3 participants 12 messages Aug 2, 2017 – Aug 22, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add 'raw' blob_plain link in history overview

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.

---
 gitweb/gitweb.perl | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
gitweb/gitweb.perl +5 -2
index 3d4a8ee27..ad79c518e 100755
@@ -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;
#1 lore raw

bump?

Quoted 29 lines · Job Snijders

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.

---
 gitweb/gitweb.perl | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
gitweb/gitweb.perl +5 -2
index 3d4a8ee27..ad79c518e 100755
@@ -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;
#2 lore raw

Hello,

Quoted 1 line · Job Snijders

bump?

(As a side note, I have also noticed that gitweb patches tend to go unreviewed for long)

Quoted 28 lines · Job Snijders
Quoted 27 lines

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.

---
 gitweb/gitweb.perl | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
gitweb/gitweb.perl +5 -2
index 3d4a8ee27..ad79c518e 100755
@@ -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");
 
Quoted 2 lines

gitweb/gitweb.perl sub git_history_body { · line 5971

Quoted 2 lines
gitweb/gitweb.perl +0 -0
              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)

Signature · 1 line
Giuseppe "Oblomov" Bilotta
#3 lore raw
Quoted 9 lines · Giuseppe Bilotta
Quoted 1 line
Quoted 1 line

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

---
 gitweb/gitweb.perl | 3 +++
 1 file changed, 3 insertions(+)
gitweb/gitweb.perl +3 -0
index 9208f42ed..c43bbe331 100755
@@ -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 &&
Reviewed-by
#4 lore raw

Hello,

Quoted 2 lines · Job Snijders

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 14 lines

---

Add a 'raw' blob_plain link in history overview

---
 gitweb/gitweb.perl | 3 +++
 1 file changed, 3 insertions(+)
gitweb/gitweb.perl +0 -0
index 9208f42ed..c43bbe331 100755

gitweb/gitweb.perl sub git_history_body { · line 5971

Quoted 5 lines
gitweb/gitweb.perl +2 -0
@@ -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

Signature · 1 line
Giuseppe "Oblomov" Bilotta
author Reviewed-by Giuseppe Bilotta
#5 lore raw

Add 'raw' blob_plain link in history overview

---
 gitweb/gitweb.perl | 3 +++
 1 file changed, 3 insertions(+)
gitweb/gitweb.perl +3 -0
index 9208f42ed..959f04b49 100755
@@ -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 &&
#6 lore raw
Quoted 6 lines · Job Snijders

Add 'raw' blob_plain link in history overview

---

Thanks; I somehow thought that your earlier one not just said what it does (twice---that is not needed) but why this change is useful, but that is lost in the patch description?

Quoted 17 lines
 gitweb/gitweb.perl | 3 +++
 1 file changed, 3 insertions(+)
gitweb/gitweb.perl +3 -0
index 9208f42ed..959f04b49 100755
@@ -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 &&
#7 lore raw
Quoted 11 lines · Junio C Hamano
Quoted 6 lines · Job Snijders

Add 'raw' blob_plain link in history overview

---

Thanks; I somehow thought that your earlier one not just said what it does (twice---that is not needed) but why this change is useful, but that is lost in the patch description?

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.

Without this patch the workflow is to go to the history of a file, click the 'blob' link, and then click the 'raw' link. If the file is large (multiple megabytes) - rendering the html enveloppe to the blob can take quite some time in the browser DOM rendering.

This patch adds a 'raw' blob_plain link in history overview so you can immediately click to the 'raw' version, saving time and improving workflow.

Here is a screenshot of a gitweb instance with this patch applied:

    http://instituut.net/~job/screenshots/b0f30e21eb64d5dda75ddabd.png

Kind regards,

Job

#8 lore raw
Quoted 3 lines · Job Snijders

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.

It might be worth it to add this information to the commit message.

Signature · 1 line
Giuseppe "Oblomov" Bilotta
#11 lore raw
In reply to Job Snijders
Quoted 7 lines · Job Snijders
Quoted 6 lines · Junio C Hamano
Quoted 5 lines · Job Snijders

Add 'raw' blob_plain link in history overview

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

---

Thanks; I somehow thought that your earlier one not just said what it does (twice---that is not needed) but why this change is useful, but that is lost in the patch description?

We often work with very large plain text files...

You do not have to explain it to _me_ ;-) I wanted you to explain it to our history, instead of me manually tweaking your proposed log message in your patch with what you sent over e-mail in a follow up explanation like this one.

Quoted 3 lines

...
immediately click to the 'raw' version, saving time and improving workflow.

Most of the above, or at least a condensed version of it, should be in the proposed log message. That is all I was saying.

Thanks.

author Reviewed-by Giuseppe Bilotta
#9 lore raw
In reply to Giuseppe Bilotta

For people that work with very large plain text files it may be easier if one can bypass viewing the htmlized blob and instead click directly to the raw file (rather then click through 'blob' and then to 'raw').

---
 gitweb/gitweb.perl | 3 +++
 1 file changed, 3 insertions(+)
gitweb/gitweb.perl +3 -0
index 9208f42ed..959f04b49 100755
@@ -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 &&
#10 lore raw
Quoted 8 lines · Job Snijders

For people that work with very large plain text files it may be easier if one can bypass viewing the htmlized blob and instead click directly to the raw file (rather then click through 'blob' and then to 'raw').

---

This is much more readable ;-) Will replace.

Thanks.

Quoted 17 lines
 gitweb/gitweb.perl | 3 +++
 1 file changed, 3 insertions(+)
gitweb/gitweb.perl +3 -0
index 9208f42ed..959f04b49 100755
@@ -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 &&