mbox series

[v3,0/2] fetch: set remote/HEAD if missing

Message ID 20240919121335.298856-1-bence@ferdinandy.com (mailing list archive)
Headers show
Series fetch: set remote/HEAD if missing | expand

Message

Bence Ferdinandy Sept. 19, 2024, 12:13 p.m. UTC
This series is a complete rewrite of the RFC without using or touching
the code of `git remote set-head` (that part of the RFC is being handled
in a new thread of it's own).

Based on the previous discussions it does an atomic update of
remote/HEAD if it doesn't exist and is able to. Since we have git remote
set-head for manual handling of remote/HEAD, my idea was that it only
outputs minimal information and in general send the user to use remote
set-head for figuring out issues. If there is a simple, clear HEAD and
is changed it will give the command to use for switching to this and if
something went wrong it tells the user to check with remote set-head.
I'm not sure if this is really needed to be honest.

A note on tests:

- the first patch changing refs_update_symref passes all tests

- the series in itself breaks many fetch tests currently, most of them
  seem to stem from the fact that we now have remote/HEAD refs as extra

I'm planning to add a test to fetch for testing not to overwrite
existing refs, and of course I'll go and clean up all the tests, but it
would be nice to know beforehand if the approach is good and to finalize
all the outputs before changing 30 something tests.

Bence Ferdinandy (2):
  update_symref: add REF_CREATE_ONLY option
  fetch: set remote/HEAD if it does not exist

 builtin/branch.c          |  2 +-
 builtin/checkout.c        |  4 +--
 builtin/clone.c           |  6 ++--
 builtin/fetch.c           | 71 +++++++++++++++++++++++++++++++++++++++
 builtin/notes.c           |  2 +-
 builtin/remote.c          |  6 ++--
 builtin/symbolic-ref.c    |  2 +-
 builtin/worktree.c        |  2 +-
 refs.c                    |  6 ++--
 refs.h                    | 12 +++++--
 refs/files-backend.c      |  8 +++++
 reset.c                   |  2 +-
 sequencer.c               |  2 +-
 setup.c                   |  2 +-
 t/helper/test-ref-store.c |  2 +-
 15 files changed, 108 insertions(+), 21 deletions(-)