diff options
Diffstat (limited to 't/t5510-fetch.sh')
-rwxr-xr-x | t/t5510-fetch.sh | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index a66dbe0bde..dbc724e4c0 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -213,7 +213,7 @@ test_expect_success 'fetch tags when there is no tags' ' test_expect_success 'fetch following tags' ' cd "$D" && - git tag -a -m 'annotated' anno HEAD && + git tag -a -m "annotated" anno HEAD && git tag light HEAD && mkdir four && @@ -281,15 +281,19 @@ test_expect_success 'create bundle 1' ' cd "$D" && echo >file updated again by origin && git commit -a -m "tip" && - git bundle create bundle1 master^..master + git bundle create --version=3 bundle1 master^..master ' test_expect_success 'header of bundle looks right' ' - head -n 4 "$D"/bundle1 && - head -n 1 "$D"/bundle1 | grep "^#" && - head -n 2 "$D"/bundle1 | grep "^-$OID_REGEX " && - head -n 3 "$D"/bundle1 | grep "^$OID_REGEX " && - head -n 4 "$D"/bundle1 | grep "^$" + cat >expect <<-EOF && + # v3 git bundle + @object-format=$(test_oid algo) + -OID updated by origin + OID refs/heads/master + + EOF + sed -e "s/$OID_REGEX/OID/g" -e "5q" "$D"/bundle1 >actual && + test_cmp expect actual ' test_expect_success 'create bundle 2' ' @@ -331,7 +335,7 @@ test_expect_success 'bundle does not prerequisite objects' ' test_expect_success 'bundle should be able to create a full history' ' cd "$D" && - git tag -a -m '1.0' v1.0 master && + git tag -a -m "1.0" v1.0 master && git bundle create bundle4 v1.0 ' @@ -539,10 +543,23 @@ test_expect_success 'fetch into the current branch with --update-head-ok' ' ' -test_expect_success 'fetch --dry-run' ' +test_expect_success 'fetch --dry-run does not touch FETCH_HEAD, but still prints what would be written' ' + rm -f .git/FETCH_HEAD err && + git fetch --dry-run . 2>err && + ! test -f .git/FETCH_HEAD && + grep FETCH_HEAD err +' + +test_expect_success '--no-write-fetch-head does not touch FETCH_HEAD, and does not print what would be written' ' + rm -f .git/FETCH_HEAD err && + git fetch --no-write-fetch-head . 2>err && + ! test -f .git/FETCH_HEAD && + ! grep FETCH_HEAD err +' +test_expect_success '--write-fetch-head gets defeated by --dry-run' ' rm -f .git/FETCH_HEAD && - git fetch --dry-run . && + git fetch --dry-run --write-fetch-head . && ! test -f .git/FETCH_HEAD ' @@ -797,7 +814,7 @@ test_configured_prune true true unset unset pruned pruned \ "--prune origin refs/tags/*:refs/tags/* +refs/heads/*:refs/remotes/origin/*" # --prune-tags on its own does nothing, needs --prune as well, same -# for for fetch.pruneTags without fetch.prune +# for fetch.pruneTags without fetch.prune test_configured_prune unset unset unset unset kept kept "--prune-tags" test_configured_prune unset unset true unset kept kept "" test_configured_prune unset unset unset true kept kept "" @@ -919,7 +936,7 @@ test_expect_success 'fetching with auto-gc does not lock up' ' git config fetch.unpackLimit 1 && git config gc.autoPackLimit 1 && git config gc.autoDetach false && - GIT_ASK_YESNO="$D/askyesno" git fetch >fetch.out 2>&1 && + GIT_ASK_YESNO="$D/askyesno" git fetch --verbose >fetch.out 2>&1 && test_i18ngrep "Auto packing the repository" fetch.out && ! grep "Should I try again" fetch.out ) |