]> git.ipfire.org Git - thirdparty/git.git/commit
fetch: extract out reference committing logic
authorKarthik Nayak <karthik.188@gmail.com>
Fri, 21 Nov 2025 11:13:45 +0000 (12:13 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 21 Nov 2025 16:40:18 +0000 (08:40 -0800)
commitc3cf8e5907adb55380801007ff14f0e3b7cf7152
treed20cae35597dbbee2388900a9cade04621bf500a
parenta99f379adf116d53eb11957af5bab5214915f91d
fetch: extract out reference committing logic

The `do_fetch()` function contains the core of the `git-fetch(1)` logic.
Part of this is to fetch and store references. This is done by

  1. Creating a reference transaction (non-atomic mode uses batched
     updates).
  2. Adding individual reference updates to the transaction.
  3. Committing the transaction.
  4. When using batched updates, handling the rejected updates.

The following commit, will fix a bug wherein fetching tags with
conflicts was causing other reference updates to fail. Fixing this
requires utilizing this logic in different regions of the function.

In preparation of the follow up commit, extract the committing and
rejection handling logic into a separate function called
`commit_ref_transaction()`.

Helped-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fetch.c