aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2010-07-22 11:17:00 -0700
committerShawn O. Pearce <spearce@spearce.org>2010-07-22 14:56:34 -0700
commitfa9b225e06f16ca7fd7ffca5689f4af0942a73e1 (patch)
treed85054426a826f9b1495186d41252d0130f33407 /org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java
parentab062caa2255054cca413985bbaa3ad7c1c9c383 (diff)
parent12fe0f2d1eb18aab2964532e99d11d4311d558eb (diff)
downloadjgit-fa9b225e06f16ca7fd7ffca5689f4af0942a73e1.tar.gz
jgit-fa9b225e06f16ca7fd7ffca5689f4af0942a73e1.zip
Merge branch 'delta'
* delta: (103 commits) Discard the uncompressed delta as soon as its compressed Honor pack.windowlimit to cap memory usage during packing Honor pack.threads and perform delta search in parallel Cache small deltas during packing Implement delta generation during packing debug-show-packdelta: Dump a pack delta to the console Initial pack format delta generator Add debugging toString() method to ObjectToPack Make ObjectToPack clearReuseAsIs signal available to subclasses Correctly classify the compressing objects phase Refactor ObjectToPack's delta depth setting Configure core.bigFileThreshold into PackWriter Add doNotDelta flag to ObjectToPack Add more configuration options to PackWriter Save object path hash codes during packing Add path hash code to ObjectWalk Add getObjectSize to ObjectReader Allow TemporaryBuffer.Heap to allocate smaller than 8 KiB Define a constant for 127 in DeltaEncoder Cap delta copy instructions at 64k ... Conflicts: org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java org.eclipse.jgit/resources/org/eclipse/jgit/JGitText.properties org.eclipse.jgit/src/org/eclipse/jgit/JGitText.java org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RewriteTreeFilter.java Change-Id: I7c7a05e443a48d32c836173a409ee7d340c70796
Diffstat (limited to 'org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java')
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java76
1 files changed, 8 insertions, 68 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java
index 306ac816d8..ab11062cc2 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java
@@ -51,20 +51,15 @@ import java.net.MalformedURLException;
import java.net.URL;
import java.text.MessageFormat;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import org.eclipse.jgit.awtui.AwtAuthenticator;
import org.eclipse.jgit.awtui.AwtSshSessionFactory;
import org.eclipse.jgit.errors.TransportException;
-import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.lib.RepositoryBuilder;
import org.eclipse.jgit.pgm.opt.CmdLineParser;
import org.eclipse.jgit.pgm.opt.SubcommandHandler;
import org.eclipse.jgit.util.CachedAuthenticator;
-import org.eclipse.jgit.util.SystemReader;
import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.ExampleMode;
@@ -168,51 +163,17 @@ public class Main {
final TextBuiltin cmd = subcommand;
if (cmd.requiresRepository()) {
- if (gitdir == null) {
- String gitDirEnv = SystemReader.getInstance().getenv(Constants.GIT_DIR_KEY);
- if (gitDirEnv != null)
- gitdir = new File(gitDirEnv);
- }
- if (gitdir == null)
- gitdir = findGitDir();
-
- File gitworktree;
- String gitWorkTreeEnv = SystemReader.getInstance().getenv(Constants.GIT_WORK_TREE_KEY);
- if (gitWorkTreeEnv != null)
- gitworktree = new File(gitWorkTreeEnv);
- else
- gitworktree = null;
-
- File indexfile;
- String indexFileEnv = SystemReader.getInstance().getenv(Constants.GIT_INDEX_KEY);
- if (indexFileEnv != null)
- indexfile = new File(indexFileEnv);
- else
- indexfile = null;
-
- File objectdir;
- String objectDirEnv = SystemReader.getInstance().getenv(Constants.GIT_OBJECT_DIRECTORY_KEY);
- if (objectDirEnv != null)
- objectdir = new File(objectDirEnv);
- else
- objectdir = null;
-
- File[] altobjectdirs;
- String altObjectDirEnv = SystemReader.getInstance().getenv(Constants.GIT_ALTERNATE_OBJECT_DIRECTORIES_KEY);
- if (altObjectDirEnv != null) {
- String[] parserdAltObjectDirEnv = altObjectDirEnv.split(File.pathSeparator);
- altobjectdirs = new File[parserdAltObjectDirEnv.length];
- for (int i = 0; i < parserdAltObjectDirEnv.length; i++)
- altobjectdirs[i] = new File(parserdAltObjectDirEnv[i]);
- } else
- altobjectdirs = null;
-
- if (gitdir == null || !gitdir.isDirectory()) {
+ RepositoryBuilder rb = new RepositoryBuilder() //
+ .setGitDir(gitdir) //
+ .readEnvironment() //
+ .findGitDir();
+ if (rb.getGitDir() == null) {
writer.println(CLIText.get().cantFindGitDirectory);
writer.flush();
System.exit(1);
}
- cmd.init(new Repository(gitdir, gitworktree, objectdir, altobjectdirs, indexfile), gitdir);
+
+ cmd.init(rb.build(), null);
} else {
cmd.init(null, gitdir);
}
@@ -224,27 +185,6 @@ public class Main {
}
}
- private static File findGitDir() {
- Set<String> ceilingDirectories = new HashSet<String>();
- String ceilingDirectoriesVar = SystemReader.getInstance().getenv(
- Constants.GIT_CEILING_DIRECTORIES_KEY);
- if (ceilingDirectoriesVar != null) {
- ceilingDirectories.addAll(Arrays.asList(ceilingDirectoriesVar
- .split(File.pathSeparator)));
- }
- File current = new File("").getAbsoluteFile();
- while (current != null) {
- final File gitDir = new File(current, Constants.DOT_GIT);
- if (gitDir.isDirectory())
- return gitDir;
- current = current.getParentFile();
- if (current != null
- && ceilingDirectories.contains(current.getPath()))
- break;
- }
- return null;
- }
-
private static boolean installConsole() {
try {
install("org.eclipse.jgit.console.ConsoleAuthenticator");