{"thread":{"id":"4207","subject":"[PATCH 1/5] Correct force_write bug in refs.c","startedAt":"2006-05-19T09:15:28Z","lastAt":"2006-05-19T09:15:28Z","messageCount":1,"participants":["Shawn Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"20281","messageId":"20060519091528.GI22257@spearce.org","threadId":"4207","inReplyTo":null,"subject":"[PATCH 1/5] Correct force_write bug in refs.c","fromName":"Shawn Pearce","fromEmail":"spearce@spearce.org","sentAt":"2006-05-19T09:15:28Z","receivedAt":"2006-05-19T09:15:28Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"My earlier attempt at forcing a write for non-existant refs worked;\nit forced a write for pretty much all refs.  This corrects the\ncondition to only force a write for refs which don't exist yet.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n\n---\n\n refs.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\n5ee16115982c52fa9b8fa15c14b234608a8b935d\ndiff --git a/refs.c b/refs.c\nindex d3ddc82..eeb1196 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -305,7 +305,7 @@ static struct ref_lock* lock_ref_sha1_ba\n \tlock->ref_file = strdup(path);\n \tlock->lock_file = strdup(mkpath(\"%s.lock\", lock->ref_file));\n \tlock->log_file = strdup(git_path(\"logs/%s\", lock->ref_file + plen));\n-\tlock->force_write = !lstat(lock->ref_file, &st) || errno == ENOENT;\n+\tlock->force_write = lstat(lock->ref_file, &st) && errno == ENOENT;\n \n \tif (safe_create_leading_directories(lock->lock_file))\n \t\tdie(\"unable to create directory for %s\", lock->lock_file);\n-- \n1.3.2.g7278\n"}]}