summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java15
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java6
2 files changed, 20 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java
index 882f5c8a45..48a6b9d677 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java
@@ -72,6 +72,7 @@ import org.eclipse.jgit.internal.storage.pack.PackWriter;
import org.eclipse.jgit.lib.AbbreviatedObjectId;
import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.Config;
+import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectDatabase;
import org.eclipse.jgit.lib.ObjectId;
@@ -130,6 +131,14 @@ public class ObjectDirectory extends FileObjectDatabase {
private Set<ObjectId> shallowCommitsIds;
+ // Whether to trust the pack folder's modification time. If set
+ // to false we will always scan the .git/objects/pack folder to
+ // check for new pack files. If set to true (default) we use the
+ // lastmodified attribute of the folder and assume that no new
+ // pack files can be in this folder if his modification time has
+ // not changed.
+ private boolean trustFolderStat = true;
+
/**
* Initialize a reference to an on-disk object directory.
*
@@ -152,6 +161,9 @@ public class ObjectDirectory extends FileObjectDatabase {
File[] alternatePaths, FS fs, File shallowFile) throws IOException {
config = cfg;
objects = dir;
+ trustFolderStat = config.getBoolean(
+ ConfigConstants.CONFIG_CORE_SECTION,
+ ConfigConstants.CONFIG_KEY_TRUSTFOLDERSTAT, true);
infoDirectory = new File(objects, "info"); //$NON-NLS-1$
packDirectory = new File(objects, "pack"); //$NON-NLS-1$
alternatesFile = new File(infoDirectory, "alternates"); //$NON-NLS-1$
@@ -606,7 +618,8 @@ public class ObjectDirectory extends FileObjectDatabase {
}
private boolean searchPacksAgain(PackList old) {
- return old.snapshot.isModified(packDirectory) && old != scanPacks(old);
+ return ((!trustFolderStat) || old.snapshot.isModified(packDirectory))
+ && old != scanPacks(old);
}
Config getConfig() {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
index 8eeb2edaf5..ccbfed720a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
@@ -258,6 +258,12 @@ public class ConfigConstants {
public static final String CONFIG_KEY_RENAMELIMIT = "renamelimit";
/**
+ * The "trustfolderstat" key in the "core section"
+ * @since 3.6
+ */
+ public static final String CONFIG_KEY_TRUSTFOLDERSTAT = "trustfolderstat";
+
+ /**
* The "noprefix" key in the "diff section"
* @since 3.0
*/