Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refs/heads/patch 1 #1858

Closed
wants to merge 169 commits into from
Closed
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
169 commits
Select commit Hold shift + click to select a range
a87ffb0
Merge branch 'jh/config-unset-doc-fix' into next
gitster Oct 10, 2024
5531615
Merge branch 'js/doc-platform-support-link-fix' into next
gitster Oct 10, 2024
0e38c7f
Merge branch 'xx/remote-server-option-config' into next
gitster Oct 10, 2024
0c40f5c
Merge branch 'jk/fsmonitor-event-listener-race-fix' into next
gitster Oct 10, 2024
b22c213
Merge branch 'kh/merge-tree-doc' into next
gitster Oct 11, 2024
e3a8d7f
Merge branch 'aa/t7300-modernize' into next
gitster Oct 11, 2024
99252fb
Merge branch 'kn/loose-object-layer-wo-global-hash' into next
gitster Oct 11, 2024
a5785fd
Merge branch 'ng/rebase-merges-branch-name-as-label' into next
gitster Oct 11, 2024
912ed5f
Merge branch 'jc/doc-refspec-syntax' into next
gitster Oct 11, 2024
c54df41
Merge branch 'ps/maintenance-start-crash-fix' into next
gitster Oct 11, 2024
ed66b60
Merge branch 'kh/checkout-ignore-other-docfix' into next
gitster Oct 11, 2024
37932ad
Merge branch 'xx/protocol-v2-doc-markup-fix' into next
gitster Oct 11, 2024
07ac214
Merge branch 'tc/bundle-uri-leakfix' into next
gitster Oct 11, 2024
0048cdb
Merge branch 'ps/cache-tree-w-broken-index-entry' into next
ttaylorr Oct 15, 2024
efc01c6
Merge branch 'cw/worktree-relative' into next
ttaylorr Oct 15, 2024
2ce7280
Sync with 'master'
ttaylorr Oct 15, 2024
b246cb1
Merge branch 'bf/t-readme-mention-reftable' into next
ttaylorr Oct 18, 2024
ae6e80b
Merge branch 'pb/clar-build-fix' into next
ttaylorr Oct 18, 2024
c45095c
Merge branch 'ak/typofixes' into next
ttaylorr Oct 18, 2024
a473d0d
Merge branch 'db/submodule-fetch-with-remote-name-fix' into next
ttaylorr Oct 18, 2024
2530706
Merge branch 'wm/shortlog-hash' into next
ttaylorr Oct 18, 2024
954a1eb
Merge branch 'sk/msvc-warnings' into next
ttaylorr Oct 18, 2024
83df4b3
Merge branch 'ak/typofix' into next
ttaylorr Oct 18, 2024
899fb7e
Merge branch 'jc/breaking-changes-early-adopter-option' into next
ttaylorr Oct 18, 2024
58a3be4
Merge branch 'ps/ci-gitlab-windows' into next
ttaylorr Oct 18, 2024
b428982
Merge branch 'jc/a-commands-without-the-repo' into next
ttaylorr Oct 18, 2024
1226f6d
Sync with 'master'
ttaylorr Oct 18, 2024
469c11a
Merge branch 'ps/reftable-strbuf' into next
ttaylorr Oct 22, 2024
6313df7
Merge branch 'ps/ref-filter-sort' into next
ttaylorr Oct 22, 2024
46b99d8
Merge branch 'ps/platform-compat-fixes' into next
ttaylorr Oct 22, 2024
0882adf
Merge branch 'kh/submitting-patches' into next
ttaylorr Oct 22, 2024
a87a9a8
Merge branch 'ks/t4205-fixup' into next
ttaylorr Oct 22, 2024
d377ddb
Merge branch 'co/t6050-pipefix' into next
ttaylorr Oct 22, 2024
4273cb6
Merge branch 'sk/t7011-cleanup' into next
ttaylorr Oct 22, 2024
a7371ff
Sync with 'master'
ttaylorr Oct 22, 2024
26b7b76
Merge branch 'ua/t3404-cleanup' into next
ttaylorr Oct 25, 2024
a3acd18
Merge branch 'rj/cygwin-exit' into next
ttaylorr Oct 25, 2024
db92c3e
Merge branch 'kh/mv-breakage' into next
ttaylorr Oct 25, 2024
ede3955
Merge branch 'ps/upload-pack-doc' into next
ttaylorr Oct 25, 2024
a55ee8b
Merge branch 'ss/duplicate-typos' into next
ttaylorr Oct 25, 2024
43a3513
Merge branch 'sk/t9101-cleanup' into next
ttaylorr Oct 25, 2024
29b26e5
Merge branch 'sa/notes-edit' into next
ttaylorr Oct 25, 2024
ecd980f
Merge branch 'ua/atoi' into next
ttaylorr Oct 25, 2024
1dd1717
Merge branch 'ak/t1016-cleanup' into next
ttaylorr Oct 25, 2024
44fc090
Merge branch 'rs/grep-lookahead' into next
ttaylorr Oct 25, 2024
63e3f96
Merge branch 'ak/more-typofixes' into next
ttaylorr Oct 25, 2024
317cc41
Merge branch 'kh/update-ref' into next
ttaylorr Oct 25, 2024
085561e
Sync with 'master'
ttaylorr Oct 25, 2024
eb1d692
Merge branch 'ps/platform-compat-fixes' into next
ttaylorr Oct 30, 2024
3eedf30
Merge branch 'kn/arbitrary-suffixes' into next
ttaylorr Oct 30, 2024
d063e82
Merge branch 'kn/ci-clang-format-tidy' into next
ttaylorr Oct 30, 2024
875fa0b
Merge branch 'cw/config-extensions' into next
ttaylorr Oct 30, 2024
b8b092b
Merge branch 'ps/upgrade-clar' into next
ttaylorr Oct 30, 2024
00932eb
Merge branch 'jk/dumb-http-finalize' into next
ttaylorr Oct 30, 2024
8800431
Sync with 'master'
ttaylorr Oct 30, 2024
f1d0c39
Merge branch 'jk/left-right-bitmap' into next
ttaylorr Nov 1, 2024
c08e6fc
Sync with 'master'
ttaylorr Nov 1, 2024
0260dbd
Merge branch 'ps/leakfixes-part-9' into next
gitster Nov 6, 2024
ee100e9
Merge branch 'ak/t1016-style' into next
gitster Nov 6, 2024
8c5d529
Merge branch 'en/shallow-exclude-takes-a-ref-fix' into next
gitster Nov 6, 2024
b4dd083
Merge branch 'jt/commit-graph-missing' into next
gitster Nov 6, 2024
6dd2fff
Merge branch 'ps/mingw-rename' into next
gitster Nov 6, 2024
60cca15
Sync with 'master'
gitster Nov 8, 2024
c49de5d
Sync with 'master'
gitster Nov 11, 2024
895d633
Merge branch 'jt/repack-local-promisor' into next
gitster Nov 12, 2024
9aa0331
Merge branch 'jk/test-malloc-debug-check' into next
gitster Nov 12, 2024
1af6d17
Merge branch 'ja/git-add-doc-markup' into next
gitster Nov 12, 2024
f038e22
Merge branch 'la/trailer-info' into next
gitster Nov 12, 2024
bc8a4e4
Sync with 'master'
gitster Nov 12, 2024
4f8a448
Merge branch 'jk/test-malloc-debug-check' into next
gitster Nov 15, 2024
178c112
Merge branch 'jk/fetch-prefetch-double-free-fix' into next
gitster Nov 15, 2024
a323438
Merge branch 'sm/difftool' into next
gitster Nov 15, 2024
3279229
Merge branch 'tb/multi-pack-reuse-dupfix' into next
gitster Nov 16, 2024
95f8e04
Sync with 'master'
gitster Nov 16, 2024
d70c2c3
Merge branch 'kh/bundle-docs' into next
gitster Nov 20, 2024
d88840a
Merge branch 'ps/clar-build-improvement' into next
gitster Nov 20, 2024
bd29255
Merge branch 'bc/c23' into next
gitster Nov 20, 2024
fa92bcd
Merge branch 'jk/gcc15' into next
gitster Nov 20, 2024
fad433e
Merge branch 'kh/trailer-in-glossary' into next
gitster Nov 20, 2024
751ee6b
Merge branch 'en/fast-import-avoid-self-replace' into next
gitster Nov 20, 2024
9bd7657
Merge branch 'jt/index-pack-allow-promisor-only-while-fetching' into …
gitster Nov 20, 2024
19ba395
Sync with 'master'
gitster Nov 20, 2024
2339988
Merge branch 'kn/ref-transaction-hook-with-reflog' into next
gitster Nov 20, 2024
1099c31
Merge branch 'ps/gc-stale-lock-warning' into next
gitster Nov 20, 2024
ff69ae1
Sync with 'master'
gitster Nov 22, 2024
7284f18
Merge branch 'ps/leakfixes-part-10' into next
gitster Nov 25, 2024
ee2e588
Merge branch 'ps/ref-backend-migration-optim' into next
gitster Nov 25, 2024
53e29ae
Merge branch 'sj/ref-contents-check' into next
gitster Nov 25, 2024
f312b2f
Merge branch 'tb/boundary-traversal-fix' into next
gitster Nov 25, 2024
2bdd016
Merge branch 'tb/use-test-file-size-more' into next
gitster Nov 25, 2024
dd8b44a
Sync with 'master'
gitster Nov 25, 2024
ed3858b
Merge branch 'ps/gc-stale-lock-warning' into next
gitster Nov 26, 2024
7bb66a1
Merge branch 'ps/ref-backend-migration-optim' into next
gitster Nov 26, 2024
8b145bb
Merge branch 'en/fast-import-path-sanitize' into next
gitster Nov 26, 2024
e163bce
Merge branch 'ps/bisect-double-free-fix' into next
gitster Nov 26, 2024
668c091
Merge branch 'kn/pass-repo-to-builtin-sub-sub-commands' into next
gitster Nov 26, 2024
aa7866a
Merge branch 'bc/drop-ancient-libcurl-and-perl' into next
gitster Nov 26, 2024
b33b5ae
Merge branch 'ja/git-diff-doc-markup' into next
gitster Nov 26, 2024
9683f9f
Sync with 'master'
gitster Nov 26, 2024
65eba16
Merge branch 'sj/refs-symref-referent-fix' into next
gitster Nov 28, 2024
84693f6
Merge branch 'kh/sequencer-comment-char' into next
gitster Nov 28, 2024
2932fa5
Merge branch 'en/fast-import-verify-path' into next
gitster Dec 2, 2024
f612874
Merge branch 'bc/ancient-ci' into next
gitster Dec 2, 2024
e345717
Merge branch 'jc/doc-opt-tilde-expand' into next
gitster Dec 2, 2024
b439b14
Merge branch 'pb/mergetool-errors' into next
gitster Dec 2, 2024
0f34109
Merge branch 'jk/describe-perf' into next
gitster Dec 2, 2024
bf711f0
Merge branch 'bc/allow-upload-pack-from-other-people' into next
gitster Dec 2, 2024
b142ff3
Merge branch 'bf/set-head-symref' into next
gitster Dec 2, 2024
e105e78
Merge branch 'ps/reftable-detach' into next
gitster Dec 2, 2024
3c1d2e2
Merge branch 'ps/reftable-iterator-reuse' into next
gitster Dec 2, 2024
69bfc59
Merge branch 'bf/fetch-set-head-config' (early part) into next
gitster Dec 4, 2024
bfd07a8
Merge branch 'jt/bundle-fsck' into next
gitster Dec 4, 2024
2d19ff4
Merge branch 'jc/doc-error-message-guidelines' into next
gitster Dec 4, 2024
5da441c
Merge branch 'kh/doc-bundle-typofix' into next
gitster Dec 4, 2024
9905f16
Merge branch 'kh/doc-update-ref-grammofix' into next
gitster Dec 4, 2024
a4f8a86
Sync with 'master'
gitster Dec 4, 2024
bbdd9b9
Merge branch 'en/fast-import-verify-path' into next
gitster Dec 5, 2024
1f973ae
Merge branch 'es/oss-fuzz' into next
gitster Dec 5, 2024
7bd98d1
Merge branch 'cw/worktree-extension' into next
gitster Dec 5, 2024
e48a185
Merge branch 'kn/midx-wo-the-repository' into next
gitster Dec 5, 2024
36d6c51
Merge branch 'kk/doc-ancestry-path' into next
gitster Dec 5, 2024
c27f4b7
Sync with 'master'
gitster Dec 6, 2024
adea889
Merge branch 'jc/forbid-head-as-tagname' into next
gitster Dec 10, 2024
900cadd
Merge branch 'bf/fetch-set-head-config' into next
gitster Dec 10, 2024
a20c319
Merge branch 'bf/explicit-config-set-in-advice-messages' into next
gitster Dec 10, 2024
509db1d
Merge branch 'jk/describe-perf' into next
gitster Dec 10, 2024
ddbfd88
Merge branch 'rj/strvec-splice-fix' into next
gitster Dec 10, 2024
da3d13a
Merge branch 'ps/commit-with-message-syntax-fix' into next
gitster Dec 10, 2024
5a40801
Merge branch 'jt/fix-fattening-promisor-fetch' into next
gitster Dec 10, 2024
cb270b3
Merge branch 'ps/build' into next
gitster Dec 11, 2024
f74b3f2
Sync with 'master'
gitster Dec 11, 2024
b71687c
git-submodule.sh: improve parsing of some long options
Dec 11, 2024
e6c3e34
git-submodule.sh: improve parsing of short options
Dec 11, 2024
006f546
git-submodule.sh: get rid of isnumber
Dec 11, 2024
402e46d
git-submodule.sh: get rid of unused variable
Dec 11, 2024
57f9b30
git-submodule.sh: add some comments
Dec 11, 2024
3ad0ba7
git-submodule.sh: improve variables readability
Dec 11, 2024
b86f0f9
git-submodule.sh: rename some variables
Dec 11, 2024
4784443
Merge branch 'jc/set-head-symref-fix' into next
gitster Dec 13, 2024
90156d7
Merge branch 'js/log-remerge-keep-ancestry' into next
gitster Dec 13, 2024
9f49e6f
Merge branch 'mh/doc-windows-home-env' into next
gitster Dec 13, 2024
7f4ebe0
Merge branch 'tc/bundle-with-tag-remove-workaround' into next
gitster Dec 13, 2024
23fc6f9
Sync with 'master'
gitster Dec 13, 2024
e0ca818
Merge branch 'ps/ci-gitlab-update' into next
gitster Dec 15, 2024
7e6b58d
Merge branch 'kn/reftable-writer-log-write-verify' into next
gitster Dec 16, 2024
1ddb148
Merge branch 'ps/build-sign-compare' into next
gitster Dec 16, 2024
b54e9a5
Merge branch 'as/show-index-uninitialized-hash' into next
gitster Dec 16, 2024
0fc57de
Sync with Git 2.48-rc0
gitster Dec 16, 2024
653a20d
Merge branch 'js/ps-build-cmake-fixup' into next
gitster Dec 17, 2024
6d59340
Merge branch 'js/github-windows-setup-fix' into next
gitster Dec 17, 2024
57dc9a0
Merge branch 'js/mingw-rename-fix' into next
gitster Dec 17, 2024
fc95a5a
Merge branch 'ps/ci-meson' into next
gitster Dec 17, 2024
d491657
Sync with 'master'
gitster Dec 18, 2024
5634446
Merge branch 'kn/reflog-migration' into next
gitster Dec 18, 2024
47394ea
Merge branch 'js/range-diff-diff-merges' into next
gitster Dec 19, 2024
5af85a7
Merge branch 'sk/calloc-not-malloc-plus-memset' into next
gitster Dec 19, 2024
3cddc25
Sync with 'master'
gitster Dec 19, 2024
f775554
Merge branch 'ps/build-meson-gitweb' into next
gitster Dec 21, 2024
11a5c3d
Merge branch 'jk/prio-queue-sign-compare-fix' into next
gitster Dec 21, 2024
1044634
Merge branch 'tb/bitmap-fix-pack-reuse' into next
gitster Dec 21, 2024
d6f8295
Merge branch 'kl/doc-build-fix' into next
gitster Dec 21, 2024
9e65a56
Merge branch 're/submodule-parse-opt' into next
gitster Dec 21, 2024
92bc55b
Merge branch 'ps/reftable-alloc-failures-zalloc-fix' into next
gitster Dec 22, 2024
0d4dfd1
Merge branch 'ps/build-hotfix' into next
gitster Dec 22, 2024
7a2aad7
Merge branch 'ma/asciidoctor-build-fixes' into next
gitster Dec 22, 2024
b75456b
Merge branch 'kn/reflog-migration' into next
gitster Dec 22, 2024
f2cfb42
Git 2.48-rc1
gitster Dec 23, 2024
73897bc
Sync with Git 2.48-rc1
gitster Dec 23, 2024
bde2763
Rename main.yml to main.yml
Mohammed-Alanazisa Dec 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion branch.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ void create_branch(struct repository *r,
else
msg = xstrfmt("branch: Created from %s", start_name);
transaction = ref_store_transaction_begin(get_main_ref_store(the_repository),
&err);
0, &err);
if (!transaction ||
ref_transaction_update(transaction, ref.buf,
&oid, forcing ? NULL : null_oid(),
Expand Down
4 changes: 2 additions & 2 deletions builtin/clone.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ static void write_remote_refs(const struct ref *local_refs)
struct strbuf err = STRBUF_INIT;

t = ref_store_transaction_begin(get_main_ref_store(the_repository),
&err);
REF_TRANSACTION_FLAG_INITIAL, &err);
if (!t)
die("%s", err.buf);

Expand All @@ -586,7 +586,7 @@ static void write_remote_refs(const struct ref *local_refs)
die("%s", err.buf);
}

if (initial_ref_transaction_commit(t, &err))
if (ref_transaction_commit(t, &err))
die("%s", err.buf);

strbuf_release(&err);
Expand Down
4 changes: 2 additions & 2 deletions builtin/fast-import.c
Original file line number Diff line number Diff line change
Expand Up @@ -1647,7 +1647,7 @@ static int update_branch(struct branch *b)
}
}
transaction = ref_store_transaction_begin(get_main_ref_store(the_repository),
&err);
0, &err);
if (!transaction ||
ref_transaction_update(transaction, b->name, &b->oid, &old_oid,
NULL, NULL, 0, msg, &err) ||
Expand Down Expand Up @@ -1682,7 +1682,7 @@ static void dump_tags(void)
struct ref_transaction *transaction;

transaction = ref_store_transaction_begin(get_main_ref_store(the_repository),
&err);
0, &err);
if (!transaction) {
failure |= error("%s", err.buf);
goto cleanup;
Expand Down
4 changes: 2 additions & 2 deletions builtin/fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ static int s_update_ref(const char *action,
*/
if (!transaction) {
transaction = our_transaction = ref_store_transaction_begin(get_main_ref_store(the_repository),
&err);
0, &err);
if (!transaction) {
ret = STORE_REF_ERROR_OTHER;
goto out;
Expand Down Expand Up @@ -1667,7 +1667,7 @@ static int do_fetch(struct transport *transport,

if (atomic_fetch) {
transaction = ref_store_transaction_begin(get_main_ref_store(the_repository),
&err);
0, &err);
if (!transaction) {
retcode = -1;
goto cleanup;
Expand Down
4 changes: 2 additions & 2 deletions builtin/receive-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -1849,7 +1849,7 @@ static void execute_commands_non_atomic(struct command *commands,
continue;

transaction = ref_store_transaction_begin(get_main_ref_store(the_repository),
&err);
0, &err);
if (!transaction) {
rp_error("%s", err.buf);
strbuf_reset(&err);
Expand Down Expand Up @@ -1878,7 +1878,7 @@ static void execute_commands_atomic(struct command *commands,
const char *reported_error = "atomic push failure";

transaction = ref_store_transaction_begin(get_main_ref_store(the_repository),
&err);
0, &err);
if (!transaction) {
rp_error("%s", err.buf);
strbuf_reset(&err);
Expand Down
2 changes: 1 addition & 1 deletion builtin/replace.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ static int replace_object_oid(const char *object_ref,
}

transaction = ref_store_transaction_begin(get_main_ref_store(the_repository),
&err);
0, &err);
if (!transaction ||
ref_transaction_update(transaction, ref.buf, repl, &prev,
NULL, NULL, 0, NULL, &err) ||
Expand Down
2 changes: 1 addition & 1 deletion builtin/tag.c
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ int cmd_tag(int argc,
}

transaction = ref_store_transaction_begin(get_main_ref_store(the_repository),
&err);
0, &err);
if (!transaction ||
ref_transaction_update(transaction, ref.buf, &object, &prev,
NULL, NULL,
Expand Down
4 changes: 2 additions & 2 deletions builtin/update-ref.c
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ static void update_refs_stdin(void)
int i, j;

transaction = ref_store_transaction_begin(get_main_ref_store(the_repository),
&err);
0, &err);
if (!transaction)
die("%s", err.buf);

Expand Down Expand Up @@ -680,7 +680,7 @@ static void update_refs_stdin(void)
*/
state = cmd->state;
transaction = ref_store_transaction_begin(get_main_ref_store(the_repository),
&err);
0, &err);
if (!transaction)
die("%s", err.buf);

Expand Down
70 changes: 32 additions & 38 deletions refs.c
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ int refs_delete_ref(struct ref_store *refs, const char *msg,
struct ref_transaction *transaction;
struct strbuf err = STRBUF_INIT;

transaction = ref_store_transaction_begin(refs, &err);
transaction = ref_store_transaction_begin(refs, 0, &err);
if (!transaction ||
ref_transaction_delete(transaction, refname, old_oid,
NULL, flags, msg, &err) ||
Expand Down Expand Up @@ -1116,13 +1116,15 @@ int read_ref_at(struct ref_store *refs, const char *refname,
}

struct ref_transaction *ref_store_transaction_begin(struct ref_store *refs,
unsigned int flags,
struct strbuf *err)
{
struct ref_transaction *tr;
assert(err);

CALLOC_ARRAY(tr, 1);
tr->ref_store = refs;
tr->flags = flags;
return tr;
}

Expand Down Expand Up @@ -1186,8 +1188,9 @@ struct ref_update *ref_transaction_add_update(
oidcpy(&update->new_oid, new_oid);
if ((flags & REF_HAVE_OLD) && old_oid)
oidcpy(&update->old_oid, old_oid);
if (!(flags & REF_SKIP_CREATE_REFLOG))
update->msg = normalize_reflog_message(msg);

update->msg = normalize_reflog_message(msg);
return update;
}

Expand Down Expand Up @@ -1309,7 +1312,7 @@ int refs_update_ref(struct ref_store *refs, const char *msg,
struct strbuf err = STRBUF_INIT;
int ret = 0;

t = ref_store_transaction_begin(refs, &err);
t = ref_store_transaction_begin(refs, 0, &err);
if (!t ||
ref_transaction_update(t, refname, new_oid, old_oid, NULL, NULL,
flags, msg, &err) ||
Expand Down Expand Up @@ -2120,7 +2123,7 @@ int refs_update_symref(struct ref_store *refs, const char *ref,
struct strbuf err = STRBUF_INIT;
int ret = 0;

transaction = ref_store_transaction_begin(refs, &err);
transaction = ref_store_transaction_begin(refs, 0, &err);
if (!transaction ||
ref_transaction_update(transaction, ref, NULL, NULL,
target, NULL, REF_NO_DEREF,
Expand Down Expand Up @@ -2316,7 +2319,7 @@ int ref_transaction_commit(struct ref_transaction *transaction,
}

ret = refs->be->transaction_finish(refs, transaction, err);
if (!ret)
if (!ret && !(transaction->flags & REF_TRANSACTION_FLAG_INITIAL))
run_transaction_hook(transaction, "committed");
return ret;
}
Expand All @@ -2325,6 +2328,7 @@ int refs_verify_refname_available(struct ref_store *refs,
const char *refname,
const struct string_list *extras,
const struct string_list *skip,
int initial_transaction,
struct strbuf *err)
{
const char *slash;
Expand All @@ -2333,8 +2337,6 @@ int refs_verify_refname_available(struct ref_store *refs,
struct strbuf referent = STRBUF_INIT;
struct object_id oid;
unsigned int type;
struct ref_iterator *iter;
int ok;
int ret = -1;

/*
Expand Down Expand Up @@ -2364,7 +2366,8 @@ int refs_verify_refname_available(struct ref_store *refs,
if (skip && string_list_has_string(skip, dirname.buf))
continue;

if (!refs_read_raw_ref(refs, dirname.buf, &oid, &referent,
if (!initial_transaction &&
!refs_read_raw_ref(refs, dirname.buf, &oid, &referent,
&type, &ignore_errno)) {
strbuf_addf(err, _("'%s' exists; cannot create '%s'"),
dirname.buf, refname);
Expand All @@ -2389,21 +2392,26 @@ int refs_verify_refname_available(struct ref_store *refs,
strbuf_addstr(&dirname, refname + dirname.len);
strbuf_addch(&dirname, '/');

iter = refs_ref_iterator_begin(refs, dirname.buf, NULL, 0,
DO_FOR_EACH_INCLUDE_BROKEN);
while ((ok = ref_iterator_advance(iter)) == ITER_OK) {
if (skip &&
string_list_has_string(skip, iter->refname))
continue;
if (!initial_transaction) {
struct ref_iterator *iter;
int ok;

strbuf_addf(err, _("'%s' exists; cannot create '%s'"),
iter->refname, refname);
ref_iterator_abort(iter);
goto cleanup;
}
iter = refs_ref_iterator_begin(refs, dirname.buf, NULL, 0,
DO_FOR_EACH_INCLUDE_BROKEN);
while ((ok = ref_iterator_advance(iter)) == ITER_OK) {
if (skip &&
string_list_has_string(skip, iter->refname))
continue;

strbuf_addf(err, _("'%s' exists; cannot create '%s'"),
iter->refname, refname);
ref_iterator_abort(iter);
goto cleanup;
}

if (ok != ITER_DONE)
BUG("error while iterating over references");
if (ok != ITER_DONE)
BUG("error while iterating over references");
}

extra_refname = find_descendant_ref(dirname.buf, extras, skip);
if (extra_refname)
Expand Down Expand Up @@ -2487,14 +2495,6 @@ int refs_reflog_expire(struct ref_store *refs,
cleanup_fn, policy_cb_data);
}

int initial_ref_transaction_commit(struct ref_transaction *transaction,
struct strbuf *err)
{
struct ref_store *refs = transaction->ref_store;

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)
Expand Down Expand Up @@ -2530,7 +2530,7 @@ int refs_delete_refs(struct ref_store *refs, const char *logmsg,
* individual updates can't fail, so we can pack all of the
* updates into a single transaction.
*/
transaction = ref_store_transaction_begin(refs, &err);
transaction = ref_store_transaction_begin(refs, 0, &err);
if (!transaction) {
ret = error("%s", err.buf);
goto out;
Expand Down Expand Up @@ -2836,7 +2836,8 @@ int repo_migrate_ref_storage_format(struct repository *repo,
if (ret < 0)
goto done;

transaction = ref_store_transaction_begin(new_refs, errbuf);
transaction = ref_store_transaction_begin(new_refs, REF_TRANSACTION_FLAG_INITIAL,
errbuf);
if (!transaction)
goto done;

Expand All @@ -2861,13 +2862,6 @@ int repo_migrate_ref_storage_format(struct repository *repo,
if (ret < 0)
goto done;

/*
* TODO: we might want to migrate to `initial_ref_transaction_commit()`
* here, which is more efficient for the files backend because it would
* write new refs into the packed-refs file directly. At this point,
* the files backend doesn't handle pseudo-refs and symrefs correctly
* though, so this requires some more work.
*/
ret = ref_transaction_commit(transaction, errbuf);
if (ret < 0)
goto done;
Expand Down
45 changes: 24 additions & 21 deletions refs.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,16 @@ int refs_read_symbolic_ref(struct ref_store *ref_store, const char *refname,
* both "foo" and with "foo/bar/baz" but not with "foo/bar" or
* "foo/barbados".
*
* If `initial_transaction` is truish, then all collision checks with
* preexisting refs are skipped.
*
* extras and skip must be sorted.
*/

int refs_verify_refname_available(struct ref_store *refs,
const char *refname,
const struct string_list *extras,
const struct string_list *skip,
int initial_transaction,
struct strbuf *err);

int refs_ref_exists(struct ref_store *refs, const char *refname);
Expand Down Expand Up @@ -214,11 +217,9 @@ char *repo_default_branch_name(struct repository *r, int quiet);
*
* Or
*
* - Call `initial_ref_transaction_commit()` if the ref database is
* known to be empty and have no other writers (e.g. during
* clone). This is likely to be much faster than
* `ref_transaction_commit()`. `ref_transaction_prepare()` should
* *not* be called before `initial_ref_transaction_commit()`.
* - Call `ref_transaction_begin()` with REF_TRANSACTION_FLAG_INITIAL if the
* ref database is known to be empty and have no other writers (e.g. during
* clone). This is likely to be much faster than without the flag.
*
* - Then finally, call `ref_transaction_free()` to free the
* `ref_transaction` data structure.
Expand All @@ -234,7 +235,7 @@ char *repo_default_branch_name(struct repository *r, int quiet);
* struct strbuf err = STRBUF_INIT;
* int ret = 0;
*
* transaction = ref_store_transaction_begin(refs, &err);
* transaction = ref_store_transaction_begin(refs, 0, &err);
* if (!transaction ||
* ref_transaction_update(...) ||
* ref_transaction_create(...) ||
Expand Down Expand Up @@ -579,11 +580,27 @@ enum action_on_err {
UPDATE_REFS_QUIET_ON_ERR
};

enum ref_transaction_flag {
/*
* The ref transaction is part of the initial creation of the ref store
* and can thus assume that the ref store is completely empty. This
* allows the backend to perform the transaction more efficiently by
* skipping certain checks.
*
* It is a bug to set this flag when there might be other processes
* accessing the repository or if there are existing references that
* might conflict with the ones being created. All old_oid values must
* either be absent or null_oid.
*/
REF_TRANSACTION_FLAG_INITIAL = (1 << 0),
};

/*
* Begin a reference transaction. The reference transaction must
* be freed by calling ref_transaction_free().
*/
struct ref_transaction *ref_store_transaction_begin(struct ref_store *refs,
unsigned int flags,
struct strbuf *err);

/*
Expand Down Expand Up @@ -797,20 +814,6 @@ int ref_transaction_commit(struct ref_transaction *transaction,
int ref_transaction_abort(struct ref_transaction *transaction,
struct strbuf *err);

/*
* Like ref_transaction_commit(), but optimized for creating
* references when originally initializing a repository (e.g., by "git
* clone"). It writes the new references directly to packed-refs
* without locking the individual references.
*
* It is a bug to call this function when there might be other
* processes accessing the repository or if there are existing
* references that might conflict with the ones being created. All
* old_oid values must either be absent or null_oid.
*/
int initial_ref_transaction_commit(struct ref_transaction *transaction,
struct strbuf *err);

/*
* Execute the given callback function for each of the reference updates which
* have been queued in the given transaction. `old_oid` and `new_oid` may be
Expand Down
Loading