Do not set core.autocrlf when creating repo

core.autorlf defaults to false, but can be set in the user or 
"system" config files. Note that EGit/JGit may not know
where the "system" config file is located.

Also fix pgm's ConfigTest which depends on default repository
configuration.

Bug: 382067
Change-Id: I2c698a76e30d968e7f351b4f5a2195f0b124f62f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
Robin Rosenberg 2012-06-12 13:56:42 +02:00 committed by Matthias Sohn
parent f2d9a5ed31
commit 2853c61f12
2 changed files with 8 additions and 9 deletions

View File

@ -42,7 +42,8 @@
*/ */
package org.eclipse.jgit.pgm; package org.eclipse.jgit.pgm;
import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.CLIRepositoryTestCase; import org.eclipse.jgit.lib.CLIRepositoryTestCase;
@ -60,11 +61,11 @@ public void setUp() throws Exception {
@Test @Test
public void testListConfig() throws Exception { public void testListConfig() throws Exception {
String[] output = execute("git config --list"); String[] output = execute("git config --list");
assertArrayEquals("expected default configuration", // // value depends on platform
new String[] { "core.autocrlf=false", // assertTrue(output[0].startsWith("core.filemode="));
"core.filemode=true", // assertTrue(output[0].endsWith("true") || output[0].endsWith("false"));
"core.logallrefupdates=true", // assertEquals("core.logallrefupdates=true", output[1]);
"core.repositoryformatversion=0", // assertEquals("core.repositoryformatversion=0", output[2]);
"" /* ends with LF (last line empty) */}, output); assertEquals("", output[3]); /* ends with LF (last line empty) */
} }
} }

View File

@ -280,8 +280,6 @@ public void create(boolean bare) throws IOException {
ConfigConstants.CONFIG_KEY_BARE, true); ConfigConstants.CONFIG_KEY_BARE, true);
cfg.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null, cfg.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null,
ConfigConstants.CONFIG_KEY_LOGALLREFUPDATES, !bare); ConfigConstants.CONFIG_KEY_LOGALLREFUPDATES, !bare);
cfg.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null,
ConfigConstants.CONFIG_KEY_AUTOCRLF, false);
cfg.save(); cfg.save();
} }