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
path: root/refs.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-10-22 04:58:11 +0400
committerJunio C Hamano <gitster@pobox.com>2008-10-22 04:58:11 +0400
commita157400c972bbdeab2b5629658c99839c855f5ab (patch)
tree95c9ae9bf86dcc6e2bd4a3b0b217f5bef8622b59 /refs.c
parent6af50f7536d559f891d08597203ba605726511d6 (diff)
parentacd3b9eca82e38950f94e4708b528b7dae09a7c8 (diff)
Merge branch 'jc/maint-co-track'
* jc/maint-co-track: Enhance hold_lock_file_for_{update,append}() API demonstrate breakage of detached checkout with symbolic link HEAD Fix "checkout --track -b newbranch" on detached HEAD Conflicts: builtin-commit.c
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/refs.c b/refs.c
index b6807505e2..0a126fa371 100644
--- a/refs.c
+++ b/refs.c
@@ -796,7 +796,7 @@ static struct ref_lock *lock_ref_sha1_basic(const char *ref, const unsigned char
struct ref_lock *lock;
struct stat st;
int last_errno = 0;
- int type;
+ int type, lflags;
int mustexist = (old_sha1 && !is_null_sha1(old_sha1));
lock = xcalloc(1, sizeof(struct ref_lock));
@@ -836,8 +836,11 @@ static struct ref_lock *lock_ref_sha1_basic(const char *ref, const unsigned char
lock->lk = xcalloc(1, sizeof(struct lock_file));
- if (flags & REF_NODEREF)
+ lflags = LOCK_DIE_ON_ERROR;
+ if (flags & REF_NODEREF) {
ref = orig_ref;
+ lflags |= LOCK_NODEREF;
+ }
lock->ref_name = xstrdup(ref);
lock->orig_ref_name = xstrdup(orig_ref);
ref_file = git_path("%s", ref);
@@ -851,8 +854,8 @@ static struct ref_lock *lock_ref_sha1_basic(const char *ref, const unsigned char
error("unable to create directory for %s", ref_file);
goto error_return;
}
- lock->lock_fd = hold_lock_file_for_update(lock->lk, ref_file, 1);
+ lock->lock_fd = hold_lock_file_for_update(lock->lk, ref_file, lflags);
return old_sha1 ? verify_lock(lock, old_sha1, mustexist) : lock;
error_return: