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

2017-08-22 Thread 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').

Reviewed-by: Giuseppe Bilotta <giuseppe.bilo...@gmail.com>
Signed-off-by: Job Snijders <j...@instituut.net>

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


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

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


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

2017-08-21 Thread Job Snijders
Add 'raw' blob_plain link in history overview

Reviewed-by: Giuseppe Bilotta <giuseppe.bilo...@gmail.com>
Signed-off-by: Job Snijders <j...@instituut.net>

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


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

2017-08-21 Thread Job Snijders
On Mon, Aug 21, 2017 at 12:19:38PM +0200, Giuseppe Bilotta wrote:
> >> 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 <j...@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");
+
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

2017-08-20 Thread Job Snijders
bump? 

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 <j...@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 "\n" .
> "" .
> -   $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;


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

2017-08-02 Thread 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.

Signed-off-by: Job Snijders <j...@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 "\n" .
  "" .
- $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;