Source:
<code>public void testCloneWithAutoSetupRebase() throws Exception { File directory = createTempDirectory("testCloneRepository1"); CloneCommand command = Git.cloneRepository(); command.setDirectory(directory); command.setURI(fileUri()); Git git2 = command.call(); addRepoToClose(git2.getRepository()); assertEquals(BranchRebaseMode.NONE, git2.getRepository().getConfig().getEnum( BranchRebaseMode.values(), ConfigConstants.CONFIG_BRANCH_SECTION, "test", ConfigConstants.CONFIG_KEY_REBASE, <START> BranchRebaseMode.NONE)); <END> FileBasedConfig userConfig = SystemReader.getInstance().openUserConfig( null, git.getRepository().getFS()); userConfig.setString(ConfigConstants.CONFIG_BRANCH_SECTION, null, ConfigConstants.CONFIG_KEY_AUTOSETUPREBASE, ConfigConstants.CONFIG_KEY_ALWAYS); userConfig.save(); directory = createTempDirectory("testCloneRepository2"); command = Git.cloneRepository(); command.setDirectory(directory); command.setURI(fileUri()); git2 = command.call(); addRepoToClose(git2.getRepository()); assertEquals(BranchRebaseMode.REBASE, git2.getRepository().getConfig().getEnum( BranchRebaseMode.values(), ConfigConstants.CONFIG_BRANCH_SECTION, "test", ConfigConstants.CONFIG_KEY_REBASE, BranchRebaseMode.NONE)); userConfig.setString(ConfigConstants.CONFIG_BRANCH_SECTION, null, ConfigConstants.CONFIG_KEY_AUTOSETUPREBASE, ConfigConstants.CONFIG_KEY_REMOTE); userConfig.save(); directory = createTempDirectory("testCloneRepository2"); command = Git.cloneRepository(); command.setDirectory(directory); command.setURI(fileUri()); git2 = command.call(); addRepoToClose(git2.getRepository()); assertEquals(BranchRebaseMode.REBASE, git2.getRepository().getConfig().getEnum( BranchRebaseMode.values(), ConfigConstants.CONFIG_BRANCH_SECTION, "test", ConfigConstants.CONFIG_KEY_REBASE, BranchRebaseMode.NONE)); }</code><technical_language>BranchRebaseMode.NONE default for Config#getEnum(...) this test succeed accidentally. I choose a default (e.g. null BranchRebaseMode.REBASE)</technical_language>

Target:
public void testCloneWithAutoSetupRebase() throws Exception { File directory = createTempDirectory("testCloneRepository1"); CloneCommand command = Git.cloneRepository(); command.setDirectory(directory); command.setURI(fileUri()); Git git2 = command.call(); addRepoToClose(git2.getRepository()); assertNull(git2.getRepository().getConfig().getEnum( BranchRebaseMode.values(), ConfigConstants.CONFIG_BRANCH_SECTION, "test", ConfigConstants.CONFIG_KEY_REBASE, null)); FileBasedConfig userConfig = SystemReader.getInstance().openUserConfig( null, git.getRepository().getFS()); userConfig.setString(ConfigConstants.CONFIG_BRANCH_SECTION, null, ConfigConstants.CONFIG_KEY_AUTOSETUPREBASE, ConfigConstants.CONFIG_KEY_ALWAYS); userConfig.save(); directory = createTempDirectory("testCloneRepository2"); command = Git.cloneRepository(); command.setDirectory(directory); command.setURI(fileUri()); git2 = command.call(); addRepoToClose(git2.getRepository()); assertEquals(BranchRebaseMode.REBASE, git2.getRepository().getConfig().getEnum( BranchRebaseMode.values(), ConfigConstants.CONFIG_BRANCH_SECTION, "test", ConfigConstants.CONFIG_KEY_REBASE, BranchRebaseMode.NONE)); userConfig.setString(ConfigConstants.CONFIG_BRANCH_SECTION, null, ConfigConstants.CONFIG_KEY_AUTOSETUPREBASE, ConfigConstants.CONFIG_KEY_REMOTE); userConfig.save(); directory = createTempDirectory("testCloneRepository2"); command = Git.cloneRepository(); command.setDirectory(directory); command.setURI(fileUri()); git2 = command.call(); addRepoToClose(git2.getRepository()); assertEquals(BranchRebaseMode.REBASE, git2.getRepository().getConfig().getEnum( BranchRebaseMode.values(), ConfigConstants.CONFIG_BRANCH_SECTION, "test", ConfigConstants.CONFIG_KEY_REBASE, BranchRebaseMode.NONE)); }