@ -48,8 +48,10 @@ import java.util.Map;
import org.eclipse.jgit.lib.Config ;
import org.eclipse.jgit.lib.Config.SectionParser ;
import org.eclipse.jgit.lib.ObjectChecker ;
import org.eclipse.jgit.lib.Ref ;
import org.eclipse.jgit.lib.Repository ;
import org.eclipse.jgit.util.SystemReader ;
/ * *
* The standard "transfer" , "fetch" , "receive" , and "uploadpack" configuration
@ -63,7 +65,10 @@ public class TransferConfig {
}
} ;
private final boolean fetchFsck ;
private final boolean checkReceivedObjects ;
private final boolean allowLeadingZeroFileMode ;
private final boolean safeForWindows ;
private final boolean safeForMacOS ;
private final boolean allowTipSha1InWant ;
private final String [ ] hideRefs ;
@ -72,9 +77,17 @@ public class TransferConfig {
}
private TransferConfig ( final Config rc ) {
fetchFsck = rc . getBoolean (
checkReceivedObjects = rc . getBoolean (
"fetch" , "fsckobjects" , //$NON-NLS-1$ //$NON-NLS-2$
rc . getBoolean ( "transfer" , "fsckobjects" , false ) ) ; //$NON-NLS-1$ //$NON-NLS-2$
allowLeadingZeroFileMode = checkReceivedObjects
& & rc . getBoolean ( "fsck" , "allowLeadingZeroFileMode" , false ) ; //$NON-NLS-1$ //$NON-NLS-2$
safeForWindows = checkReceivedObjects
& & rc . getBoolean ( "fsck" , "safeForWindows" , //$NON-NLS-1$ //$NON-NLS-2$
SystemReader . getInstance ( ) . isWindows ( ) ) ;
safeForMacOS = checkReceivedObjects
& & rc . getBoolean ( "fsck" , "safeForMacOS" , //$NON-NLS-1$ //$NON-NLS-2$
SystemReader . getInstance ( ) . isMacOS ( ) ) ;
allowTipSha1InWant = rc . getBoolean (
"uploadpack" , "allowtipsha1inwant" , false ) ; //$NON-NLS-1$ //$NON-NLS-2$
@ -83,9 +96,25 @@ public class TransferConfig {
/ * *
* @return strictly verify received objects ?
* @deprecated use { @link # newObjectChecker ( ) } instead .
* /
@Deprecated
public boolean isFsckObjects ( ) {
return fetchFsck ;
return checkReceivedObjects ;
}
/ * *
* @return checker to verify fetched objects , or null if checking is not
* enabled in the repository configuration .
* @since 3 . 6
* /
public ObjectChecker newObjectChecker ( ) {
if ( ! checkReceivedObjects )
return null ;
return new ObjectChecker ( )
. setAllowLeadingZeroFileMode ( allowLeadingZeroFileMode )
. setSafeForWindows ( safeForWindows )
. setSafeForMacOS ( safeForMacOS ) ;
}
/ * *