Prefix an abnormal CLI command termination with 'fatal:'
Change-Id: I3d257666c6fbed7b238c575808f73ec518e811b9 Signed-off-by: Chris Aniszczyk <zx@twitter.com>
This commit is contained in:
parent
e73c6873c7
commit
074f9194dc
|
@ -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 static List<String> execute(String str, Repository db)
|
|||
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();
|
||||
|
|
|
@ -65,7 +65,7 @@ public void testList() throws Exception {
|
|||
|
||||
@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]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,13 +83,13 @@ public void testCheckoutNonExistingBranch() throws Exception {
|
|||
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"));
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -120,7 +120,6 @@ public static String formatLine(String line) {
|
|||
/***/ public String failedToLockIndex;
|
||||
/***/ public String failedToLockTag;
|
||||
/***/ public String fatalError;
|
||||
/***/ public String fatalErrorTagExists;
|
||||
/***/ public String fatalThisProgramWillDestroyTheRepository;
|
||||
/***/ public String fileIsRequired;
|
||||
/***/ public String forcedUpdate;
|
||||
|
|
Loading…
Reference in New Issue