aboutsummaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorShawn Pearce <spearce@spearce.org>2006-05-19 05:15:28 -0400
committerJunio C Hamano <junkio@cox.net>2006-05-19 15:02:59 -0700
commit8fe92775f38621f2855fb94e404b9798cdcd98cc (patch)
treee4282f353528dc708257f9c162dfb2b0f4622ad4 /refs.c
parentcce91a2caef9296bd4a69e51e48f1d679935d868 (diff)
downloadgit-8fe92775f38621f2855fb94e404b9798cdcd98cc.tar.gz
git-8fe92775f38621f2855fb94e404b9798cdcd98cc.tar.xz
Correct force_write bug in refs.c
My earlier attempt at forcing a write for non-existant refs worked; it forced a write for pretty much all refs. This corrects the condition to only force a write for refs which don't exist yet. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/refs.c b/refs.c
index d3ddc82d2..eeb1196ec 100644
--- a/refs.c
+++ b/refs.c
@@ -305,7 +305,7 @@ static struct ref_lock* lock_ref_sha1_basic(const char *path,
lock->ref_file = strdup(path);
lock->lock_file = strdup(mkpath("%s.lock", lock->ref_file));
lock->log_file = strdup(git_path("logs/%s", lock->ref_file + plen));
- lock->force_write = !lstat(lock->ref_file, &st) || errno == ENOENT;
+ lock->force_write = lstat(lock->ref_file, &st) && errno == ENOENT;
if (safe_create_leading_directories(lock->lock_file))
die("unable to create directory for %s", lock->lock_file);