Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Turner <dturner@twopensource.com>2016-02-25 01:58:50 +0300
committerMichael Haggerty <mhagger@alum.mit.edu>2016-06-13 12:23:49 +0300
commitd99aa884dff33d48d5aab8c9cf989a25c779fd70 (patch)
tree9ae35d12fba5766557c1f6c39961809083bcb78d /refs/files-backend.c
parent8bb0455367a17bd7428e02f835e3f55c8cd168da (diff)
refs: allow log-only updates
The refs infrastructure learns about log-only ref updates, which only update the reflog. Later, we will use this to separate symbolic reference resolution from ref updating. Signed-off-by: David Turner <dturner@twopensource.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Diffstat (limited to 'refs/files-backend.c')
-rw-r--r--refs/files-backend.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/refs/files-backend.c b/refs/files-backend.c
index 85e1e1c759..2f98eebe94 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -2683,7 +2683,7 @@ static int commit_ref_update(struct ref_lock *lock,
}
}
}
- if (commit_ref(lock)) {
+ if (!(flags & REF_LOG_ONLY) && commit_ref(lock)) {
strbuf_addf(err, "couldn't set '%s'", lock->ref_name);
unlock_ref(lock);
return -1;
@@ -3101,7 +3101,8 @@ int ref_transaction_commit(struct ref_transaction *transaction,
goto cleanup;
}
if ((update->flags & REF_HAVE_NEW) &&
- !(update->flags & REF_DELETING)) {
+ !(update->flags & REF_DELETING) &&
+ !(update->flags & REF_LOG_ONLY)) {
int overwriting_symref = ((update->type & REF_ISSYMREF) &&
(update->flags & REF_NODEREF));
@@ -3133,8 +3134,9 @@ int ref_transaction_commit(struct ref_transaction *transaction,
}
if (!(update->flags & REF_NEEDS_COMMIT)) {
/*
- * We didn't have to write anything to the lockfile.
- * Close it to free up the file descriptor:
+ * We didn't call write_ref_to_lockfile(), so
+ * the lockfile is still open. Close it to
+ * free up the file descriptor:
*/
if (close_ref(update->lock)) {
strbuf_addf(err, "couldn't close '%s.lock'",
@@ -3149,7 +3151,8 @@ int ref_transaction_commit(struct ref_transaction *transaction,
for (i = 0; i < transaction->nr; i++) {
struct ref_update *update = transaction->updates[i];
- if (update->flags & REF_NEEDS_COMMIT) {
+ if (update->flags & REF_NEEDS_COMMIT ||
+ update->flags & REF_LOG_ONLY) {
if (commit_ref_update(update->lock,
update->new_sha1, update->msg,
update->flags, err)) {
@@ -3168,7 +3171,8 @@ int ref_transaction_commit(struct ref_transaction *transaction,
for (i = 0; i < transaction->nr; i++) {
struct ref_update *update = transaction->updates[i];
- if (update->flags & REF_DELETING) {
+ if (update->flags & REF_DELETING &&
+ !(update->flags & REF_LOG_ONLY)) {
if (delete_ref_loose(update->lock, update->type, err)) {
ret = TRANSACTION_GENERIC_ERROR;
goto cleanup;