]> source.dussan.org Git - jgit.git/commitdiff
amend commit: Refactor repository construction to builder class 46/1046/3
authorShawn O. Pearce <spearce@spearce.org>
Sat, 3 Jul 2010 00:01:40 +0000 (17:01 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Sat, 3 Jul 2010 17:54:30 +0000 (10:54 -0700)
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>
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/T0003_Basic.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/lib/BaseRepositoryBuilder.java

index 2da210d7e81db8710c3c7a02ce6799e67200c40f..ab11062cc2d0baccbee25c88f30d26971ef09db5 100644 (file)
@@ -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);
                }
index c9013a6a01b8fb4a90182cf180d0dde673ecb4eb..477b0dfb502e030b025a74d43453f5607b8a6b59 100644 (file)
@@ -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());
                }
        }
index aece518741c58bd604a0a7e4aeb60581c9a1c842..999a11a695828e820bdc69e8a9074cf3ee7ad22b 100644 (file)
@@ -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
index 301e411eec830841ec4eb3ff466909a89d28011c..707b39102722fc97a733b32fcb0c06c3ba942c8d 100644 (file)
@@ -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;
index 90929e721c264be192d08228e40a8ed52be2b481..92edb0325c36a148bbd029fa2c0449ba3bfd9ba7 100644 (file)
@@ -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);
        }
 
        /**