summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-03-13 22:56:16 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-03-13 22:56:16 (GMT)
commit851d2f0ab123c8fa33bbdc8e5a325e0c8b2c5d9c (patch)
tree79a68e80afcedd804eb416efde7f5fd08e161f53 /refs.c
parent1a4874565fa3b6668042216189551b98b4dc0b1b (diff)
parent583bc419235cedc6a2ba12593f058a9f812b9594 (diff)
downloadgit-851d2f0ab123c8fa33bbdc8e5a325e0c8b2c5d9c.zip
git-851d2f0ab123c8fa33bbdc8e5a325e0c8b2c5d9c.tar.gz
git-851d2f0ab123c8fa33bbdc8e5a325e0c8b2c5d9c.tar.bz2
Merge branch 'ps/fetch-atomic'
"git fetch" can make two separate fetches, but ref updates coming from them were in two separate ref transactions under "--atomic", which has been corrected. * ps/fetch-atomic: fetch: make `--atomic` flag cover pruning of refs fetch: make `--atomic` flag cover backfilling of tags refs: add interface to iterate over queued transactional updates fetch: report errors when backfilling tags fails fetch: control lifecycle of FETCH_HEAD in a single place fetch: backfill tags before setting upstream fetch: increase test coverage of fetches
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/refs.c b/refs.c
index 183e9ce..1598fb1 100644
--- a/refs.c
+++ b/refs.c
@@ -2418,6 +2418,22 @@ int initial_ref_transaction_commit(struct ref_transaction *transaction,
return refs->be->initial_transaction_commit(refs, transaction, err);
}
+void ref_transaction_for_each_queued_update(struct ref_transaction *transaction,
+ ref_transaction_for_each_queued_update_fn cb,
+ void *cb_data)
+{
+ int i;
+
+ for (i = 0; i < transaction->nr; i++) {
+ struct ref_update *update = transaction->updates[i];
+
+ cb(update->refname,
+ (update->flags & REF_HAVE_OLD) ? &update->old_oid : NULL,
+ (update->flags & REF_HAVE_NEW) ? &update->new_oid : NULL,
+ cb_data);
+ }
+}
+
int refs_delete_refs(struct ref_store *refs, const char *logmsg,
struct string_list *refnames, unsigned int flags)
{