提交 8fe92775 编写于 作者: S Shawn Pearce 提交者: Junio C Hamano

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: NShawn O. Pearce <spearce@spearce.org>
Signed-off-by: NJunio C Hamano <junkio@cox.net>
上级 cce91a2c
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册