Thread (4 messages) 4 messages, 3 authors, 2016-06-15

Re: [PATCH] Create $GIT_DIR/objects/pack if missing during renameAndOpenPack

From: Shawn O. Pearce <hidden>
Date: 2016-06-15 22:46:44

Robin Rosenberg [off-list ref] wrote:
s?ndag 10 maj 2009 23:30:46 skrev "Shawn O. Pearce" [off-list ref]:
quoted
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help