]> git.ipfire.org Git - thirdparty/git.git/commit
fetch: optionally allow disabling FETCH_HEAD update
authorJunio C Hamano <gitster@pobox.com>
Tue, 18 Aug 2020 14:25:22 +0000 (14:25 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 18 Aug 2020 19:56:57 +0000 (12:56 -0700)
commit887952b8c680626f4721cb5fa57704478801aca4
treee7cb5dd64843558d9cd4eb2e374a28e1464fb2c7
parent2befe97201e1f3175cce557866c5822793624b5a
fetch: optionally allow disabling FETCH_HEAD update

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@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/fetch-options.txt
builtin/fetch.c
t/t5510-fetch.sh
t/t5521-pull-options.sh