Thread (16 messages) 16 messages, 2 authors, 2016-06-15

[PATCH 07/10] gitweb: Add -partial_query option to href() subroutine

STALE3764d

From: Jakub Narebski <hidden>
Date: 2016-06-15 22:47:05
Subsystem: the rest · Maintainer: Linus Torvalds

href(..., -partial_query=>1) is meant to generate links which have not
all parameters filled, and which can be completed by simply appending
';<param>=<value>'.  This feature was implemented for future AJAX-y
'blame_incremental' in JavaScript.

Originally by Petr Baudis as part of "gitweb: Incremental blame"
patch, to deal with path_info URLs in JavaScript part easily and
correctly.

Signed-off-by: Jakub Narebski <redacted>
---
This change is extracted from incremental blame patch by Petr Baudis.
In previous version of this series it was part of 5/3 patch
introducing 'blame_incremental' view.

However as you can see in incremental blame patch by Matrin Koegler:
  http://thread.gmane.org/gmane.comp.version-control.git/47902/focus=47905

this is not strictly necessary. JavaScript (which is sole user of this
'-partial-query' parameter) can simply check if there is '?' character
in link already.  On the other hand side it makes JavaScript code a bit
simpler.

 gitweb/gitweb.perl |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 2cb60be..0d91ac7 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -992,7 +992,8 @@ sub href {
 			}
 		}
 	}
-	$href .= "?" . join(';', @result) if scalar @result;
+	$href .= "?" . join(';', @result)
+		if ($params{-partial_query} or scalar @result);
 
 	return $href;
 }
-- 
1.6.3.3
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help