diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Keep a repository with an empty url ignored
The field resets at the end of cgit_add_repo cleared the ignore flag that the empty url branch had just set, so such a repository was listed on the index and selectable with ?r=, where every link to it read the byte before its url.
-rw-r--r--source/shared.c1
-rwxr-xr-xtests/t0303-robustness.sh7
2 files changed, 6 insertions, 2 deletions
diff --git a/source/shared.c b/source/shared.c
index b68cbbf..befd3e5 100644
--- a/source/shared.c
+++ b/source/shared.c
@@ -261,7 +261,6 @@ struct cgit_repo *cgit_add_repo(const char *url)
repo->trailer_filter = ctx.cfg.trailer_filter;
repo->clone_url = ctx.cfg.clone_url;
repo->submodules.strdup_strings = 1;
- repo->hide = repo->ignore = 0;
return repo;
}
diff --git a/tests/t0303-robustness.sh b/tests/t0303-robustness.sh
index 8dff969..e1b7b3a 100755
--- a/tests/t0303-robustness.sh
+++ b/tests/t0303-robustness.sh
@@ -43,12 +43,17 @@ test_expect_success 'a repository with an empty url is skipped with a warning' '
echo "cache-size=0" &&
echo "repo.url=" &&
echo "repo.path=$PWD/repos/rob/.git" &&
+ echo "repo.desc=nourl" &&
echo "repo.url=rob" &&
echo "repo.path=$PWD/repos/rob/.git"
} >nourlrc &&
CGIT_CONFIG="$PWD/nourlrc" QUERY_STRING="url=rob/" cgit >tmp 2>err &&
grep "^Status: 200" tmp &&
- grep "Ignoring repository with an empty url" err
+ grep "Ignoring repository with an empty url" err &&
+ CGIT_CONFIG="$PWD/nourlrc" QUERY_STRING="url=" cgit >tmp &&
+ ! grep nourl tmp &&
+ CGIT_CONFIG="$PWD/nourlrc" QUERY_STRING="r=" cgit >tmp &&
+ ! grep nourl tmp
'
test_expect_success 'a scan path that is itself a repository is named after it' '