Browse Source

Add a test for parsing fsck config options and expose FsckMode enum

These config options allow overriding the message type (error, warn or
ignore) of a specific message ID such as missingEmail.
The supported fsck message IDs are defined in ObjectChecker.ErrorType.

Since TransferConfig.FsckMode wasn't public parsing fsck configuration
options like e.g. fsck.missingEmail=ignore failed with an
IllegalAccessException. Fix this by declaring this enum public.

Change-Id: I3f41ff7a76a846250a63ce92a9fd111eb347269f
Signed-off-by: David Turner <dturner@twosigma.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
tags/v4.9.0.201710071750-r
David Turner 7 years ago
parent
commit
695e38a83b

+ 5
- 0
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PushCommandTest.java View File

@@ -83,6 +83,11 @@ public class PushCommandTest extends RepositoryTestCase {

// create other repository
Repository db2 = createWorkRepository();
final StoredConfig config2 = db2.getConfig();

// this tests that this config can be parsed properly
config2.setString("fsck", "", "missingEmail", "ignore");
config2.save();

// setup the first repository
final StoredConfig config = db.getConfig();

+ 18
- 2
org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java View File

@@ -76,8 +76,24 @@ public class TransferConfig {
}
};

enum FsckMode {
ERROR, WARN, IGNORE;
/**
* A git configuration value for how to handle a fsck failure of a particular kind.
* Used in e.g. fsck.missingEmail.
* @since 4.9
*/
public enum FsckMode {
/**
* Treat it as an error (the default).
*/
ERROR,
/**
* Issue a warning (in fact, jgit treats this like IGNORE, but git itself does warn).
*/
WARN,
/**
* Ignore the error.
*/
IGNORE;
}

private final boolean fetchFsck;

Loading…
Cancel
Save