summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2015-01-23 12:04:02 -0800
committerJunio C Hamano <gitster@pobox.com>2015-01-23 15:20:19 -0800
commit79370dd9656a229b81a188917ac074c9df2c788f (patch)
treecb582a6171a3db9abc18ab93431b41281a09cca2 /refs.c
parent3c657a791a5d8da23aaabe2897d4988d7ca5ba0a (diff)
downloadgit-sb/atomic-push-fix.tar.gz
refs.c: enable large transactionssb/atomic-push-fix
By closing the file descriptors after creating the lock file we are not limiting the size of the transaction by the number of available file descriptors. When closing the file descriptors early, we also need to write the values in early, if we don't want to reopen the files. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/refs.c b/refs.c
index 1bfc84b3e1..2594b2336f 100644
--- a/refs.c
+++ b/refs.c
@@ -3752,6 +3752,17 @@ int ref_transaction_commit(struct ref_transaction *transaction,
update->refname);
goto cleanup;
}
+ if (!is_null_sha1(update->new_sha1)) {
+ if (write_ref_sha1(update->lock, update->new_sha1,
+ update->msg)) {
+ strbuf_addf(err, "Cannot write to the ref lock '%s'.",
+ update->refname);
+ ret = TRANSACTION_GENERIC_ERROR;
+ goto cleanup;
+ }
+ }
+ /* Do not keep all lock files open at the same time. */
+ close_ref(update->lock);
}
/* Perform updates first so live commits remain referenced */
@@ -3759,9 +3770,7 @@ int ref_transaction_commit(struct ref_transaction *transaction,
struct ref_update *update = updates[i];
if (!is_null_sha1(update->new_sha1)) {
- if (write_ref_sha1(update->lock, update->new_sha1,
- update->msg)
- || commit_ref(update->lock, update->new_sha1)) {
+ if (commit_ref(update->lock, update->new_sha1)) {
strbuf_addf(err, "Cannot update the ref '%s'.",
update->refname);
ret = TRANSACTION_GENERIC_ERROR;