Skip to content

Commit 484e669

Browse files
committed
Merge branch 'jh/gitweb-caching' (early part)
* 'jh/gitweb-caching' (early part): gitweb: Add optional extra parameter to die_error, for extended explanation gitweb: add a "string" variant of print_sort_th gitweb: add a "string" variant of print_local_time gitweb: Check that $site_header etc. are defined before using them gitweb: Makefile improvements gitweb: Load checking gitweb: Make running t9501 test with '--debug' reliable and usable
2 parents 347d04d + aa14013 commit 484e669

File tree

6 files changed

+248
-76
lines changed

6 files changed

+248
-76
lines changed

Makefile

Lines changed: 12 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -275,29 +275,6 @@ pathsep = :
275275
# JavaScript minifier invocation that can function as filter
276276
JSMIN =
277277

278-
# default configuration for gitweb
279-
GITWEB_CONFIG = gitweb_config.perl
280-
GITWEB_CONFIG_SYSTEM = /etc/gitweb.conf
281-
GITWEB_HOME_LINK_STR = projects
282-
GITWEB_SITENAME =
283-
GITWEB_PROJECTROOT = /pub/git
284-
GITWEB_PROJECT_MAXDEPTH = 2007
285-
GITWEB_EXPORT_OK =
286-
GITWEB_STRICT_EXPORT =
287-
GITWEB_BASE_URL =
288-
GITWEB_LIST =
289-
GITWEB_HOMETEXT = indextext.html
290-
GITWEB_CSS = gitweb.css
291-
GITWEB_LOGO = git-logo.png
292-
GITWEB_FAVICON = git-favicon.png
293-
ifdef JSMIN
294-
GITWEB_JS = gitweb.min.js
295-
else
296-
GITWEB_JS = gitweb.js
297-
endif
298-
GITWEB_SITE_HEADER =
299-
GITWEB_SITE_FOOTER =
300-
301278
export prefix bindir sharedir sysconfdir
302279

303280
CC = gcc
@@ -1518,37 +1495,25 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
15181495
chmod +x $@+ && \
15191496
mv $@+ $@
15201497

1498+
1499+
.PHONY: gitweb
1500+
gitweb:
1501+
$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all
1502+
15211503
ifdef JSMIN
15221504
OTHER_PROGRAMS += gitweb/gitweb.cgi gitweb/gitweb.min.js
15231505
gitweb/gitweb.cgi: gitweb/gitweb.perl gitweb/gitweb.min.js
15241506
else
15251507
OTHER_PROGRAMS += gitweb/gitweb.cgi
15261508
gitweb/gitweb.cgi: gitweb/gitweb.perl
15271509
endif
1528-
$(QUIET_GEN)$(RM) $@ $@+ && \
1529-
sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
1530-
-e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
1531-
-e 's|++GIT_BINDIR++|$(bindir)|g' \
1532-
-e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
1533-
-e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \
1534-
-e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
1535-
-e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
1536-
-e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
1537-
-e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
1538-
-e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
1539-
-e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
1540-
-e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
1541-
-e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
1542-
-e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
1543-
-e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \
1544-
-e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
1545-
-e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
1546-
-e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \
1547-
-e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
1548-
-e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
1549-
$< >$@+ && \
1550-
chmod +x $@+ && \
1551-
mv $@+ $@
1510+
$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)
1511+
1512+
ifdef JSMIN
1513+
gitweb/gitweb.min.js: gitweb/gitweb.js
1514+
$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)
1515+
endif # JSMIN
1516+
15521517

15531518
git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css gitweb/gitweb.js
15541519
$(QUIET_GEN)$(RM) $@ $@+ && \
@@ -1575,12 +1540,6 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)) git-instaweb: % : unimplemented.sh
15751540
mv $@+ $@
15761541
endif # NO_PERL
15771542

1578-
1579-
ifdef JSMIN
1580-
gitweb/gitweb.min.js: gitweb/gitweb.js
1581-
$(QUIET_GEN)$(JSMIN) <$< >$@
1582-
endif # JSMIN
1583-
15841543
ifndef NO_PYTHON
15851544
$(patsubst %.py,%,$(SCRIPT_PYTHON)): GIT-CFLAGS
15861545
$(patsubst %.py,%,$(SCRIPT_PYTHON)): % : %.py

gitweb/Makefile

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# The default target of this Makefile is...
2+
all::
3+
4+
# Define V=1 to have a more verbose compile.
5+
#
6+
# Define JSMIN to point to JavaScript minifier that functions as
7+
# a filter to have gitweb.js minified.
8+
#
9+
10+
prefix ?= $(HOME)
11+
bindir ?= $(prefix)/bin
12+
RM ?= rm -f
13+
14+
# JavaScript minifier invocation that can function as filter
15+
JSMIN ?=
16+
17+
# default configuration for gitweb
18+
GITWEB_CONFIG = gitweb_config.perl
19+
GITWEB_CONFIG_SYSTEM = /etc/gitweb.conf
20+
GITWEB_HOME_LINK_STR = projects
21+
GITWEB_SITENAME =
22+
GITWEB_PROJECTROOT = /pub/git
23+
GITWEB_PROJECT_MAXDEPTH = 2007
24+
GITWEB_EXPORT_OK =
25+
GITWEB_STRICT_EXPORT =
26+
GITWEB_BASE_URL =
27+
GITWEB_LIST =
28+
GITWEB_HOMETEXT = indextext.html
29+
GITWEB_CSS = gitweb.css
30+
GITWEB_LOGO = git-logo.png
31+
GITWEB_FAVICON = git-favicon.png
32+
ifdef JSMIN
33+
GITWEB_JS = gitweb.min.js
34+
else
35+
GITWEB_JS = gitweb.js
36+
endif
37+
GITWEB_SITE_HEADER =
38+
GITWEB_SITE_FOOTER =
39+
40+
# include user config
41+
-include ../config.mak.autogen
42+
-include ../config.mak
43+
44+
# determine version
45+
../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
46+
$(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE
47+
48+
-include ../GIT-VERSION-FILE
49+
50+
### Build rules
51+
52+
SHELL_PATH ?= $(SHELL)
53+
PERL_PATH ?= /usr/bin/perl
54+
55+
# Shell quote;
56+
bindir_SQ = $(subst ','\'',$(bindir)) #'
57+
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) #'
58+
PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH)) #'
59+
60+
# Quiet generation (unless V=1)
61+
QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
62+
QUIET_SUBDIR1 =
63+
64+
ifneq ($(findstring $(MAKEFLAGS),w),w)
65+
PRINT_DIR = --no-print-directory
66+
else # "make -w"
67+
NO_SUBDIR = :
68+
endif
69+
70+
ifneq ($(findstring $(MAKEFLAGS),s),s)
71+
ifndef V
72+
QUIET = @
73+
QUIET_GEN = $(QUIET)echo ' ' GEN $@;
74+
QUIET_SUBDIR0 = +@subdir=
75+
QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
76+
$(MAKE) $(PRINT_DIR) -C $$subdir
77+
export V
78+
export QUIET
79+
export QUIET_GEN
80+
export QUIET_SUBDIR0
81+
export QUIET_SUBDIR1
82+
endif
83+
endif
84+
85+
all:: gitweb.cgi
86+
87+
ifdef JSMIN
88+
FILES=gitweb.cgi gitweb.min.js
89+
gitweb.cgi: gitweb.perl gitweb.min.js
90+
else # !JSMIN
91+
FILES=gitweb.cgi
92+
gitweb.cgi: gitweb.perl
93+
endif # JSMIN
94+
95+
gitweb.cgi:
96+
$(QUIET_GEN)$(RM) $@ $@+ && \
97+
sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
98+
-e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
99+
-e 's|++GIT_BINDIR++|$(bindir)|g' \
100+
-e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \
101+
-e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \
102+
-e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
103+
-e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
104+
-e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
105+
-e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
106+
-e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
107+
-e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
108+
-e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
109+
-e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
110+
-e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
111+
-e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \
112+
-e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \
113+
-e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
114+
-e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \
115+
-e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
116+
-e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
117+
$< >$@+ && \
118+
chmod +x $@+ && \
119+
mv $@+ $@
120+
121+
ifdef JSMIN
122+
gitweb.min.js: gitweb.js
123+
$(QUIET_GEN)$(JSMIN) <$< >$@
124+
endif # JSMIN
125+
126+
clean:
127+
$(RM) $(FILES)
128+
129+
.PHONY: all clean .FORCE-GIT-VERSION-FILE

gitweb/README

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ not include variables usually directly set during build):
174174
Base URL for relative URLs in pages generated by gitweb,
175175
(e.g. $logo, $favicon, @stylesheets if they are relative URLs),
176176
needed and used only for URLs with nonempty PATH_INFO via
177-
<base href="$base_url>. Usually gitweb sets its value correctly,
177+
<base href="$base_url">. Usually gitweb sets its value correctly,
178178
and there is no need to set this variable, e.g. to $my_uri or "/".
179179
* $home_link
180180
Target of the home link on top of all pages (the first part of view
@@ -228,6 +228,11 @@ not include variables usually directly set during build):
228228
repositories from launching cross-site scripting (XSS) attacks. Set this
229229
to true if you don't trust the content of your repositories. The default
230230
is false.
231+
* $maxload
232+
Used to set the maximum load that we will still respond to gitweb queries.
233+
If server load exceed this value then return "503 Service Unavaliable" error.
234+
Server load is taken to be 0 if gitweb cannot determine its value. Set it to
235+
undefined value to turn it off. The default is 300.
231236

232237

233238
Projects list file format

0 commit comments

Comments
 (0)