path: root/
diff options
authorJakub Narebski <>2009-09-01 11:39:17 (GMT)
committerJunio C Hamano <>2009-09-01 15:34:24 (GMT)
commit4af819d4cad206648b832f4d6103547981ab8004 (patch)
treea2a911920ed7cdcd21cd78bffaa2adf1de787c9a /
parentaa7dd05e6a622ec17d034980c4440b0aed583c6e (diff)
gitweb: Incremental blame (using JavaScript)
Add 'blame_incremental' view, which uses "git blame --incremental" and JavaScript (Ajax), where 'blame' use "git blame --porcelain". * gitweb generates initial info by putting file contents (from "git cat-file") together with line numbers in blame table * then gitweb makes web browser JavaScript engine call startBlame() function from gitweb.js * startBlame() opens XMLHttpRequest connection to 'blame_data' view, which in turn calls "git blame --incremental" for a file, and streams output of git-blame to JavaScript (gitweb.js) * XMLHttpRequest event handler updates line info in blame view as soon as it gets data from 'blame_data' (from server), and it also updates progress info * when 'blame_data' ends, and gitweb.js finishes updating line info, it fixes colors to match (as far as possible) ordinary 'blame' view, and updates information about how long it took to generate page. Gitweb deals with streamed 'blame_data' server errors by displaying them in the progress info area (just in case). The 'blame_incremental' view tries to be equivalent to 'blame' action; there are however a few differences in output between 'blame' and 'blame_incremental' view: * 'blame_incremental' always used query form for this part of link(s) which is generated by JavaScript code. The difference is visible if we use path_info link (pass some or all arguments in path_info). Changing this would require implementing something akin to href() subroutine from gitweb.perl in JavaScript (in gitweb.js). * 'blame_incremental' always uses "rowspan" attribute, even if rowspan="1". This simplifies code, and is not visible to user. * The progress bar and progress info are still there even after JavaScript part of 'blame_incremental' finishes work. Note that currently no link generated by gitweb leads to this new view. This code is based on patch by Petr Baudis <> patch, which in turn was tweaked up version of Fredrik Kuivinen <>'s proof of concept patch. This patch adds GITWEB_JS compile configuration option, and modifies to take gitweb.js into account. The code for was taken from Pasky's patch. Signed-off-by: Fredrik Kuivinen <> Signed-off-by: Petr Baudis <> Signed-off-by: Jakub Narebski <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to '')
1 files changed, 7 insertions, 0 deletions
diff --git a/ b/
index 5f4419b..6f381c8 100755
--- a/
+++ b/
@@ -331,8 +331,15 @@ gitweb_css () {
+gitweb_js () {
+ cat > "$1" <<\EOFGITWEB
gitweb_cgi "$GIT_DIR/gitweb/gitweb.cgi"
gitweb_css "$GIT_DIR/gitweb/gitweb.css"
+gitweb_js "$GIT_DIR/gitweb/gitweb.js"
case "$httpd" in