Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rtc2git.cli.extension/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<classpathentry exported="true" kind="lib" path="lib/JavaEWAH-0.7.9.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jsch-0.1.50.jar"/>
<classpathentry exported="true" kind="lib" path="lib/junit-4.12.jar"/>
<classpathentry exported="true" kind="lib" path="lib/org.eclipse.jgit-3.7.1.201504261725-r.jar"/>
<classpathentry kind="lib" path="lib/org.eclipse.jgit-4.3.1.201605051710-r.jar" sourcepath="/jgit.test/lib/org.eclipse.jgit-4.3.1.201605051710-r-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/slf4j-api-1.7.2.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
Expand Down
4 changes: 2 additions & 2 deletions rtc2git.cli.extension/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ Bundle-ClassPath: to.rtc.cli.migration.jar,
lib/JavaEWAH-0.7.9.jar,
lib/jsch-0.1.50.jar,
lib/junit-4.12.jar,
lib/org.eclipse.jgit-3.7.1.201504261725-r.jar,
lib/slf4j-api-1.7.2.jar
lib/slf4j-api-1.7.2.jar,
lib/org.eclipse.jgit-4.3.1.201605051710-r.jar
4 changes: 2 additions & 2 deletions rtc2git.cli.extension/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ bin.includes = META-INF/,\
lib/JavaEWAH-0.7.9.jar,\
lib/jsch-0.1.50.jar,\
lib/junit-4.12.jar,\
lib/org.eclipse.jgit-3.7.1.201504261725-r.jar,\
lib/slf4j-api-1.7.2.jar
lib/slf4j-api-1.7.2.jar,\
lib/org.eclipse.jgit-4.3.1.201605051710-r.jar
jars.compile.order = to.rtc.cli.migration.jar
2 changes: 1 addition & 1 deletion rtc2git.cli.extension/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit</artifactId>
<version>3.7.1.201504261725-r</version>
<version>4.3.1.201605051710-r</version>
<scope>runtime</scope>
</dependency>
<dependency>
Expand Down
24 changes: 24 additions & 0 deletions rtc2git.cli.extension/src/to/rtc/cli/migrate/git/GitMigrator.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
import java.util.SortedSet;
Expand All @@ -24,6 +25,7 @@
import org.eclipse.jgit.api.RmCommand;
import org.eclipse.jgit.api.Status;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.lib.Config;
import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.storage.file.WindowCacheConfig;
Expand All @@ -43,6 +45,7 @@
* @author patrick.reinhart
*/
public final class GitMigrator implements Migrator {
private static final String GIT_CONFIG_PREFIX = "git.config.";
static final List<String> ROOT_IGNORED_ENTRIES = Arrays.asList("/.jazz5", "/.jazzShed", "/.metadata");
static final Pattern GITIGNORE_PATTERN = Pattern.compile("(^.*(/|))\\.gitignore$");
static final Pattern JAZZIGNORE_PATTERN = Pattern.compile("(^.*(/|))\\.jazzignore$");
Expand Down Expand Up @@ -316,6 +319,7 @@ private void initConfig() throws IOException {
config.setString("core", null, "autocrlf", File.separatorChar == '/' ? "input" : "true");
config.setBoolean("http", null, "sslverify", false);
config.setString("push", null, "default", "simple");
fillConfigFromProperties(config);
config.save();
}

Expand Down Expand Up @@ -442,4 +446,24 @@ public void createTag(Tag tag) {
}
}
}

private void fillConfigFromProperties(Config config) {
for (Entry<Object, Object> entry : properties.entrySet()) {
if (entry.getKey() instanceof String && (((String) entry.getKey()).startsWith(GIT_CONFIG_PREFIX))) {

String key = ((String) entry.getKey()).substring(GIT_CONFIG_PREFIX.length());
int dot = key.indexOf('.');
int dot1 = key.lastIndexOf('.');
// so far supporting section/key entries, no subsections
if (dot < 1 || dot == key.length() - 1 || dot1 != dot) {
// invalid config key entry
continue;
}
String section = key.substring(0, dot);
String name = key.substring(dot + 1);
config.setString(section, null, name, entry.getValue().toString());
}

}
}
}