git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/2] Add fetch.updateHead option

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Apr 5, 2023, 09:28 UTC
Message-ID
<230405.86bkk2vfpo.gmgdl@evledraar.gmail.com>
In-Reply-To
<20230405012742.2452208-2-felipe.contreras@gmail.com>
On Tue, Apr 04 2023, Felipe Contreras wrote:
Show 34 quoted lines
> Users might change the behavior when running "git fetch" so that the
> remote's HEAD symbolic ref is updated at certain point.
>
> For example after running "git remote add" the remote HEAD is not
> set like it is with "git clone".
>
> Setting "fetch.updatehead = missing" would probably be a sensible
> default that everyone would want, but for now the default behavior is to
> never update HEAD, so there shouldn't be any functional changes.
>
> For the next major version of Git, we might want to change this default.
>
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
>  Documentation/config/fetch.txt  |  4 +++
>  Documentation/config/remote.txt |  3 ++
>  builtin/fetch.c                 | 64 ++++++++++++++++++++++++++++++++-
>  remote.c                        | 21 +++++++++++
>  remote.h                        | 11 ++++++
>  t/t5510-fetch.sh                | 31 ++++++++++++++++
>  6 files changed, 133 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/config/fetch.txt b/Documentation/config/fetch.txt
> index 568f0f75b3..dc147ffb35 100644
> --- a/Documentation/config/fetch.txt
> +++ b/Documentation/config/fetch.txt
> @@ -120,3 +120,7 @@ fetch.bundleCreationToken::
>  The creation token values are chosen by the provider serving the specific
>  bundle URI. If you modify the URI at `fetch.bundleURI`, then be sure to
>  remove the value for the `fetch.bundleCreationToken` value before fetching.
> +
> +fetch.updateHead::
> +	Defines when to update the remote HEAD symbolic ref. Values are 'never',
> +	'missing' (update only when HEAD is missing), and 'always'.

Missed the first time around, I think it would be useful to explain the historical behavior heher, and why it's been in place.

I.e. that we use this during the initial fetch/clone to find the "HEAD", for discovering the default branch, but then proceed to not care about it after that.

We should also link and cross-link to the other recent-ish config options (whose name I'm blanking on), which implement the "take the remote's suggestion of a default branch name" here.

Previous: Felipe ContrerasNext: Felipe Contreras
Message 8 of 9 in “Add fetch.updateHead option”
  1. 0/2 Add fetch.updateHead optionFelipe Contreras, Apr 5, 2023
  2. 1/2 Add fetch.updateHead optionFelipe Contreras, Apr 5, 2023
  3. Ævar Arnfjörð BjarmasonApr 5, 2023
  4. Patrick SteinhardtApr 5, 2023
  5. Felipe ContrerasApr 5, 2023
  6. Ævar Arnfjörð BjarmasonApr 6, 2023
  7. Felipe ContrerasApr 7, 2023
  8. Ævar Arnfjörð BjarmasonApr 5, 2023
  9. 2/2 fetch: add support for HEAD update on mirrorsFelipe Contreras, Apr 5, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.