git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Robin Rosenberg <robin.rosenberg.lists@dewire.com>
Cc: Mark Struberg <struberg@yahoo.de>, git@vger.kernel.org
Subject: Re: [PATCH] Create $GIT_DIR/objects/pack if missing during renameAndOpenPack
Date: Sun, 10 May 2009 16:03:41 -0700	[thread overview]
Message-ID: <20090510230341.GG30527@spearce.org> (raw)
In-Reply-To: <200905110059.50494.robin.rosenberg.lists@dewire.com>

Robin Rosenberg <robin.rosenberg.lists@dewire.com> wrote:
> s?ndag 10 maj 2009 23:30:46 skrev "Shawn O. Pearce" <spearce@spearce.org>:
> > diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/IndexPack.java b/org.spearce.jgit/src/org/spearce/jgit/transport/IndexPack.java
> > index b2bcbb7..1eb40d4 100644
> > --- a/org.spearce.jgit/src/org/spearce/jgit/transport/IndexPack.java
> > +++ b/org.spearce.jgit/src/org/spearce/jgit/transport/IndexPack.java
> > @@ -1037,6 +1037,14 @@ public PackLock renameAndOpenPack(final String lockMessage)
> >  		final File finalIdx = new File(packDir, "pack-" + name + ".idx");
> >  		final PackLock keep = new PackLock(finalPack);
> >  
> > +		if (!packDir.exists() && !packDir.mkdir() && !packDir.exists()) {
> 
> Is there a lot to gain by this instead of just if (!packDir.mkdir() && !packDir.exists()) ?

No, not really.  But usually the directory exists, its rare when
it doesn't.

We probably just wasted more CPU time in our MUAs debating this than
it really costs in the long run.  I'm too #@!** lazy to go back
and amend this patch.  But you can amend it if it really bothers
you to do the "!exists && !mkdir && !exists".

-- 
Shawn.

      reply	other threads:[~2009-05-10 23:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-09 20:40 [JGIT] exception while pushing if no objects/pack directory exists in origin repo Mark Struberg
2009-05-10 21:30 ` [PATCH] Create $GIT_DIR/objects/pack if missing during renameAndOpenPack Shawn O. Pearce
2009-05-10 22:59   ` Robin Rosenberg
2009-05-10 23:03     ` Shawn O. Pearce [this message]

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=20090510230341.GG30527@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=robin.rosenberg.lists@dewire.com \
    --cc=struberg@yahoo.de \
    /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).