diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-08-25 00:54:31 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-08-25 00:54:31 +0300 |
commit | b55605073381a9863b3c2b3b6627122fe9b90453 (patch) | |
tree | 46ef750609127c8e3c427f5bfad478a0f4e394e7 /t | |
parent | d1ff7411f3538812796048e8f5bba717bb79fa2f (diff) | |
parent | 887952b8c680626f4721cb5fa57704478801aca4 (diff) |
Merge branch 'jc/no-update-fetch-head'
"git fetch" learned --no-write-fetch-head option to avoid writing
the FETCH_HEAD file.
* jc/no-update-fetch-head:
fetch: optionally allow disabling FETCH_HEAD update
Diffstat (limited to 't')
-rwxr-xr-x | t/t5510-fetch.sh | 15 | ||||
-rwxr-xr-x | t/t5521-pull-options.sh | 7 |
2 files changed, 20 insertions, 2 deletions
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index 25695dfe22..2a1abe91f0 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -543,13 +543,24 @@ 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' ' rm -f .git/FETCH_HEAD && git fetch --dry-run . && ! test -f .git/FETCH_HEAD ' +test_expect_success '--no-write-fetch-head does not touch FETCH_HEAD' ' + rm -f .git/FETCH_HEAD && + git fetch --no-write-fetch-head . && + ! test -f .git/FETCH_HEAD +' + +test_expect_success '--write-fetch-head gets defeated by --dry-run' ' + rm -f .git/FETCH_HEAD && + git fetch --dry-run --write-fetch-head . && + ! test -f .git/FETCH_HEAD +' + test_expect_success "should be able to fetch with duplicate refspecs" ' mkdir dups && ( diff --git a/t/t5521-pull-options.sh b/t/t5521-pull-options.sh index 159afa7ac8..db1a381cd9 100755 --- a/t/t5521-pull-options.sh +++ b/t/t5521-pull-options.sh @@ -85,6 +85,13 @@ test_expect_success 'git pull --cleanup errors early on invalid argument' ' test -s err) ' +test_expect_success 'git pull --no-write-fetch-head fails' ' + mkdir clonedwfh && + (cd clonedwfh && git init && + test_expect_code 129 git pull --no-write-fetch-head "../parent" >out 2>err && + test_must_be_empty out && + test_i18ngrep "no-write-fetch-head" err) +' test_expect_success 'git pull --force' ' mkdir clonedoldstyle && |