зеркало из https://github.com/microsoft/git.git
Merge branch 'sg/do-not-skip-non-httpd-tests'
Test fix. * sg/do-not-skip-non-httpd-tests: t: warn against adding non-httpd-specific tests after sourcing 'lib-httpd' t5703: run all non-httpd-specific tests before sourcing 'lib-httpd.sh' t5510-fetch: run non-httpd-specific test before sourcing 'lib-httpd.sh'
This commit is contained in:
Коммит
77067b6ce8
|
@ -518,4 +518,7 @@ test_expect_success 'fetching of missing objects from an HTTP server' '
|
|||
git verify-pack --verbose "$IDX" | grep "$HASH"
|
||||
'
|
||||
|
||||
# DO NOT add non-httpd-specific tests here, because the last part of this
|
||||
# test script is only executed when httpd is available and enabled.
|
||||
|
||||
test_done
|
||||
|
|
|
@ -920,4 +920,7 @@ test_expect_success 'fetch with --filter=blob:limit=0 and HTTP' '
|
|||
fetch_filter_blob_limit_zero "$HTTPD_DOCUMENT_ROOT_PATH/server" "$HTTPD_URL/smart/server"
|
||||
'
|
||||
|
||||
# DO NOT add non-httpd-specific tests here, because the last part of this
|
||||
# test script is only executed when httpd is available and enabled.
|
||||
|
||||
test_done
|
||||
|
|
|
@ -902,6 +902,29 @@ test_expect_success C_LOCALE_OUTPUT 'fetch compact output' '
|
|||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success '--no-show-forced-updates' '
|
||||
mkdir forced-updates &&
|
||||
(
|
||||
cd forced-updates &&
|
||||
git init &&
|
||||
test_commit 1 &&
|
||||
test_commit 2
|
||||
) &&
|
||||
git clone forced-updates forced-update-clone &&
|
||||
git clone forced-updates no-forced-update-clone &&
|
||||
git -C forced-updates reset --hard HEAD~1 &&
|
||||
(
|
||||
cd forced-update-clone &&
|
||||
git fetch --show-forced-updates origin 2>output &&
|
||||
test_i18ngrep "(forced update)" output
|
||||
) &&
|
||||
(
|
||||
cd no-forced-update-clone &&
|
||||
git fetch --no-show-forced-updates origin 2>output &&
|
||||
test_i18ngrep ! "(forced update)" output
|
||||
)
|
||||
'
|
||||
|
||||
setup_negotiation_tip () {
|
||||
SERVER="$1"
|
||||
URL="$2"
|
||||
|
@ -978,27 +1001,7 @@ test_expect_success '--negotiation-tip limits "have" lines sent with HTTP protoc
|
|||
check_negotiation_tip
|
||||
'
|
||||
|
||||
test_expect_success '--no-show-forced-updates' '
|
||||
mkdir forced-updates &&
|
||||
(
|
||||
cd forced-updates &&
|
||||
git init &&
|
||||
test_commit 1 &&
|
||||
test_commit 2
|
||||
) &&
|
||||
git clone forced-updates forced-update-clone &&
|
||||
git clone forced-updates no-forced-update-clone &&
|
||||
git -C forced-updates reset --hard HEAD~1 &&
|
||||
(
|
||||
cd forced-update-clone &&
|
||||
git fetch --show-forced-updates origin 2>output &&
|
||||
test_i18ngrep "(forced update)" output
|
||||
) &&
|
||||
(
|
||||
cd no-forced-update-clone &&
|
||||
git fetch --no-show-forced-updates origin 2>output &&
|
||||
test_i18ngrep ! "(forced update)" output
|
||||
)
|
||||
'
|
||||
# DO NOT add non-httpd-specific tests here, because the last part of this
|
||||
# test script is only executed when httpd is available and enabled.
|
||||
|
||||
test_done
|
||||
|
|
|
@ -255,4 +255,7 @@ test_expect_success 'shallow fetches check connectivity before writing shallow f
|
|||
git -C client fsck
|
||||
'
|
||||
|
||||
# DO NOT add non-httpd-specific tests here, because the last part of this
|
||||
# test script is only executed when httpd is available and enabled.
|
||||
|
||||
test_done
|
||||
|
|
|
@ -278,4 +278,7 @@ test_expect_success 'push options keep quoted characters intact (http)' '
|
|||
test_cmp expect "$HTTPD_DOCUMENT_ROOT_PATH"/upstream.git/hooks/pre-receive.push_options
|
||||
'
|
||||
|
||||
# DO NOT add non-httpd-specific tests here, because the last part of this
|
||||
# test script is only executed when httpd is available and enabled.
|
||||
|
||||
test_done
|
||||
|
|
|
@ -739,4 +739,7 @@ test_expect_success 'partial clone using HTTP' '
|
|||
partial_clone "$HTTPD_DOCUMENT_ROOT_PATH/server" "$HTTPD_URL/smart/server"
|
||||
'
|
||||
|
||||
# DO NOT add non-httpd-specific tests here, because the last part of this
|
||||
# test script is only executed when httpd is available and enabled.
|
||||
|
||||
test_done
|
||||
|
|
|
@ -417,4 +417,7 @@ test_expect_success 'tolerate server sending REF_DELTA against missing promisor
|
|||
! test -e "$HTTPD_ROOT_PATH/one-time-sed"
|
||||
'
|
||||
|
||||
# DO NOT add non-httpd-specific tests here, because the last part of this
|
||||
# test script is only executed when httpd is available and enabled.
|
||||
|
||||
test_done
|
||||
|
|
|
@ -292,4 +292,7 @@ test_expect_success 'push with http:// using protocol v1' '
|
|||
grep "git< version 1" log
|
||||
'
|
||||
|
||||
# DO NOT add non-httpd-specific tests here, because the last part of this
|
||||
# test script is only executed when httpd is available and enabled.
|
||||
|
||||
test_done
|
||||
|
|
|
@ -723,4 +723,7 @@ test_expect_success 'when server does not send "ready", expect FLUSH' '
|
|||
test_i18ngrep "expected no other sections to be sent after no .ready." err
|
||||
'
|
||||
|
||||
# DO NOT add non-httpd-specific tests here, because the last part of this
|
||||
# test script is only executed when httpd is available and enabled.
|
||||
|
||||
test_done
|
||||
|
|
|
@ -157,106 +157,6 @@ test_expect_success 'want-ref with ref we already have commit for' '
|
|||
check_output
|
||||
'
|
||||
|
||||
. "$TEST_DIRECTORY"/lib-httpd.sh
|
||||
start_httpd
|
||||
|
||||
REPO="$HTTPD_DOCUMENT_ROOT_PATH/repo"
|
||||
LOCAL_PRISTINE="$(pwd)/local_pristine"
|
||||
|
||||
test_expect_success 'setup repos for change-while-negotiating test' '
|
||||
(
|
||||
git init "$REPO" &&
|
||||
cd "$REPO" &&
|
||||
>.git/git-daemon-export-ok &&
|
||||
test_commit m1 &&
|
||||
git tag -d m1 &&
|
||||
|
||||
# Local repo with many commits (so that negotiation will take
|
||||
# more than 1 request/response pair)
|
||||
git clone "http://127.0.0.1:$LIB_HTTPD_PORT/smart/repo" "$LOCAL_PRISTINE" &&
|
||||
cd "$LOCAL_PRISTINE" &&
|
||||
git checkout -b side &&
|
||||
test_commit_bulk --id=s 33 &&
|
||||
|
||||
# Add novel commits to upstream
|
||||
git checkout master &&
|
||||
cd "$REPO" &&
|
||||
test_commit m2 &&
|
||||
test_commit m3 &&
|
||||
git tag -d m2 m3
|
||||
) &&
|
||||
git -C "$LOCAL_PRISTINE" remote set-url origin "http://127.0.0.1:$LIB_HTTPD_PORT/one_time_sed/repo" &&
|
||||
git -C "$LOCAL_PRISTINE" config protocol.version 2
|
||||
'
|
||||
|
||||
inconsistency () {
|
||||
# Simulate that the server initially reports $2 as the ref
|
||||
# corresponding to $1, and after that, $1 as the ref corresponding to
|
||||
# $1. This corresponds to the real-life situation where the server's
|
||||
# repository appears to change during negotiation, for example, when
|
||||
# different servers in a load-balancing arrangement serve (stateless)
|
||||
# RPCs during a single negotiation.
|
||||
printf "s/%s/%s/" \
|
||||
$(git -C "$REPO" rev-parse $1 | tr -d "\n") \
|
||||
$(git -C "$REPO" rev-parse $2 | tr -d "\n") \
|
||||
>"$HTTPD_ROOT_PATH/one-time-sed"
|
||||
}
|
||||
|
||||
test_expect_success 'server is initially ahead - no ref in want' '
|
||||
git -C "$REPO" config uploadpack.allowRefInWant false &&
|
||||
rm -rf local &&
|
||||
cp -r "$LOCAL_PRISTINE" local &&
|
||||
inconsistency master 1234567890123456789012345678901234567890 &&
|
||||
test_must_fail git -C local fetch 2>err &&
|
||||
test_i18ngrep "fatal: remote error: upload-pack: not our ref" err
|
||||
'
|
||||
|
||||
test_expect_success 'server is initially ahead - ref in want' '
|
||||
git -C "$REPO" config uploadpack.allowRefInWant true &&
|
||||
rm -rf local &&
|
||||
cp -r "$LOCAL_PRISTINE" local &&
|
||||
inconsistency master 1234567890123456789012345678901234567890 &&
|
||||
git -C local fetch &&
|
||||
|
||||
git -C "$REPO" rev-parse --verify master >expected &&
|
||||
git -C local rev-parse --verify refs/remotes/origin/master >actual &&
|
||||
test_cmp expected actual
|
||||
'
|
||||
|
||||
test_expect_success 'server is initially behind - no ref in want' '
|
||||
git -C "$REPO" config uploadpack.allowRefInWant false &&
|
||||
rm -rf local &&
|
||||
cp -r "$LOCAL_PRISTINE" local &&
|
||||
inconsistency master "master^" &&
|
||||
git -C local fetch &&
|
||||
|
||||
git -C "$REPO" rev-parse --verify "master^" >expected &&
|
||||
git -C local rev-parse --verify refs/remotes/origin/master >actual &&
|
||||
test_cmp expected actual
|
||||
'
|
||||
|
||||
test_expect_success 'server is initially behind - ref in want' '
|
||||
git -C "$REPO" config uploadpack.allowRefInWant true &&
|
||||
rm -rf local &&
|
||||
cp -r "$LOCAL_PRISTINE" local &&
|
||||
inconsistency master "master^" &&
|
||||
git -C local fetch &&
|
||||
|
||||
git -C "$REPO" rev-parse --verify "master" >expected &&
|
||||
git -C local rev-parse --verify refs/remotes/origin/master >actual &&
|
||||
test_cmp expected actual
|
||||
'
|
||||
|
||||
test_expect_success 'server loses a ref - ref in want' '
|
||||
git -C "$REPO" config uploadpack.allowRefInWant true &&
|
||||
rm -rf local &&
|
||||
cp -r "$LOCAL_PRISTINE" local &&
|
||||
echo "s/master/raster/" >"$HTTPD_ROOT_PATH/one-time-sed" &&
|
||||
test_must_fail git -C local fetch 2>err &&
|
||||
|
||||
test_i18ngrep "fatal: remote error: unknown ref refs/heads/raster" err
|
||||
'
|
||||
|
||||
REPO="$(pwd)/repo"
|
||||
LOCAL_PRISTINE="$(pwd)/local_pristine"
|
||||
|
||||
|
@ -372,4 +272,108 @@ test_expect_success 'fetching with wildcard that matches multiple refs' '
|
|||
grep "want-ref refs/heads/o/bar" log
|
||||
'
|
||||
|
||||
. "$TEST_DIRECTORY"/lib-httpd.sh
|
||||
start_httpd
|
||||
|
||||
REPO="$HTTPD_DOCUMENT_ROOT_PATH/repo"
|
||||
LOCAL_PRISTINE="$(pwd)/local_pristine"
|
||||
|
||||
test_expect_success 'setup repos for change-while-negotiating test' '
|
||||
(
|
||||
git init "$REPO" &&
|
||||
cd "$REPO" &&
|
||||
>.git/git-daemon-export-ok &&
|
||||
test_commit m1 &&
|
||||
git tag -d m1 &&
|
||||
|
||||
# Local repo with many commits (so that negotiation will take
|
||||
# more than 1 request/response pair)
|
||||
rm -rf "$LOCAL_PRISTINE" &&
|
||||
git clone "http://127.0.0.1:$LIB_HTTPD_PORT/smart/repo" "$LOCAL_PRISTINE" &&
|
||||
cd "$LOCAL_PRISTINE" &&
|
||||
git checkout -b side &&
|
||||
test_commit_bulk --id=s 33 &&
|
||||
|
||||
# Add novel commits to upstream
|
||||
git checkout master &&
|
||||
cd "$REPO" &&
|
||||
test_commit m2 &&
|
||||
test_commit m3 &&
|
||||
git tag -d m2 m3
|
||||
) &&
|
||||
git -C "$LOCAL_PRISTINE" remote set-url origin "http://127.0.0.1:$LIB_HTTPD_PORT/one_time_sed/repo" &&
|
||||
git -C "$LOCAL_PRISTINE" config protocol.version 2
|
||||
'
|
||||
|
||||
inconsistency () {
|
||||
# Simulate that the server initially reports $2 as the ref
|
||||
# corresponding to $1, and after that, $1 as the ref corresponding to
|
||||
# $1. This corresponds to the real-life situation where the server's
|
||||
# repository appears to change during negotiation, for example, when
|
||||
# different servers in a load-balancing arrangement serve (stateless)
|
||||
# RPCs during a single negotiation.
|
||||
printf "s/%s/%s/" \
|
||||
$(git -C "$REPO" rev-parse $1 | tr -d "\n") \
|
||||
$(git -C "$REPO" rev-parse $2 | tr -d "\n") \
|
||||
>"$HTTPD_ROOT_PATH/one-time-sed"
|
||||
}
|
||||
|
||||
test_expect_success 'server is initially ahead - no ref in want' '
|
||||
git -C "$REPO" config uploadpack.allowRefInWant false &&
|
||||
rm -rf local &&
|
||||
cp -r "$LOCAL_PRISTINE" local &&
|
||||
inconsistency master 1234567890123456789012345678901234567890 &&
|
||||
test_must_fail git -C local fetch 2>err &&
|
||||
test_i18ngrep "fatal: remote error: upload-pack: not our ref" err
|
||||
'
|
||||
|
||||
test_expect_success 'server is initially ahead - ref in want' '
|
||||
git -C "$REPO" config uploadpack.allowRefInWant true &&
|
||||
rm -rf local &&
|
||||
cp -r "$LOCAL_PRISTINE" local &&
|
||||
inconsistency master 1234567890123456789012345678901234567890 &&
|
||||
git -C local fetch &&
|
||||
|
||||
git -C "$REPO" rev-parse --verify master >expected &&
|
||||
git -C local rev-parse --verify refs/remotes/origin/master >actual &&
|
||||
test_cmp expected actual
|
||||
'
|
||||
|
||||
test_expect_success 'server is initially behind - no ref in want' '
|
||||
git -C "$REPO" config uploadpack.allowRefInWant false &&
|
||||
rm -rf local &&
|
||||
cp -r "$LOCAL_PRISTINE" local &&
|
||||
inconsistency master "master^" &&
|
||||
git -C local fetch &&
|
||||
|
||||
git -C "$REPO" rev-parse --verify "master^" >expected &&
|
||||
git -C local rev-parse --verify refs/remotes/origin/master >actual &&
|
||||
test_cmp expected actual
|
||||
'
|
||||
|
||||
test_expect_success 'server is initially behind - ref in want' '
|
||||
git -C "$REPO" config uploadpack.allowRefInWant true &&
|
||||
rm -rf local &&
|
||||
cp -r "$LOCAL_PRISTINE" local &&
|
||||
inconsistency master "master^" &&
|
||||
git -C local fetch &&
|
||||
|
||||
git -C "$REPO" rev-parse --verify "master" >expected &&
|
||||
git -C local rev-parse --verify refs/remotes/origin/master >actual &&
|
||||
test_cmp expected actual
|
||||
'
|
||||
|
||||
test_expect_success 'server loses a ref - ref in want' '
|
||||
git -C "$REPO" config uploadpack.allowRefInWant true &&
|
||||
rm -rf local &&
|
||||
cp -r "$LOCAL_PRISTINE" local &&
|
||||
echo "s/master/raster/" >"$HTTPD_ROOT_PATH/one-time-sed" &&
|
||||
test_must_fail git -C local fetch 2>err &&
|
||||
|
||||
test_i18ngrep "fatal: remote error: unknown ref refs/heads/raster" err
|
||||
'
|
||||
|
||||
# DO NOT add non-httpd-specific tests here, because the last part of this
|
||||
# test script is only executed when httpd is available and enabled.
|
||||
|
||||
test_done
|
||||
|
|
Загрузка…
Ссылка в новой задаче