]> source.dussan.org Git - jgit.git/commitdiff
Prefix an abnormal CLI command termination with 'fatal:' 33/8633/2
authorTomasz Zarna <tomasz.zarna@tasktop.com>
Sun, 11 Nov 2012 22:43:38 +0000 (23:43 +0100)
committerChris Aniszczyk <zx@twitter.com>
Thu, 15 Nov 2012 23:45:35 +0000 (15:45 -0800)
Change-Id: I3d257666c6fbed7b238c575808f73ec518e811b9
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/pgm/CLIGitCommand.java
org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/BranchTest.java
org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/CheckoutTest.java
org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/CLIText.properties
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CLIText.java

index 78e752d44e412991d7596064be9d0112ad3090ed..982aa95216cb7dffa7d8cdbe42eea711b5da729e 100644 (file)
@@ -43,6 +43,7 @@
 package org.eclipse.jgit.pgm;
 
 import java.io.ByteArrayOutputStream;
+import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -91,7 +92,8 @@ public class CLIGitCommand {
                        cmd.execute(bean.getArguments().toArray(
                                        new String[bean.getArguments().size()]));
                } catch (Die e) {
-                       return IO.readLines(e.getMessage());
+                       return IO.readLines(MessageFormat.format(CLIText.get().fatalError,
+                                       e.getMessage()));
                } finally {
                        if (cmd.outw != null)
                                cmd.outw.flush();
index 900164e98fbc9461e3a33c414e6a8553b94a2563..5193aaa42d1cf9d8891cce0ab2c1d7712c86c284 100644 (file)
@@ -65,7 +65,7 @@ public class BranchTest extends CLIRepositoryTestCase {
 
        @Test
        public void testExistingBranch() throws Exception {
-               assertEquals("A branch named 'master' already exists.",
+               assertEquals("fatal: A branch named 'master' already exists.",
                                execute("git branch master")[0]);
        }
 }
index 33cfb9aff0423730d2290b03b755a1bf739ace2a..d7b91cc51a6c32cea53204a789a74ed83ef3db60 100644 (file)
@@ -83,13 +83,13 @@ public class CheckoutTest extends CLIRepositoryTestCase {
        public void testCheckoutNewBranchThatAlreadyExists() throws Exception {
                new Git(db).commit().setMessage("initial commit").call();
 
-               assertEquals("A branch named 'master' already exists.",
+               assertEquals("fatal: A branch named 'master' already exists.",
                                execute("git checkout -b master"));
        }
 
        @Test
        public void testCheckoutNewBranchOnBranchToBeBorn() throws Exception {
-               assertEquals("You are on a branch yet to be born",
+               assertEquals("fatal: You are on a branch yet to be born",
                                execute("git checkout -b side"));
        }
 
index 8bbcf5e84138f9b0d5ce446a3c712cda69358c16..bf95ab34ab8becc734d1a0e6126ce52aeb4a3c90 100644 (file)
@@ -53,7 +53,6 @@ failedToCommitIndex=failed to commit index
 failedToLockIndex=failed to lock index
 failedToLockTag=Failed to lock tag {0}: {1}
 fatalError=fatal: {0}
-fatalErrorTagExists=fatal: tag '{0}' exists
 fatalThisProgramWillDestroyTheRepository=fatal: This program will destroy the repository\nfatal:\nfatal:\nfatal:    {0}\nfatal:\nfatal: To continue, add {1} to the command line\nfatal:
 fileIsRequired=argument file is required
 forcedUpdate=forced update
index b2f7cba27b1f862630206f84fe544234b5322a7f..62d772de0fe766890e59473c9249007963167998 100644 (file)
@@ -120,7 +120,6 @@ public class CLIText extends TranslationBundle {
        /***/ public String failedToLockIndex;
        /***/ public String failedToLockTag;
        /***/ public String fatalError;
-       /***/ public String fatalErrorTagExists;
        /***/ public String fatalThisProgramWillDestroyTheRepository;
        /***/ public String fileIsRequired;
        /***/ public String forcedUpdate;