Git fork

gitweb: Move static files into seperate subdirectory

Create a new subdirectory called 'static' in gitweb/, and move
all static files required by gitweb.cgi when running, which means
styles, images and Javascript code. This should make gitweb more
readable and easier to maintain.

Update t/gitweb-lib.sh to reflect this change.The install-gitweb
now also include moving of static files into 'static' subdirectory
in target directory: update Makefile, gitweb's INSTALL, README and
Makefile accordingly.

Signed-off-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Petr Baudis <pasky@ucw.cz>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Acked-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Pavan Kumar Sunkara and committed by
Junio C Hamano
18d05328 d0b16c8f

+50 -47
+9 -9
Makefile
··· 1578 1578 $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all 1579 1579 1580 1580 ifdef JSMIN 1581 - GITWEB_PROGRAMS += gitweb/gitweb.min.js 1582 - GITWEB_JS = gitweb/gitweb.min.js 1581 + GITWEB_PROGRAMS += gitweb/static/gitweb.min.js 1582 + GITWEB_JS = gitweb/static/gitweb.min.js 1583 1583 else 1584 - GITWEB_JS = gitweb/gitweb.js 1584 + GITWEB_JS = gitweb/static/gitweb.js 1585 1585 endif 1586 1586 ifdef CSSMIN 1587 - GITWEB_PROGRAMS += gitweb/gitweb.min.css 1588 - GITWEB_CSS = gitweb/gitweb.min.css 1587 + GITWEB_PROGRAMS += gitweb/static/gitweb.min.css 1588 + GITWEB_CSS = gitweb/static/gitweb.min.css 1589 1589 else 1590 - GITWEB_CSS = gitweb/gitweb.css 1590 + GITWEB_CSS = gitweb/static/gitweb.css 1591 1591 endif 1592 1592 OTHER_PROGRAMS += gitweb/gitweb.cgi $(GITWEB_PROGRAMS) 1593 1593 gitweb/gitweb.cgi: gitweb/gitweb.perl $(GITWEB_PROGRAMS) 1594 1594 $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@) 1595 1595 1596 1596 ifdef JSMIN 1597 - gitweb/gitweb.min.js: gitweb/gitweb.js 1597 + gitweb/static/gitweb.min.js: gitweb/static/gitweb.js 1598 1598 $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@) 1599 1599 endif # JSMIN 1600 1600 ifdef CSSMIN 1601 - gitweb/gitweb.min.css: gitweb/gitweb.css 1601 + gitweb/static/gitweb.min.css: gitweb/static/gitweb.css 1602 1602 $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@) 1603 1603 endif # CSSMIN 1604 1604 1605 1605 1606 - git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css gitweb/gitweb.js 1606 + git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/static/gitweb.css gitweb/static/gitweb.js 1607 1607 $(QUIET_GEN)$(RM) $@ $@+ && \ 1608 1608 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ 1609 1609 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
+9 -10
gitweb/INSTALL
··· 2 2 ======================================= 3 3 4 4 First you have to generate gitweb.cgi from gitweb.perl using 5 - "make gitweb", then copy appropriate files (gitweb.cgi, gitweb.js, 6 - gitweb.css, git-logo.png and git-favicon.png) to their destination. 7 - For example if git was (or is) installed with /usr prefix, you can do 5 + "make gitweb", then "make install-gitweb" appropriate files 6 + (gitweb.cgi, gitweb.js, gitweb.css, git-logo.png and git-favicon.png) 7 + to their destination. For example if git was (or is) installed with 8 + /usr prefix and gitwebdir is /var/www/cgi-bin, you can do 8 9 9 10 $ make prefix=/usr gitweb ;# as yourself 10 11 # make gitwebdir=/var/www/cgi-bin install-gitweb ;# as root ··· 81 82 minifiers, you can do 82 83 83 84 make GITWEB_PROJECTROOT="/home/local/scm" \ 84 - GITWEB_JS="/gitweb/gitweb.js" \ 85 - GITWEB_CSS="/gitweb/gitweb.css" \ 86 - GITWEB_LOGO="/gitweb/git-logo.png" \ 87 - GITWEB_FAVICON="/gitweb/git-favicon.png" \ 85 + GITWEB_JS="gitweb/static/gitweb.js" \ 86 + GITWEB_CSS="gitweb/static/gitweb.css" \ 87 + GITWEB_LOGO="gitweb/static/git-logo.png" \ 88 + GITWEB_FAVICON="gitweb/static/git-favicon.png" \ 88 89 bindir=/usr/local/bin \ 89 90 gitweb 90 91 91 - cp -fv gitweb/gitweb.{cgi,js,css} \ 92 - gitweb/git-{favicon,logo}.png \ 93 - /var/www/cgi-bin/gitweb/ 92 + make gitwebdir=/var/www/cgi-bin/gitweb install-gitweb 94 93 95 94 96 95 Gitweb config file
+21 -19
gitweb/Makefile
··· 4 4 # Define V=1 to have a more verbose compile. 5 5 # 6 6 # Define JSMIN to point to JavaScript minifier that functions as 7 - # a filter to have gitweb.js minified. 7 + # a filter to have static/gitweb.js minified. 8 8 # 9 9 # Define CSSMIN to point to a CSS minifier in order to generate a minified 10 - # version of gitweb.css 10 + # version of static/gitweb.css 11 11 # 12 12 13 13 prefix ?= $(HOME) ··· 29 29 GITWEB_BASE_URL = 30 30 GITWEB_LIST = 31 31 GITWEB_HOMETEXT = indextext.html 32 - GITWEB_CSS = gitweb.css 33 - GITWEB_LOGO = git-logo.png 34 - GITWEB_FAVICON = git-favicon.png 35 - GITWEB_JS = gitweb.js 32 + GITWEB_CSS = static/gitweb.css 33 + GITWEB_LOGO = static/git-logo.png 34 + GITWEB_FAVICON = static/git-favicon.png 35 + GITWEB_JS = static/gitweb.js 36 36 GITWEB_SITE_HEADER = 37 37 GITWEB_SITE_FOOTER = 38 38 ··· 54 54 # Shell quote; 55 55 bindir_SQ = $(subst ','\'',$(bindir))#' 56 56 gitwebdir_SQ = $(subst ','\'',$(gitwebdir))#' 57 + gitwebstaticdir_SQ = $(subst ','\'',$(gitwebdir)/static)#' 57 58 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))#' 58 59 PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))#' 59 60 DESTDIR_SQ = $(subst ','\'',$(DESTDIR))#' ··· 88 89 GITWEB_PROGRAMS = gitweb.cgi 89 90 90 91 ifdef JSMIN 91 - GITWEB_FILES += gitweb.min.js 92 - GITWEB_JS = gitweb.min.js 93 - all:: gitweb.min.js 94 - gitweb.min.js: gitweb.js GITWEB-BUILD-OPTIONS 92 + GITWEB_FILES += static/gitweb.min.js 93 + GITWEB_JS = static/gitweb.min.js 94 + all:: static/gitweb.min.js 95 + static/gitweb.min.js: static/gitweb.js GITWEB-BUILD-OPTIONS 95 96 $(QUIET_GEN)$(JSMIN) <$< >$@ 96 97 else 97 - GITWEB_FILES += gitweb.js 98 + GITWEB_FILES += static/gitweb.js 98 99 endif 99 100 100 101 ifdef CSSMIN 101 - GITWEB_FILES += gitweb.min.css 102 - GITWEB_CSS = gitweb.min.css 103 - all:: gitweb.min.css 104 - gitweb.min.css: gitweb.css GITWEB-BUILD-OPTIONS 102 + GITWEB_FILES += static/gitweb.min.css 103 + GITWEB_CSS = static/gitweb.min.css 104 + all:: static/gitweb.min.css 105 + static/gitweb.min.css: static/gitweb.css GITWEB-BUILD-OPTIONS 105 106 $(QUIET_GEN)$(CSSMIN) <$ >$@ 106 107 else 107 - GITWEB_FILES += gitweb.css 108 + GITWEB_FILES += static/gitweb.css 108 109 endif 109 110 110 - GITWEB_FILES += git-logo.png git-favicon.png 111 + GITWEB_FILES += static/git-logo.png static/git-favicon.png 111 112 112 113 GITWEB_REPLACE = \ 113 114 -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \ ··· 147 148 install: all 148 149 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebdir_SQ)' 149 150 $(INSTALL) -m 755 $(GITWEB_PROGRAMS) '$(DESTDIR_SQ)$(gitwebdir_SQ)' 150 - $(INSTALL) -m 644 $(GITWEB_FILES) '$(DESTDIR_SQ)$(gitwebdir_SQ)' 151 + $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)' 152 + $(INSTALL) -m 644 $(GITWEB_FILES) '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)' 151 153 152 154 ### Cleaning rules 153 155 154 156 clean: 155 - $(RM) gitweb.cgi gitweb.min.js gitweb.min.css GITWEB-BUILD-OPTIONS 157 + $(RM) gitweb.cgi static/gitweb.min.js static/gitweb.min.css GITWEB-BUILD-OPTIONS 156 158 157 159 .PHONY: all clean install .FORCE-GIT-VERSION-FILE FORCE 158 160
+8 -6
gitweb/README
··· 80 80 Points to the location where you put gitweb.css on your web server 81 81 (or to be more generic, the URI of gitweb stylesheet). Relative to the 82 82 base URI of gitweb. Note that you can setup multiple stylesheets from 83 - the gitweb config file. [Default: gitweb.css (or gitweb.min.css if the 84 - CSSMIN variable is defined / CSS minifier is used)] 83 + the gitweb config file. [Default: static/gitweb.css (or 84 + static/gitweb.min.css if the CSSMIN variable is defined / CSS minifier 85 + is used)] 85 86 * GITWEB_LOGO 86 87 Points to the location where you put git-logo.png on your web server 87 88 (or to be more generic URI of logo, 72x27 size, displayed in top right 88 89 corner of each gitweb page, and used as logo for Atom feed). Relative 89 - to base URI of gitweb. [Default: git-logo.png] 90 + to base URI of gitweb. [Default: static/git-logo.png] 90 91 * GITWEB_FAVICON 91 92 Points to the location where you put git-favicon.png on your web server 92 93 (or to be more generic URI of favicon, assumed to be image/png type; 93 94 web browsers that support favicons (website icons) may display them 94 95 in the browser's URL bar and next to site name in bookmarks). Relative 95 - to base URI of gitweb. [Default: git-favicon.png] 96 + to base URI of gitweb. [Default: static/git-favicon.png] 96 97 * GITWEB_JS 97 98 Points to the localtion where you put gitweb.js on your web server 98 99 (or to be more generic URI of JavaScript code used by gitweb). 99 - Relative to base URI of gitweb. [Default: gitweb.js (or gitweb.min.js 100 - if JSMIN build variable is defined / JavaScript minifier is used)] 100 + Relative to base URI of gitweb. [Default: static/gitweb.js (or 101 + static/gitweb.min.js if JSMIN build variable is defined / JavaScript 102 + minifier is used)] 101 103 * GITWEB_CONFIG 102 104 This Perl file will be loaded using 'do' and can be used to override any 103 105 of the options above as well as some other options -- see the "Runtime
gitweb/git-favicon.png gitweb/static/git-favicon.png
gitweb/git-logo.png gitweb/static/git-logo.png
gitweb/gitweb.css gitweb/static/gitweb.css
gitweb/gitweb.js gitweb/static/gitweb.js
+3 -3
t/gitweb-lib.sh
··· 19 19 our \$site_header = ''; 20 20 our \$site_footer = ''; 21 21 our \$home_text = 'indextext.html'; 22 - our @stylesheets = ('file:///$TEST_DIRECTORY/../gitweb/gitweb.css'); 23 - our \$logo = 'file:///$TEST_DIRECTORY/../gitweb/git-logo.png'; 24 - our \$favicon = 'file:///$TEST_DIRECTORY/../gitweb/git-favicon.png'; 22 + our @stylesheets = ('file:///$TEST_DIRECTORY/../gitweb/static/gitweb.css'); 23 + our \$logo = 'file:///$TEST_DIRECTORY/../gitweb/static/git-logo.png'; 24 + our \$favicon = 'file:///$TEST_DIRECTORY/../gitweb/static/git-favicon.png'; 25 25 our \$projects_list = ''; 26 26 our \$export_ok = ''; 27 27 our \$strict_export = '';