diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2010-07-02 17:01:40 -0700 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2010-07-03 10:54:30 -0700 |
commit | 08d349a27bbff4b0d3ee67eb6ddd4818e070c86e (patch) | |
tree | 90e4f66206bf699f2dd54a4c61061543cc9e25e9 | |
parent | fe9860a4441d606eb6d56da24197eb1797f275dc (diff) | |
download | jgit-08d349a27bbff4b0d3ee67eb6ddd4818e070c86e.tar.gz jgit-08d349a27bbff4b0d3ee67eb6ddd4818e070c86e.zip |
amend commit: Refactor repository construction to builder class
During code review, Alex raised a few comments about commit
532421d98925 ("Refactor repository construction to builder class").
Due to the size of the related series we aren't going to go back
and rebase in something this minor, so resolve them as a follow-up
commit instead.
Change-Id: Ied52f7a8f7252743353c58d20bfc3ec498933e00
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
5 files changed, 8 insertions, 7 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 2da210d7e8..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 @@ -163,17 +163,17 @@ public class Main { final TextBuiltin cmd = subcommand; if (cmd.requiresRepository()) { - RepositoryBuilder frb = new RepositoryBuilder() // + RepositoryBuilder rb = new RepositoryBuilder() // .setGitDir(gitdir) // .readEnvironment() // .findGitDir(); - if (frb.getGitDir() == null) { + if (rb.getGitDir() == null) { writer.println(CLIText.get().cantFindGitDirectory); writer.flush(); System.exit(1); } - cmd.init(frb.build(), null); + cmd.init(rb.build(), null); } else { cmd.init(null, gitdir); } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/T0003_Basic.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/T0003_Basic.java index c9013a6a01..477b0dfb50 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/T0003_Basic.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/T0003_Basic.java @@ -53,6 +53,7 @@ import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; +import org.eclipse.jgit.JGitText; import org.eclipse.jgit.errors.ConfigInvalidException; import org.eclipse.jgit.lib.Commit; import org.eclipse.jgit.lib.Config; @@ -99,7 +100,7 @@ public class T0003_Basic extends SampleDataRepositoryTestCase { fail("Must pass either GIT_DIR or GIT_WORK_TREE"); } catch (IllegalArgumentException e) { assertEquals( - "Either GIT_DIR or GIT_WORK_TREE must be passed to Repository constructor", + JGitText.get().eitherGitDirOrWorkTreeRequired, e.getMessage()); } } diff --git a/org.eclipse.jgit/resources/org/eclipse/jgit/JGitText.properties b/org.eclipse.jgit/resources/org/eclipse/jgit/JGitText.properties index aece518741..999a11a695 100644 --- a/org.eclipse.jgit/resources/org/eclipse/jgit/JGitText.properties +++ b/org.eclipse.jgit/resources/org/eclipse/jgit/JGitText.properties @@ -125,7 +125,7 @@ duplicateAdvertisementsOf=duplicate advertisements of {0} duplicateRef=Duplicate ref: {0} duplicateRemoteRefUpdateIsIllegal=Duplicate remote ref update is illegal. Affected remote name: {0} duplicateStagesNotAllowed=Duplicate stages not allowed -eitherGIT_DIRorGIT_WORK_TREEmustBePassed=Either GIT_DIR or GIT_WORK_TREE must be passed to Repository constructor +eitherGitDirOrWorkTreeRequired=One of setGitDir or setWorkTree must be called. emptyPathNotPermitted=Empty path not permitted. encryptionError=Encryption error: {0} endOfFileInEscape=End of file in escape diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/JGitText.java b/org.eclipse.jgit/src/org/eclipse/jgit/JGitText.java index 301e411eec..707b391027 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/JGitText.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/JGitText.java @@ -185,7 +185,7 @@ public class JGitText extends TranslationBundle { /***/ public String duplicateRef; /***/ public String duplicateRemoteRefUpdateIsIllegal; /***/ public String duplicateStagesNotAllowed; - /***/ public String eitherGIT_DIRorGIT_WORK_TREEmustBePassed; + /***/ public String eitherGitDirOrWorkTreeRequired; /***/ public String emptyPathNotPermitted; /***/ public String encryptionError; /***/ public String endOfFileInEscape; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java index 90929e721c..92edb0325c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java @@ -467,7 +467,7 @@ public class BaseRepositoryBuilder<B extends BaseRepositoryBuilder, R extends Re protected void requireGitDirOrWorkTree() { if (getGitDir() == null && getWorkTree() == null) throw new IllegalArgumentException( - JGitText.get().eitherGIT_DIRorGIT_WORK_TREEmustBePassed); + JGitText.get().eitherGitDirOrWorkTreeRequired); } /** |