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;
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.
*
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$
}
private boolean searchPacksAgain(PackList old) {
- return old.snapshot.isModified(packDirectory) && old != scanPacks(old);
+ return ((!trustFolderStat) || old.snapshot.isModified(packDirectory))
+ && old != scanPacks(old);
}
Config getConfig() {