Thread (16 messages) 16 messages, 4 authors, 2024-09-30
STALE631d

[PATCH v4 0/5] improve handling of remote/HEAD

From: Bence Ferdinandy <hidden>
Date: 2024-09-30 22:22:07

Possibly related (same subject, not in this thread)

This version has dropped some previous patches in favour of new ones.
These solve the problem of atomically deciding what the head was before
we updated it and also not reinventing the wheel for having an "create
this ref, but if it already exists, fail silently" call.

Since now both changes to remote set-head and fetch utilize some common
preceding patches I have again included in this series my changes to
remote set-head. Sorry for the mess tangent there.

All tests (that run on my system) pass for the patches up to the
last patch, which changes fetch. For the last patch I updated some of
the test where it was trivial (lot of remote/HEAD -> something appeared
as expected), but there is still work to be done there (i.e. figure out
which tests need updating and which are actual bugs in the patch).

One specific thing I wanted to mention here. Junio asked earlier what
happens on fetch, when we have a config like this:
If I am only fetching refs (or HEAD) in FETCH_HEAD for immediate
consumtion by doing "git pull bence HEAD" with something like

    [remote "bence"]
         URL = http://github.com/bence/git
In this case setting head will error out with the generic error message
I put at the end.

Bence Ferdinandy (5):
  refs_update_symref: atomically record overwritten ref
  set-head: better output for --auto
  transaction: add TRANSACTION_CREATE_EXISTS error
  refs_update_symref: add create_only option
  fetch: set remote/HEAD if it does not exist

 builtin/branch.c          |  2 +-
 builtin/checkout.c        |  5 ++-
 builtin/clone.c           |  8 ++--
 builtin/fetch.c           | 83 +++++++++++++++++++++++++++++++++++++++
 builtin/notes.c           |  3 +-
 builtin/remote.c          | 43 ++++++++++++++++----
 builtin/symbolic-ref.c    |  2 +-
 builtin/worktree.c        |  2 +-
 refs.c                    | 35 ++++++++++++-----
 refs.h                    |  7 +++-
 refs/files-backend.c      | 29 ++++++++++----
 refs/refs-internal.h      |  8 ++++
 refs/reftable-backend.c   |  6 ++-
 reset.c                   |  2 +-
 sequencer.c               |  3 +-
 setup.c                   |  3 +-
 t/helper/test-ref-store.c |  2 +-
 t/t5505-remote.sh         | 13 +++++-
 t/t5514-fetch-multiple.sh |  9 +++++
 19 files changed, 222 insertions(+), 43 deletions(-)

-- 
2.47.0.rc0.5.gf1cffeb8df.dirty
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help