threads / patch / 46504

patchAdd 'raw' blob_plain link in history overview

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

## tl;dr

12 messages between Aug 2, 2017 and Aug 22, 2017. Diffs are folded; open one to read it.

replies: 11people: 3as markdown or json

Job Snijders· Aug 2, 2017, 18:59 UTC · lore

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 <job@instituut.net>
---
 gitweb/gitweb.perl | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
Show changes to gitweb/gitweb.perl +5 −2
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;
Job Snijders· Aug 20, 2017, 18:03 UTC · re: Job Snijders · lore

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

bump? 
On Wed, Aug 02, 2017 at 08:59:01PM +0200, Job Snijders wrote:
Show 29 quoted 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.
> 
> Signed-off-by: Job Snijders <job@instituut.net>
> ---
>  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;
Giuseppe Bilotta· Aug 21, 2017, 10:19 UTC · re: Job Snijders · lore

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

Hello,
On Sun, Aug 20, 2017 at 8:03 PM, Job Snijders <job@instituut.net> wrote:
> bump?

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

Show 30 quoted lines
> On Wed, Aug 02, 2017 at 08:59:01PM +0200, Job Snijders wrote:
>> 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 <job@instituut.net>
>> ---
>>  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
Job Snijders· Aug 21, 2017, 10:44 UTC · re: Giuseppe Bilotta · lore

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

On Mon, Aug 21, 2017 at 12:19:38PM +0200, Giuseppe Bilotta wrote:
Show 9 quoted lines
> >> 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 <job@instituut.net>
---
 gitweb/gitweb.perl | 3 +++
 1 file changed, 3 insertions(+)
Show changes to gitweb/gitweb.perl +3 −0
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 &&
Giuseppe Bilotta· Aug 21, 2017, 14:07 UTC · re: Job Snijders · lore

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

Hello,
On Mon, Aug 21, 2017 at 12:44 PM, Job Snijders <job@instituut.net> 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
Show 19 quoted lines
> ---
>
> Add a 'raw' blob_plain link in history overview
>
> Signed-off-by: Job Snijders <job@instituut.net>
> ---
>  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 <giuseppe.bilotta@gmail.com>
-- 
Giuseppe "Oblomov" Bilotta
Job Snijders· Aug 21, 2017, 14:13 UTC · re: Giuseppe Bilotta · lore

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

Add 'raw' blob_plain link in history overview
Reviewed-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Job Snijders <job@instituut.net>
---
 gitweb/gitweb.perl | 3 +++
 1 file changed, 3 insertions(+)
Show changes to gitweb/gitweb.perl +3 −0
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 &&
Junio C Hamano· Aug 22, 2017, 19:22 UTC · re: Job Snijders · lore

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

Job Snijders <job@instituut.net> writes:
Show 6 quoted lines
> Add 'raw' blob_plain link in history overview
>
> Reviewed-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
> Signed-off-by: Job Snijders <job@instituut.net>
>
> ---

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?

Show 17 quoted lines
>  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 &&
Job Snijders· Aug 22, 2017, 19:35 UTC · re: Junio C Hamano · lore

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

On Tue, Aug 22, 2017 at 12:22:43PM -0700, Junio C Hamano wrote:
Show 11 quoted lines
> Job Snijders <job@instituut.net> writes:
> > Add 'raw' blob_plain link in history overview
> >
> > Reviewed-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
> > Signed-off-by: Job Snijders <job@instituut.net>
> >
> > ---
> 
> 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
Giuseppe Bilotta· Aug 22, 2017, 20:00 UTC · re: Job Snijders · lore

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

On Tue, Aug 22, 2017 at 9:35 PM, Job Snijders <job@instituut.net> wrote:
> 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.
-- 
Giuseppe "Oblomov" Bilotta
Job Snijders· Aug 22, 2017, 20:07 UTC · re: Giuseppe Bilotta · lore

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

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').

Reviewed-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Job Snijders <job@instituut.net>
---
 gitweb/gitweb.perl | 3 +++
 1 file changed, 3 insertions(+)
Show changes to gitweb/gitweb.perl +3 −0
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 &&
Junio C Hamano· Aug 22, 2017, 20:09 UTC · re: Job Snijders · lore

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

Job Snijders <job@instituut.net> writes:
Show 8 quoted lines
> 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').
>
> Reviewed-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
> Signed-off-by: Job Snijders <job@instituut.net>
>
> ---
This is much more readable ;-)  Will replace.
Thanks.
Show 17 quoted lines
>  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 &&
Junio C Hamano· Aug 22, 2017, 20:06 UTC · re: Job Snijders · lore

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

Job Snijders <job@instituut.net> writes:
Show 14 quoted lines
> On Tue, Aug 22, 2017 at 12:22:43PM -0700, Junio C Hamano wrote:
>> Job Snijders <job@instituut.net> writes:
>> > Add 'raw' blob_plain link in history overview
>> >
>> > Reviewed-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
>> > Signed-off-by: Job Snijders <job@instituut.net>
>> >
>> > ---
>> 
>> 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.

> ...
> 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.

← back to recent threads