diff options
author | Christian Halstrick <christian.halstrick@sap.com> | 2014-12-05 14:39:18 +0100 |
---|---|---|
committer | Christian Halstrick <christian.halstrick@sap.com> | 2014-12-05 14:39:45 +0100 |
commit | 1b9130e8dbc5c5703ef5f03ade5106d83a105ba2 (patch) | |
tree | a2825a67fead73ebfec25b910c11d50c0c6090a9 | |
parent | c9a5fdb3cd92d5774aa7041b9fc9fc579dc26edc (diff) | |
download | jgit-1b9130e8dbc5c5703ef5f03ade5106d83a105ba2.tar.gz jgit-1b9130e8dbc5c5703ef5f03ade5106d83a105ba2.zip |
Make sure modifications to config-param trustFolderStat are detected
ObjectDirectory.searchPacksAgain() should always read trustFolderStat
from the config and not rely on a cached value.
Change-Id: I90edbaae3c64eea0c9894d05acde4267991575ee
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java | 21 |
1 files changed, 10 insertions, 11 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 48a6b9d677..58276051ea 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 @@ -131,14 +131,6 @@ 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. * @@ -161,9 +153,6 @@ 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$ @@ -618,6 +607,16 @@ public class ObjectDirectory extends FileObjectDatabase { } private boolean searchPacksAgain(PackList old) { + // 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. + boolean trustFolderStat = config.getBoolean( + ConfigConstants.CONFIG_CORE_SECTION, + ConfigConstants.CONFIG_KEY_TRUSTFOLDERSTAT, true); + return ((!trustFolderStat) || old.snapshot.isModified(packDirectory)) && old != scanPacks(old); } |