On 8/13/2020 12:37 AM, Junio C Hamano wrote: > If you run fetch but record the result in remote-tracking branches, > and either if you do nothing with the fetched refs (e.g. you are > merely mirroring) or if you always work from the remote-tracking > refs (e.g. you fetch and then merge origin/branchname separately), > you can get away with having no FETCH_HEAD at all. > > Teach "git fetch" a command line option "--[no-]write-fetch-head". > The default is to write FETCH_HEAD, and the option is primarily > meant to be used with the "--no-" prefix to override this default, > because there is no matching fetch.writeFetchHEAD configuration > variable to flip the default to off (in which case, the positive > form may become necessary to defeat it). > > Note that under "--dry-run" mode, FETCH_HEAD is never written; > otherwise you'd see list of objects in the file that you do not > actually have. Passing `--write-fetch-head` does not force `git > fetch` to write the file. > > Signed-off-by: Derrick Stolee <dstolee@xxxxxxxxxxxxx> > Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx> > --- > > * So, it becomes much smaller by punting the whole configuration > thing, as we do not need the extra code for config parsing and > there is no need for code to override the user configuration when > driving "git fetch" from "git pull". Sounds good. I'll incorporate this patch into my next version, except it seems you dropped this test: 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 && which I changed "test_must_fail" to "test_expect_code 129" to demonstrate that this is a usage error, not just any error. Thanks, -Stolee