Add isRebase to API of BranchConfig
Change-Id: I9819f49410e30d32c2157db0556a0dd6a0bcc5a4 Signed-off-by: Robin Stocker <robin@nibor.org>
This commit is contained in:
parent
93530625cf
commit
f5494c186f
|
@ -45,7 +45,9 @@
|
||||||
package org.eclipse.jgit.lib;
|
package org.eclipse.jgit.lib;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.junit.Assert.assertNull;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import org.eclipse.jgit.errors.ConfigInvalidException;
|
import org.eclipse.jgit.errors.ConfigInvalidException;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -144,6 +146,20 @@ public void getTrackingBranchShouldHandleNormalCaseForRemoteTrackingBranch() {
|
||||||
branchConfig.getTrackingBranch());
|
branchConfig.getTrackingBranch());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void isRebase() {
|
||||||
|
Config c = parse("" //
|
||||||
|
+ "[branch \"undefined\"]\n"
|
||||||
|
+ "[branch \"false\"]\n"
|
||||||
|
+ " rebase = false\n"
|
||||||
|
+ "[branch \"true\"]\n"
|
||||||
|
+ " rebase = true\n");
|
||||||
|
|
||||||
|
assertFalse(new BranchConfig(c, "undefined").isRebase());
|
||||||
|
assertFalse(new BranchConfig(c, "false").isRebase());
|
||||||
|
assertTrue(new BranchConfig(c, "true").isRebase());
|
||||||
|
}
|
||||||
|
|
||||||
private static Config parse(final String content) {
|
private static Config parse(final String content) {
|
||||||
final Config c = new Config(null);
|
final Config c = new Config(null);
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -134,9 +134,17 @@ public String getRemote() {
|
||||||
* @since 3.5
|
* @since 3.5
|
||||||
*/
|
*/
|
||||||
public String getMerge() {
|
public String getMerge() {
|
||||||
return config.getString(
|
return config.getString(ConfigConstants.CONFIG_BRANCH_SECTION,
|
||||||
ConfigConstants.CONFIG_BRANCH_SECTION, branchName,
|
branchName, ConfigConstants.CONFIG_KEY_MERGE);
|
||||||
ConfigConstants.CONFIG_KEY_MERGE);
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {@code true} if the branch is configured to be rebased
|
||||||
|
* @since 3.5
|
||||||
|
*/
|
||||||
|
public boolean isRebase() {
|
||||||
|
return config.getBoolean(ConfigConstants.CONFIG_BRANCH_SECTION,
|
||||||
|
branchName, ConfigConstants.CONFIG_KEY_REBASE, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue