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>
Shawn Pearce committed
May 19, 2006 at 05:15 UTC
8fe92775f38621f2855fb94e404b9798cdcd98cc
1 file changed
+1
-1
refs.c
+1
-1
@@ -305,7 +305,7 @@ static struct ref_lock* lock_ref_sha1_basic(const char *path,
305
lock->ref_file = strdup(path);
306
lock->lock_file = strdup(mkpath("%s.lock", lock->ref_file));
307
lock->log_file = strdup(git_path("logs/%s", lock->ref_file + plen));
308
- lock->force_write = !lstat(lock->ref_file, &st) || errno == ENOENT;
308
+ lock->force_write = lstat(lock->ref_file, &st) && errno == ENOENT;
309
310
if (safe_create_leading_directories(lock->lock_file))
311
die("unable to create directory for %s", lock->lock_file);