Git development
 help / color / mirror / Atom feed
From: Shawn Pearce <spearce@spearce.org>
To: Junio Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: [PATCH 1/5] Correct force_write bug in refs.c
Date: Fri, 19 May 2006 05:15:28 -0400	[thread overview]
Message-ID: <20060519091528.GI22257@spearce.org> (raw)

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>

---

 refs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

5ee16115982c52fa9b8fa15c14b234608a8b935d
diff --git a/refs.c b/refs.c
index d3ddc82..eeb1196 100644
--- a/refs.c
+++ b/refs.c
@@ -305,7 +305,7 @@ static struct ref_lock* lock_ref_sha1_ba
 	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);
-- 
1.3.2.g7278

                 reply	other threads:[~2006-05-19  9:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060519091528.GI22257@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox