E2E: Move code

Reduce the diff between v3 and v4
This commit is contained in:
Tim Hockin 2021-10-05 15:37:21 -07:00
parent 27f2c905fc
commit 320a4a7e93
1 changed files with 32 additions and 32 deletions

View File

@ -952,7 +952,7 @@ function e2e::password() {
}
##############################################
# Test askpass_url
# Test askpass-url
##############################################
function e2e::askpass_url() {
echo "$FUNCNAME 1" > "$REPO"/file
@ -1529,6 +1529,37 @@ function e2e::ssh() {
assert_file_eq "$ROOT"/link/file "$FUNCNAME"
}
##############################################
# Test sparse-checkout files
##############################################
function e2e::sparse_checkout() {
echo "!/*" > "$DIR"/sparseconfig
echo "!/*/" >> "$DIR"/sparseconfig
echo "file2" >> "$DIR"/sparseconfig
echo "$FUNCNAME" > "$REPO"/file
echo "$FUNCNAME" > "$REPO"/file2
mkdir "$REPO"/dir
echo "$FUNCNAME" > "$REPO"/dir/file3
git -C "$REPO" add file2
git -C "$REPO" add dir
git -C "$REPO" commit -qam "$FUNCNAME"
GIT_SYNC \
--one-time \
--repo="file://$REPO" \
--branch="$MAIN_BRANCH" \
--rev=HEAD \
--root="$ROOT" \
--link="link" \
--sparse-checkout-file="$DIR/sparseconfig" \
>> "$1" 2>&1
assert_link_exists "$ROOT"/link
assert_file_exists "$ROOT"/link/file2
assert_file_absent "$ROOT"/link/file
assert_file_absent "$ROOT"/link/dir/file3
assert_file_absent "$ROOT"/link/dir
assert_file_eq "$ROOT"/link/file2 "$FUNCNAME"
}
##############################################
# Test additional git configs
##############################################
@ -1588,37 +1619,6 @@ function e2e::export_error() {
assert_file_absent "$ROOT"/error.json
}
##############################################
# Test sparse-checkout files
##############################################
function e2e::sparse_checkout() {
echo "!/*" > "$DIR"/sparseconfig
echo "!/*/" >> "$DIR"/sparseconfig
echo "file2" >> "$DIR"/sparseconfig
echo "$FUNCNAME" > "$REPO"/file
echo "$FUNCNAME" > "$REPO"/file2
mkdir "$REPO"/dir
echo "$FUNCNAME" > "$REPO"/dir/file3
git -C "$REPO" add file2
git -C "$REPO" add dir
git -C "$REPO" commit -qam "$FUNCNAME"
GIT_SYNC \
--one-time \
--repo="file://$REPO" \
--branch="$MAIN_BRANCH" \
--rev=HEAD \
--root="$ROOT" \
--link="link" \
--sparse-checkout-file="$DIR/sparseconfig" \
>> "$1" 2>&1
assert_link_exists "$ROOT"/link
assert_file_exists "$ROOT"/link/file2
assert_file_absent "$ROOT"/link/file
assert_file_absent "$ROOT"/link/dir/file3
assert_file_absent "$ROOT"/link/dir
assert_file_eq "$ROOT"/link/file2 "$FUNCNAME"
}
##############################################
# Test github HTTPS
# TODO: it would be better if we set up a local HTTPS server