Diff options
-rw-r--r--custom/cgitrc9
-rwxr-xr-xtests/t0004-docs.sh17
2 files changed, 19 insertions, 7 deletions
diff --git a/custom/cgitrc b/custom/cgitrc
index 86f00aa..4b4dd4c 100644
--- a/custom/cgitrc
+++ b/custom/cgitrc
@@ -133,10 +133,6 @@ embedded=0
# Default is none.
#module-link=/%s/commit/?id=%s
-# Directory scanned for git repositories at parse time. Value is a filesystem
-# path that may use macros. Default is none.
-#scan-path=/var/lib/git
-
# When scanning, recurse into dot-directories. Must precede scan-path. Values
# are 0 or 1. Default is 0.
scan-hidden-path=0
@@ -426,6 +422,11 @@ age-file=info/web/last-modified
#mimetype.png=image/png
#mimetype.svg=image/svg+xml
+# Directory scanned for git repositories at parse time. Each repository found
+# inherits the global settings above this line, so it comes after them all.
+# Value is a filesystem path that may use macros. Default is none.
+#scan-path=/var/lib/git
+
# Each repository is introduced by a repo.url line. All following repo.*
# settings apply to that repository until the next repo.url line. When
# repositories are discovered via scan-path the repo. prefix is dropped inside
diff --git a/tests/t0004-docs.sh b/tests/t0004-docs.sh
index 1eca51e..25ddcd6 100755
--- a/tests/t0004-docs.sh
+++ b/tests/t0004-docs.sh
@@ -2,9 +2,10 @@
# Checks that the configuration documents stay consistent with each other.
# The manual documents every key the reference config sets, the reference
-# config sets every key the manual documents, both settings sections of the
-# manual keep their entries sorted, and the three server configs carry one
-# identical content security policy.
+# config sets every key the manual documents and puts scan-path after every
+# global setting, both settings sections of the manual keep their entries
+# sorted, and the three server configs carry one identical content security
+# policy.
test_description='Check the configuration documents'
. ./setup.sh
@@ -33,6 +34,16 @@ test_expect_success 'every key the reference config sets is documented' '
test_must_be_empty undocumented
'
+# A scanned repository inherits the global settings above scan-path, so the
+# sample keeps none below it.
+test_expect_success 'the reference config scans after every global setting' '
+ sed -n "/^#\{0,1\}scan-path=/,\$p" "$ROOT/custom/cgitrc" |
+ sed -n "s/^#\{0,1\}\([a-z][a-zA-Z0-9.<>-]*\)=.*/\1/p" |
+ grep -v "^repo\." >after-scan-path &&
+ echo scan-path >expect &&
+ test_cmp expect after-scan-path
+'
+
test_expect_success 'the manual lists its global settings in order' '
sed -n "/^Global settings$/,/^Repository settings$/p" "$ROOT/MANUAL.txt" |
sed -n "s/^\([a-z][a-zA-Z0-9.<>-]*\)::$/\1/p" >global-order &&