git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shawn Pearce <spearce@spearce.org>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org, Fredrik Kuivinen <freku045@student.liu.se>
Subject: Re: [PATCH] Better error message when we are unable to lock the index file
Date: Sat, 12 Aug 2006 13:16:26 -0400	[thread overview]
Message-ID: <20060812171626.GA18401@spearce.org> (raw)
In-Reply-To: <7v4pwiqss7.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano <junkio@cox.net> wrote:
> Junio C Hamano <junkio@cox.net> writes:
> 
> > Looking at output from:
> >
> > 	$ git grep -A 3 hold_lock_file_for_update
> >
> > I wonder if it might be more consistent to do something like
> > this instead.  It removes more lines than it adds ;-).
> >
> > Most of the callers except the one in refs.c use the function to
> > update the index file.  Among the index writers, everybody
> > except write-tree dies if they cannot open it for writing.
> >
> > diff --git a/refs.c b/refs.c
> > index 28a9394..564f8a7 100644
> > --- a/refs.c
> > +++ b/refs.c
> > @@ -319,7 +319,7 @@ static struct ref_lock *lock_ref_sha1_ba
> >  
> >  	if (safe_create_leading_directories(lock->ref_file))
> >  		die("unable to create directory for %s", lock->ref_file);
> > -	lock->lock_fd = hold_lock_file_for_update(lock->lk, lock->ref_file);
> > +	lock->lock_fd = hold_lock_file_for_update(lock->lk, lock->ref_file, 0);
> >  	if (lock->lock_fd < 0) {
> >  		error("Couldn't open lock file %s: %s",
> >  		      lock->lk->filename, strerror(errno));
> 
> Looking at this part further, it seems that this one could
> simply die when it fails -- after all it dies when leading
> directories cannot be created, so dying upon failure of
> hold_lock_file_for_update() would be consistent ;-).

Agreed.

-- 
Shawn.

  reply	other threads:[~2006-08-12 17:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-12  7:37 [PATCH] Better error message when we are unable to lock the index file Fredrik Kuivinen
2006-08-12  8:03 ` Junio C Hamano
2006-08-12  8:09   ` Junio C Hamano
2006-08-12 17:16     ` Shawn Pearce [this message]
2006-08-12 19:19   ` Fredrik Kuivinen

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=20060812171626.GA18401@spearce.org \
    --to=spearce@spearce.org \
    --cc=freku045@student.liu.se \
    --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;
as well as URLs for NNTP newsgroup(s).