diff options
author | Shawn Pearce <spearce@spearce.org> | 2014-03-12 17:04:08 -0700 |
---|---|---|
committer | Shawn Pearce <spearce@spearce.org> | 2014-03-12 17:15:42 -0700 |
commit | 3d412827e55fb43bdc2ae7475a3e54c92a55ad5e (patch) | |
tree | b28a1fcfd33c1d8dc96d68e598460f155dde473c | |
parent | ced58a7cff03654024bd9f154cfea2bd9459d39c (diff) | |
download | jgit-3d412827e55fb43bdc2ae7475a3e54c92a55ad5e.tar.gz jgit-3d412827e55fb43bdc2ae7475a3e54c92a55ad5e.zip |
Allow configuration of receive pack's ObjectChecker through fsck.*
fsck.allowLeadingZeroFileMode may be set true to permit pushing
broken trees with leading '0' in the file mode.
fsck.safeForWindows may be set true to require new trees to have
only file names that are safe on the Windows platform.
fsck.safeForMacOS may be set true to require new trees to have
only file names that do not cause collisions or confusion on the
Mac OS platform.
Change-Id: I1a225c1b3cd13c0d1a0d43fffe79355c501f49b7
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java index 0c83ece29c..ff45b1cda3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java @@ -255,7 +255,7 @@ public abstract class BaseReceivePack { walk = new RevWalk(db); final ReceiveConfig cfg = db.getConfig().get(ReceiveConfig.KEY); - objectChecker = cfg.checkReceivedObjects ? new ObjectChecker() : null; + objectChecker = cfg.newObjectChecker(); allowCreates = cfg.allowCreates; allowDeletes = cfg.allowDeletes; allowNonFastForwards = cfg.allowNonFastForwards; @@ -274,19 +274,26 @@ public abstract class BaseReceivePack { }; final boolean checkReceivedObjects; + final boolean allowLeadingZeroFileMode; + final boolean safeForWindows; + final boolean safeForMacOS; final boolean allowCreates; - final boolean allowDeletes; - final boolean allowNonFastForwards; - final boolean allowOfsDelta; ReceiveConfig(final Config config) { checkReceivedObjects = config.getBoolean( "receive", "fsckobjects", //$NON-NLS-1$ //$NON-NLS-2$ config.getBoolean("transfer", "fsckobjects", false)); //$NON-NLS-1$ //$NON-NLS-2$ + allowLeadingZeroFileMode = checkReceivedObjects + && config.getBoolean("fsck", "allowLeadingZeroFileMode", false); //$NON-NLS-1$ //$NON-NLS-2$ + safeForWindows = checkReceivedObjects + && config.getBoolean("fsck", "safeForWindows", false); //$NON-NLS-1$ //$NON-NLS-2$ + safeForMacOS = checkReceivedObjects + && config.getBoolean("fsck", "safeForMacOS", false); //$NON-NLS-1$ //$NON-NLS-2$ + allowCreates = true; allowDeletes = !config.getBoolean("receive", "denydeletes", false); //$NON-NLS-1$ //$NON-NLS-2$ allowNonFastForwards = !config.getBoolean("receive", //$NON-NLS-1$ @@ -294,6 +301,15 @@ public abstract class BaseReceivePack { allowOfsDelta = config.getBoolean("repack", "usedeltabaseoffset", //$NON-NLS-1$ //$NON-NLS-2$ true); } + + ObjectChecker newObjectChecker() { + if (!checkReceivedObjects) + return null; + return new ObjectChecker() + .setAllowLeadingZeroFileMode(allowLeadingZeroFileMode) + .setSafeForWindows(safeForWindows) + .setSafeForMacOS(safeForMacOS); + } } /** |