http-backend: respect GIT_NAMESPACE with dumb clients
Filter the list of refs returned via the dumb HTTP protocol according to the active namespace, consistent with other clients of the upload-pack service. Signed-off-by: John Koleszar <jkoleszar@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
19534ee8a7
commit
6130f86dea
@ -61,6 +61,11 @@ Alias /auth/dumb/ www/auth/dumb/
|
||||
SetEnv GIT_COMMITTER_NAME "Custom User"
|
||||
SetEnv GIT_COMMITTER_EMAIL custom@example.com
|
||||
</LocationMatch>
|
||||
<LocationMatch /smart_namespace/>
|
||||
SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
|
||||
SetEnv GIT_HTTP_EXPORT_ALL
|
||||
SetEnv GIT_NAMESPACE ns
|
||||
</LocationMatch>
|
||||
ScriptAliasMatch /smart_*[^/]*/(.*) ${GIT_EXEC_PATH}/git-http-backend/$1
|
||||
ScriptAlias /broken_smart/ broken-smart-http.sh/
|
||||
<Directory ${GIT_EXEC_PATH}>
|
||||
|
@ -162,6 +162,30 @@ test_expect_success 'invalid Content-Type rejected' '
|
||||
grep "not valid:" actual
|
||||
'
|
||||
|
||||
test_expect_success 'create namespaced refs' '
|
||||
test_commit namespaced &&
|
||||
git push public HEAD:refs/namespaces/ns/refs/heads/master &&
|
||||
git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" \
|
||||
symbolic-ref refs/namespaces/ns/HEAD refs/namespaces/ns/refs/heads/master
|
||||
'
|
||||
|
||||
test_expect_success 'smart clone respects namespace' '
|
||||
git clone "$HTTPD_URL/smart_namespace/repo.git" ns-smart &&
|
||||
echo namespaced >expect &&
|
||||
git --git-dir=ns-smart/.git log -1 --format=%s >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'dumb clone via http-backend respects namespace' '
|
||||
git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" \
|
||||
config http.getanyfile true &&
|
||||
GIT_SMART_HTTP=0 git clone \
|
||||
"$HTTPD_URL/smart_namespace/repo.git" ns-dumb &&
|
||||
echo namespaced >expect &&
|
||||
git --git-dir=ns-dumb/.git log -1 --format=%s >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test -n "$GIT_TEST_LONG" && test_set_prereq EXPENSIVE
|
||||
|
||||
test_expect_success EXPENSIVE 'create 50,000 tags in the repo' '
|
||||
|
Reference in New Issue
Block a user