(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'test_description='> name:test_description) op: assign_op.Equal rhs: {(SQ <'test smart fetching over http via http-backend'>)} spids: [4] ) ] redirects: [] ) (C {<.>} {<'./test-lib.sh'>}) (C {<.>} {(DQ ($ Id.VSub_DollarName TEST_DIRECTORY)) <'/lib-httpd.sh'>}) (C {<start_httpd>}) (C {<test_expect_success>} {(SQ <'setup repository'>)} { (SQ <'\n'> <'\tgit config push.default matching &&\n'> <'\techo content >file &&\n'> <'\tgit add file &&\n'> <'\tgit commit -m one\n'> ) } ) (C {<test_expect_success>} {(SQ <'create http-accessible bare repository'>)} { (SQ <'\n'> <'\tmkdir "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&\n'> <'\t(cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&\n'> <'\t git --bare init\n'> <'\t) &&\n'> <'\tgit remote add public "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&\n'> <'\tgit push public master:master\n'> ) } ) (C {<setup_askpass_helper>}) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<exp>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 84 stdin_parts: [ <'> GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1\n'> <'> Accept: */*\n'> <'> Accept-Encoding: gzip\n'> <'> Pragma: no-cache\n'> <'< HTTP/1.1 200 OK\n'> <'< Pragma: no-cache\n'> <'< Cache-Control: no-cache, max-age=0, must-revalidate\n'> <'< Content-Type: application/x-git-upload-pack-advertisement\n'> <'> POST /smart/repo.git/git-upload-pack HTTP/1.1\n'> <'> Accept-Encoding: gzip\n'> <'> Content-Type: application/x-git-upload-pack-request\n'> <'> Accept: application/x-git-upload-pack-result\n'> <'> Content-Length: xxx\n'> <'< HTTP/1.1 200 OK\n'> <'< Pragma: no-cache\n'> <'< Cache-Control: no-cache, max-age=0, must-revalidate\n'> <'< Content-Type: application/x-git-upload-pack-result\n'> ] ) ) ] more_env: [] do_fork: T ) (C {<test_expect_success>} {(SQ <'clone http repository'>)} { (SQ <'\n'> <'\tGIT_TRACE_CURL=true git clone --quiet $HTTPD_URL/smart/repo.git clone 2>err &&\n'> <'\ttest_cmp file clone/file &&\n'> <'\ttr '> ) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''> ch:'\'') (SQ <'\\015'>) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''> ch:'\'') (SQ <' Q <err |\n'> <'\tsed -e "\n'> <'\t\ts/Q\\$//\n'> <'\t\t/^[*] /d\n'> <'\t\t/^== Info:/d\n'> <'\t\t/^=> Send header, /d\n'> <'\t\t/^=> Send header:$/d\n'> <'\t\t/^<= Recv header, /d\n'> <'\t\t/^<= Recv header:$/d\n'> <'\t\ts/=> Send header: //\n'> <'\t\ts/= Recv header://\n'> <'\t\t/^<= Recv data/d\n'> <'\t\t/^=> Send data/d\n'> <'\t\t/^$/d\n'> <'\t\t/^< $/d\n'> <'\n'> <'\t\t/^[^><]/{\n'> <'\t\t\ts/^/> /\n'> <'\t\t}\n'> <'\n'> <'\t\t/^> User-Agent: /d\n'> <'\t\t/^> Host: /d\n'> <'\t\t/^> POST /,$ {\n'> <'\t\t\t/^> Accept: [*]\\\\/[*]/d\n'> <'\t\t}\n'> <'\t\ts/^> Content-Length: .*/> Content-Length: xxx/\n'> <'\t\t/^> 00..want /d\n'> <'\t\t/^> 00.*done/d\n'> <'\n'> <'\t\t/^< Server: /d\n'> <'\t\t/^< Expires: /d\n'> <'\t\t/^< Date: /d\n'> <'\t\t/^< Content-Length: /d\n'> <'\t\t/^< Transfer-Encoding: /d\n'> <'\t" >act &&\n'> <'\ttest_cmp exp act\n'> ) } ) (C {<test_expect_success>} {(SQ <'fetch changes via http'>)} { (SQ <'\n'> <'\techo content >>file &&\n'> <'\tgit commit -a -m two &&\n'> <'\tgit push public &&\n'> <'\t(cd clone && git pull) &&\n'> <'\ttest_cmp file clone/file\n'> ) } ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<exp>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 171 stdin_parts: [ <'GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 200\n'> <'POST /smart/repo.git/git-upload-pack HTTP/1.1 200\n'> <'GET /smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1 200\n'> <'POST /smart/repo.git/git-upload-pack HTTP/1.1 200\n'> ] ) ) ] more_env: [] do_fork: T ) (C {<test_expect_success>} {(SQ <'used upload-pack service'>)} { (SQ <'\n'> <'\tsed -e "\n'> <'\t\ts/^.* \\"//\n'> <'\t\ts/\\"//\n'> <'\t\ts/ [1-9][0-9]*\\$//\n'> <'\t\ts/^GET /GET /\n'> <'\t" >act <"$HTTPD_ROOT_PATH"/access.log &&\n'> <'\ttest_cmp exp act\n'> ) } ) (C {<test_expect_success>} {(SQ <'follow redirects (301)'>)} {(SQ <'\n'> <'\tgit clone $HTTPD_URL/smart-redir-perm/repo.git --quiet repo-p\n'>)} ) (C {<test_expect_success>} {(SQ <'follow redirects (302)'>)} {(SQ <'\n'> <'\tgit clone $HTTPD_URL/smart-redir-temp/repo.git --quiet repo-t\n'>)} ) (C {<test_expect_success>} {(SQ <'redirects re-root further requests'>)} {(SQ <'\n'> <'\tgit clone $HTTPD_URL/smart-redir-limited/repo.git repo-redir-limited\n'>)} ) (C {<test_expect_success>} {(SQ <'clone from password-protected repository'>)} { (SQ <'\n'> <'\techo two >expect &&\n'> <'\tset_askpass user@host pass@host &&\n'> <'\tgit clone --bare "$HTTPD_URL/auth/smart/repo.git" smart-auth &&\n'> <'\texpect_askpass both user@host &&\n'> <'\tgit --git-dir=smart-auth log -1 --format=%s >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'clone from auth-only-for-push repository'>)} { (SQ <'\n'> <'\techo two >expect &&\n'> <'\tset_askpass wrong &&\n'> <'\tgit clone --bare "$HTTPD_URL/auth-push/smart/repo.git" smart-noauth &&\n'> <'\texpect_askpass none &&\n'> <'\tgit --git-dir=smart-noauth log -1 --format=%s >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'clone from auth-only-for-objects repository'>)} { (SQ <'\n'> <'\techo two >expect &&\n'> <'\tset_askpass user@host pass@host &&\n'> <'\tgit clone --bare "$HTTPD_URL/auth-fetch/smart/repo.git" half-auth &&\n'> <'\texpect_askpass both user@host &&\n'> <'\tgit --git-dir=half-auth log -1 --format=%s >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'no-op half-auth fetch does not require a password'>)} { (SQ <'\n'> <'\tset_askpass wrong &&\n'> <'\tgit --git-dir=half-auth fetch &&\n'> <'\texpect_askpass none\n'> ) } ) (C {<test_expect_success>} {(SQ <'redirects send auth to new location'>)} { (SQ <'\n'> <'\tset_askpass user@host pass@host &&\n'> <'\tgit -c credential.useHttpPath=true \\\n'> <'\t clone $HTTPD_URL/smart-redir-auth/repo.git repo-redir-auth &&\n'> <'\texpect_askpass both user@host auth/smart/repo.git\n'> ) } ) (C {<test_expect_success>} {(SQ <'disable dumb http on server'>)} { (SQ <'\n'> <'\tgit --git-dir="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" \\\n'> <'\t\tconfig http.getanyfile false\n'> ) } ) (C {<test_expect_success>} {(SQ <'GIT_SMART_HTTP can disable smart http'>)} { (SQ <'\n'> <'\t(GIT_SMART_HTTP=0 &&\n'> <'\t export GIT_SMART_HTTP &&\n'> <'\t cd clone &&\n'> <'\t test_must_fail git fetch)\n'> ) } ) (C {<test_expect_success>} {(SQ <'invalid Content-Type rejected'>)} { (SQ <'\n'> <'\ttest_must_fail git clone $HTTPD_URL/broken_smart/repo.git 2>actual &&\n'> <'\tgrep "not valid:" actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'create namespaced refs'>)} { (SQ <'\n'> <'\ttest_commit namespaced &&\n'> <'\tgit push public HEAD:refs/namespaces/ns/refs/heads/master &&\n'> <'\tgit --git-dir="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" \\\n'> <'\t\tsymbolic-ref refs/namespaces/ns/HEAD refs/namespaces/ns/refs/heads/master\n'> ) } ) (C {<test_expect_success>} {(SQ <'smart clone respects namespace'>)} { (SQ <'\n'> <'\tgit clone "$HTTPD_URL/smart_namespace/repo.git" ns-smart &&\n'> <'\techo namespaced >expect &&\n'> <'\tgit --git-dir=ns-smart/.git log -1 --format=%s >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'dumb clone via http-backend respects namespace'>)} { (SQ <'\n'> <'\tgit --git-dir="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" \\\n'> <'\t\tconfig http.getanyfile true &&\n'> <'\tGIT_SMART_HTTP=0 git clone \\\n'> <'\t\t"$HTTPD_URL/smart_namespace/repo.git" ns-dumb &&\n'> <'\techo namespaced >expect &&\n'> <'\tgit --git-dir=ns-dumb/.git log -1 --format=%s >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<cookies.txt>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 405 stdin_parts: [<'127.0.0.1\tFALSE\t/smart_cookies/\tFALSE\t0\tothername\tothervalue\n'>] ) ) ] more_env: [] do_fork: T ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect_cookies.txt>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 418 stdin_parts: [ <'\n'> <'127.0.0.1\tFALSE\t/smart_cookies/\tFALSE\t0\tothername\tothervalue\n'> <'127.0.0.1\tFALSE\t/smart_cookies/repo.git/info/\tFALSE\t0\tname\tvalue\n'> ] ) ) ] more_env: [] do_fork: T ) (C {<test_expect_success>} {(SQ <'cookies stored in http.cookiefile when http.savecookies set'>)} { (SQ <'\n'> <'\tgit config http.cookiefile cookies.txt &&\n'> <'\tgit config http.savecookies true &&\n'> <'\tgit ls-remote $HTTPD_URL/smart_cookies/repo.git master &&\n'> <'\ttail -3 cookies.txt >cookies_tail.txt &&\n'> <'\ttest_cmp expect_cookies.txt cookies_tail.txt\n'> ) } ) (C {<test_expect_success>} {(SQ <'transfer.hiderefs works over smart-http'>)} { (SQ <'\n'> <'\ttest_commit hidden &&\n'> <'\ttest_commit visible &&\n'> <'\tgit push public HEAD^:refs/heads/a HEAD:refs/heads/b &&\n'> <'\tgit --git-dir="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" \\\n'> <'\t\tconfig transfer.hiderefs refs/heads/a &&\n'> <'\tgit clone --bare "$HTTPD_URL/smart/repo.git" hidden.git &&\n'> <'\ttest_must_fail git -C hidden.git rev-parse --verify a &&\n'> <'\tgit -C hidden.git rev-parse --verify b\n'> ) } ) (command.ShFunction name: create_tags body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp] children: [ (C {<rm>} {<-f>} {<marks>}) (command.Pipeline children: [ (command.ForEach iter_names: [i] iterable: (for_iter.Words words: [ { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<test_seq>} {(DQ ($ Id.VSub_Number 1))} {(DQ ($ Id.VSub_Number 2))}) right: <Id.Eof_RParen _> ) } ] ) body: (command.DoGroup children: [ (command.AndOr ops: [ Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp ] children: [ (C {<echo>} {(DQ <'commit refs/heads/too-many-refs-'> ($ Id.VSub_Number 1))} ) (C {<echo>} {(DQ <'mark :'> ($ Id.VSub_DollarName i))}) (C {<echo>} { (DQ <'committer git <git@example.com> '> ($ Id.VSub_DollarName i) <' +0000'> ) } ) (C {<echo>} {(DQ <'data 0'>)}) (C {<echo>} {(DQ <'M 644 inline bla.txt'>)}) (C {<echo>} {(DQ <'data 4'>)}) (C {<echo>} {(DQ <bla>)}) (C {<echo>} {(DQ <'reset refs/heads/too-many-refs-'> ($ Id.VSub_Number 1))} ) (C {<echo>} {(DQ <'from :'> ($ Id.VSub_Number 1))}) ] ) ] ) redirects: [] ) (C {<git>} {<fast-import>} {<--export-marks> <Id.Lit_Equals '='> <marks>}) ] negated: F stderr_indices: [] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'tag='> name:tag) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<perl>} {<-e>} { (DQ <'print '> (word_part.EscapedLiteral token: <Id.Lit_EscapedChar '\\"'> ch: '"' ) <bla> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'> ch:'"') <' x 30'> ) } ) right: <Id.Eof_RParen _> ) } spids: [617] ) ] redirects: [] ) (command.Simple words: [ {<sed>} {<-e>} { (DQ <'s|^:'> <Id.Lit_BadBackslash '\\'> <'([^ ]*'> <Id.Lit_BadBackslash '\\'> <') '> <Id.Lit_BadBackslash '\\'> <'(.*'> <Id.Lit_BadBackslash '\\'> <')'> <Id.Lit_Dollar '$'> <'|'> <Id.Lit_BadBackslash '\\'> <'2 refs/tags/'> ($ Id.VSub_DollarName tag) <-> <Id.Lit_BadBackslash '\\'> <'1|'> ) } ] redirects: [ (redir op: <Id.Redir_Less '<'> loc: (redir_loc.Fd fd:0) arg: {<marks>} ) (redir op: <Id.Redir_DGreat '>>'> loc: (redir_loc.Fd fd:1) arg: {<packed-refs>} ) ] more_env: [] do_fork: T ) ] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (C {<test_expect_success>} {(SQ <'create 2,000 tags in the repo'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&\n'> <'\t\tcreate_tags 1 2000\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {<CMDLINE_LIMIT>} {(SQ <'clone the 2,000 tag repo to check OS command line overflow'>)} { (SQ <'\n'> <'\trun_with_limited_cmdline git clone $HTTPD_URL/smart/repo.git too-many-refs &&\n'> <'\t(\n'> <'\t\tcd too-many-refs &&\n'> <'\t\tgit for-each-ref refs/tags >actual &&\n'> <'\t\ttest_line_count = 2000 actual\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'large fetch-pack requests can be split across POSTs'>)} { (SQ <'\n'> <'\tGIT_TRACE_CURL=true git -c http.postbuffer=65536 \\\n'> <'\t\tclone --bare "$HTTPD_URL/smart/repo.git" split.git 2>err &&\n'> <'\tgrep "^=> Send header: POST" err >posts &&\n'> <'\ttest_line_count = 2 posts\n'> ) } ) (C {<test_expect_success>} {<EXPENSIVE>} {(SQ <'http can handle enormous ref negotiation'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&\n'> <'\t\tcreate_tags 2001 50000\n'> <'\t) &&\n'> <'\tgit -C too-many-refs fetch -q --tags &&\n'> <'\t(\n'> <'\t\tcd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&\n'> <'\t\tcreate_tags 50001 100000\n'> <'\t) &&\n'> <'\tgit -C too-many-refs fetch -q --tags &&\n'> <'\tgit -C too-many-refs for-each-ref refs/tags >tags &&\n'> <'\ttest_line_count = 100000 tags\n'> ) } ) (C {<test_expect_success>} {(SQ <'custom http headers'>)} { (SQ <'\n'> <'\ttest_must_fail git -c http.extraheader="x-magic-two: cadabra" \\\n'> <'\t\tfetch "$HTTPD_URL/smart_headers/repo.git" &&\n'> <'\tgit -c http.extraheader="x-magic-one: abra" \\\n'> <'\t -c http.extraheader="x-magic-two: cadabra" \\\n'> <'\t fetch "$HTTPD_URL/smart_headers/repo.git" &&\n'> <'\tgit update-index --add --cacheinfo 160000,$(git rev-parse HEAD),sub &&\n'> <'\tgit config -f .gitmodules submodule.sub.path sub &&\n'> <'\tgit config -f .gitmodules submodule.sub.url \\\n'> <'\t\t"$HTTPD_URL/smart_headers/repo.git" &&\n'> <'\tgit submodule init sub &&\n'> <'\ttest_must_fail git submodule update sub &&\n'> <'\tgit -c http.extraheader="x-magic-one: abra" \\\n'> <'\t -c http.extraheader="x-magic-two: cadabra" \\\n'> <'\t\tsubmodule update sub\n'> ) } ) (C {<stop_httpd>}) (C {<test_done>}) ] )