(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: { (SQ <'test WebDAV http-push\n'> <'\n'> <'This test runs various sanity checks on http-push.'> ) } spids: [13] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (command.If arms: [ (if_arm cond: [ (command.AndOr ops: [Id.Op_DPipe] children: [ (command.Simple words: [{<git>} {<http-push>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) (redir op: <Id.Redir_GreatAnd '2>&'> loc: (redir_loc.Fd fd:2) arg: {<1>} ) ] do_fork: T ) (C {<Id.Lit_LBracket '['>} {($ Id.VSub_QMark '$?')} {<-eq>} {<128>} {<Id.Lit_RBracket ']'>} ) ] ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:skip_all) op: assign_op.Equal rhs: {(DQ <'skipping test, USE_CURL_MULTI is not defined'>)} spids: [54] ) ] ) (C {<test_done>}) ] spids: [26 51] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:LIB_HTTPD_DAV) op: assign_op.Equal rhs: {<t>} spids: [65] ) ] ) (C {<.>} {(DQ ($ Id.VSub_DollarName '$TEST_DIRECTORY')) <'/lib-httpd.sh'>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:ROOT_PATH) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_DollarName '$PWD'))} spids: [75] ) ] ) (C {<start_httpd>}) (C {<test_expect_success>} {(SQ <'setup remote repository'>)} { (SQ <'\n'> <'\tcd "$ROOT_PATH" &&\n'> <'\tmkdir test_repo &&\n'> <'\tcd test_repo &&\n'> <'\tgit init &&\n'> <'\t: >path1 &&\n'> <'\tgit add path1 &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m initial &&\n'> <'\tcd - &&\n'> <'\tgit clone --bare test_repo test_repo.git &&\n'> <'\tcd test_repo.git &&\n'> <'\tgit --bare update-server-info &&\n'> <'\tmv hooks/post-update.sample hooks/post-update &&\n'> <'\tORIG_HEAD=$(git rev-parse --verify HEAD) &&\n'> <'\tcd - &&\n'> <'\tmv test_repo.git "$HTTPD_DOCUMENT_ROOT_PATH"\n'> ) } ) (C {<test_expect_success>} {(SQ <'create password-protected repository'>)} { (SQ <'\n'> <'\tmkdir -p "$HTTPD_DOCUMENT_ROOT_PATH/auth/dumb" &&\n'> <'\tcp -Rf "$HTTPD_DOCUMENT_ROOT_PATH/test_repo.git" \\\n'> <'\t "$HTTPD_DOCUMENT_ROOT_PATH/auth/dumb/test_repo.git"\n'> ) } ) (C {<setup_askpass_helper>}) (C {<test_expect_success>} {(SQ <'clone remote repository'>)} { (SQ <'\n'> <'\tcd "$ROOT_PATH" &&\n'> <'\tgit clone $HTTPD_URL/dumb/test_repo.git test_repo_clone\n'> ) } ) (C {<test_expect_success>} {(SQ <'push to remote repository with packed refs'>)} { (SQ <'\n'> <'\tcd "$ROOT_PATH"/test_repo_clone &&\n'> <'\t: >path2 &&\n'> <'\tgit add path2 &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m path2 &&\n'> <'\tHEAD=$(git rev-parse --verify HEAD) &&\n'> <'\tgit push &&\n'> <'\t(cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git &&\n'> <'\t test $HEAD = $(git rev-parse --verify HEAD))\n'> ) } ) (C {<test_expect_success>} {(SQ <'push already up-to-date'>)} {(SQ <'\n'> <'\tgit push\n'>)}) (C {<test_expect_success>} {(SQ <'push to remote repository with unpacked refs'>)} { (SQ <'\n'> <'\t(cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git &&\n'> <'\t rm packed-refs &&\n'> <'\t git update-ref refs/heads/master $ORIG_HEAD &&\n'> <'\t git --bare update-server-info) &&\n'> <'\tgit push &&\n'> <'\t(cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git &&\n'> <'\t test $HEAD = $(git rev-parse --verify HEAD))\n'> ) } ) (C {<test_expect_success>} {(SQ <'http-push fetches unpacked objects'>)} { (SQ <'\n'> <'\tcp -R "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git \\\n'> <'\t\t"$HTTPD_DOCUMENT_ROOT_PATH"/test_repo_unpacked.git &&\n'> <'\n'> <'\tgit clone $HTTPD_URL/dumb/test_repo_unpacked.git \\\n'> <'\t\t"$ROOT_PATH"/fetch_unpacked &&\n'> <'\n'> <'\t# By reset, we force git to retrieve the object\n'> <'\t(cd "$ROOT_PATH"/fetch_unpacked &&\n'> <'\t git reset --hard HEAD^ &&\n'> <'\t git remote rm origin &&\n'> <'\t git reflog expire --expire=0 --all &&\n'> <'\t git prune &&\n'> <'\t git push -f -v $HTTPD_URL/dumb/test_repo_unpacked.git master)\n'> ) } ) (C {<test_expect_success>} {(SQ <'http-push fetches packed objects'>)} { (SQ <'\n'> <'\tcp -R "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git \\\n'> <'\t\t"$HTTPD_DOCUMENT_ROOT_PATH"/test_repo_packed.git &&\n'> <'\n'> <'\tgit clone $HTTPD_URL/dumb/test_repo_packed.git \\\n'> <'\t\t"$ROOT_PATH"/test_repo_clone_packed &&\n'> <'\n'> <'\t(cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo_packed.git &&\n'> <'\t git --bare repack &&\n'> <'\t git --bare prune-packed) &&\n'> <'\n'> <'\t# By reset, we force git to retrieve the packed object\n'> <'\t(cd "$ROOT_PATH"/test_repo_clone_packed &&\n'> <'\t git reset --hard HEAD^ &&\n'> <'\t git remote remove origin &&\n'> <'\t git reflog expire --expire=0 --all &&\n'> <'\t git prune &&\n'> <'\t git push -f -v $HTTPD_URL/dumb/test_repo_packed.git master)\n'> ) } ) (C {<test_expect_success>} {(SQ <'create and delete remote branch'>)} { (SQ <'\n'> <'\tcd "$ROOT_PATH"/test_repo_clone &&\n'> <'\tgit checkout -b dev &&\n'> <'\t: >path3 &&\n'> <'\tgit add path3 &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m dev &&\n'> <'\tgit push origin dev &&\n'> <'\tgit push origin :dev &&\n'> <'\ttest_must_fail git show-ref --verify refs/remotes/origin/dev\n'> ) } ) (C {<test_expect_success>} {(SQ <'MKCOL sends directory names with trailing slashes'>)} { (SQ <'\n'> <'\n'> <'\t! grep "\\"MKCOL.*[^/] HTTP/[^ ]*\\"" < "$HTTPD_ROOT_PATH"/access.log\n'> <'\n'> ) } ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:x1) op: assign_op.Equal rhs: {(DQ <'[0-9a-f]'>)} spids: [276] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:x2) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_DollarName '$x1') ($ Id.VSub_DollarName '$x1'))} spids: [281] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:x5) op: assign_op.Equal rhs: { (DQ ($ Id.VSub_DollarName '$x1') ($ Id.VSub_DollarName '$x1') ($ Id.VSub_DollarName '$x1') ($ Id.VSub_DollarName '$x1') ($ Id.VSub_DollarName '$x1') ) } spids: [287] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:x38) op: assign_op.Equal rhs: { (DQ ($ Id.VSub_DollarName '$x5') ($ Id.VSub_DollarName '$x5') ($ Id.VSub_DollarName '$x5') ($ Id.VSub_DollarName '$x5') ($ Id.VSub_DollarName '$x5') ($ Id.VSub_DollarName '$x5') ($ Id.VSub_DollarName '$x5') ($ Id.VSub_DollarName '$x1') ($ Id.VSub_DollarName '$x1') ($ Id.VSub_DollarName '$x1') ) } spids: [296] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:x40) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_DollarName '$x38') ($ Id.VSub_DollarName '$x2'))} spids: [310] ) ] ) (C {<test_expect_success>} {(SQ <'PUT and MOVE sends object to URLs with SHA-1 hash suffix'>)} { (SQ <'\n'> <'\tsed \\\n'> <'\t\t-e "s/PUT /OP /" \\\n'> <'\t\t-e "s/MOVE /OP /" \\\n'> <'\t -e "s|/objects/$x2/${x38}_$x40|WANTED_PATH_REQUEST|" \\\n'> <'\t\t"$HTTPD_ROOT_PATH"/access.log |\n'> <'\tgrep -e "\\"OP .*WANTED_PATH_REQUEST HTTP/[.0-9]*\\" 20[0-9] "\n'> <'\n'> ) } ) (C {<test_http_push_nonff>} {(DQ ($ Id.VSub_DollarName '$HTTPD_DOCUMENT_ROOT_PATH')) <'/test_repo.git'>} {(DQ ($ Id.VSub_DollarName '$ROOT_PATH')) <'/test_repo_clone'>} {<master>} ) (C {<test_expect_success>} {(SQ <'push to password-protected repository (user in URL)'>)} { (SQ <'\n'> <'\ttest_commit pw-user &&\n'> <'\tset_askpass user@host pass@host &&\n'> <'\tgit push "$HTTPD_URL_USER/auth/dumb/test_repo.git" HEAD &&\n'> <'\tgit rev-parse --verify HEAD >expect &&\n'> <'\tgit --git-dir="$HTTPD_DOCUMENT_ROOT_PATH/auth/dumb/test_repo.git" \\\n'> <'\t\trev-parse --verify HEAD >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_failure>} {(SQ <'user was prompted only once for password'>)} {(SQ <'\n'> <'\texpect_askpass pass user@host\n'>)} ) (C {<test_expect_failure>} {(SQ <'push to password-protected repository (no user in URL)'>)} { (SQ <'\n'> <'\ttest_commit pw-nouser &&\n'> <'\tset_askpass user@host pass@host &&\n'> <'\tgit push "$HTTPD_URL/auth/dumb/test_repo.git" HEAD &&\n'> <'\texpect_askpass both user@host &&\n'> <'\tgit rev-parse --verify HEAD >expect &&\n'> <'\tgit --git-dir="$HTTPD_DOCUMENT_ROOT_PATH/auth/dumb/test_repo.git" \\\n'> <'\t\trev-parse --verify HEAD >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<stop_httpd>}) (C {<test_done>}) ] )