Browse Source

Don't prefix output from jgit status with '# '

C Git does not do it anymore

Bug: 439937
Change-Id: I20bdb787a00bba3e4adf269fd64ec6296bdc2a66
stable-3.5
Robin Rosenberg 10 years ago
parent
commit
fd58cbcdee
  1. 150
      org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/StatusTest.java
  2. 2
      org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties

150
org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/StatusTest.java

@ -63,16 +63,16 @@ public class StatusTest extends CLIRepositoryTestCase {
writeTrashFile("untracked", "untracked"); writeTrashFile("untracked", "untracked");
// Test untracked // Test untracked
assertArrayOfLinesEquals(new String[] { // git status output assertArrayOfLinesEquals(new String[] { // git status output
"# On branch master", // "On branch master", //
"# Untracked files:", // "Untracked files:", //
"# ",// "",//
"# \tstagedDeleted", // "\tstagedDeleted", //
"# \tstagedModified", // "\tstagedModified", //
"# \tstagedNew", // "\tstagedNew", //
"# \ttracked", // "\ttracked", //
"# \ttrackedDeleted", // "\ttrackedDeleted", //
"# \ttrackedModified", // "\ttrackedModified", //
"# \tuntracked", // "\tuntracked", //
"" // "" //
}, execute("git status")); // }, execute("git status")); //
// Add to index // Add to index
@ -83,30 +83,30 @@ public class StatusTest extends CLIRepositoryTestCase {
git.add().addFilepattern("trackedDeleted").call(); git.add().addFilepattern("trackedDeleted").call();
// Test staged count // Test staged count
assertArrayOfLinesEquals(new String[] { // git status output assertArrayOfLinesEquals(new String[] { // git status output
"# On branch master", // "On branch master", //
"# Changes to be committed:", // "Changes to be committed:", //
"# ", // "", //
"# \tnew file: stagedDeleted", // "\tnew file: stagedDeleted", //
"# \tnew file: stagedModified", // "\tnew file: stagedModified", //
"# \tnew file: tracked", // "\tnew file: tracked", //
"# \tnew file: trackedDeleted", // "\tnew file: trackedDeleted", //
"# \tnew file: trackedModified", // "\tnew file: trackedModified", //
"# ", // "", //
"# Untracked files:", // "Untracked files:", //
"# ", // "", //
"# \tstagedNew", // "\tstagedNew", //
"# \tuntracked", // "\tuntracked", //
"" // "" //
}, execute("git status")); // }, execute("git status")); //
// Commit // Commit
git.commit().setMessage("initial commit") git.commit().setMessage("initial commit")
.call(); .call();
assertArrayOfLinesEquals(new String[] { // git status output assertArrayOfLinesEquals(new String[] { // git status output
"# On branch master", // "On branch master", //
"# Untracked files:", // "Untracked files:", //
"# ", // "", //
"# \tstagedNew", // "\tstagedNew", //
"# \tuntracked", // "\tuntracked", //
"" // "" //
}, execute("git status")); // }, execute("git status")); //
// Make some changes and stage them // Make some changes and stage them
@ -119,21 +119,21 @@ public class StatusTest extends CLIRepositoryTestCase {
git.add().addFilepattern("stagedNew").call(); git.add().addFilepattern("stagedNew").call();
// Test staged/not-staged status // Test staged/not-staged status
assertArrayOfLinesEquals(new String[] { // git status output assertArrayOfLinesEquals(new String[] { // git status output
"# On branch master", // "On branch master", //
"# Changes to be committed:", // "Changes to be committed:", //
"# ", // "", //
"# \tdeleted: stagedDeleted", // "\tdeleted: stagedDeleted", //
"# \tmodified: stagedModified", // "\tmodified: stagedModified", //
"# \tnew file: stagedNew", // "\tnew file: stagedNew", //
"# ", // "", //
"# Changes not staged for commit:", // "Changes not staged for commit:", //
"# ", // "", //
"# \tdeleted: trackedDeleted", // "\tdeleted: trackedDeleted", //
"# \tmodified: trackedModified", // "\tmodified: trackedModified", //
"# ", // "", //
"# Untracked files:", // "Untracked files:", //
"# ", // "", //
"# \tuntracked", // "\tuntracked", //
"" // "" //
}, execute("git status")); // }, execute("git status")); //
// Create unmerged file // Create unmerged file
@ -144,20 +144,20 @@ public class StatusTest extends CLIRepositoryTestCase {
git.rm().addFilepattern("trackedDeleted").call(); git.rm().addFilepattern("trackedDeleted").call();
git.commit().setMessage("commit before branching").call(); git.commit().setMessage("commit before branching").call();
assertArrayOfLinesEquals(new String[] { // git status output assertArrayOfLinesEquals(new String[] { // git status output
"# On branch master", // "On branch master", //
"# Untracked files:", // "Untracked files:", //
"# ", // "", //
"# \tuntracked", // "\tuntracked", //
"" // "" //
}, execute("git status")); // }, execute("git status")); //
// Checkout new branch // Checkout new branch
git.checkout().setCreateBranch(true).setName("test").call(); git.checkout().setCreateBranch(true).setName("test").call();
// Test branch status // Test branch status
assertArrayOfLinesEquals(new String[] { // git status output assertArrayOfLinesEquals(new String[] { // git status output
"# On branch test", // "On branch test", //
"# Untracked files:", // "Untracked files:", //
"# ", // "", //
"# \tuntracked", // "\tuntracked", //
"" // "" //
}, execute("git status")); // }, execute("git status")); //
// Commit change and checkout master again // Commit change and checkout master again
@ -166,10 +166,10 @@ public class StatusTest extends CLIRepositoryTestCase {
RevCommit testBranch = git.commit() RevCommit testBranch = git.commit()
.setMessage("changed unmerged in test branch").call(); .setMessage("changed unmerged in test branch").call();
assertArrayOfLinesEquals(new String[] { // git status output assertArrayOfLinesEquals(new String[] { // git status output
"# On branch test", // "On branch test", //
"# Untracked files:", // "Untracked files:", //
"# ", // "", //
"# \tuntracked", // "\tuntracked", //
"" // "" //
}, execute("git status")); // }, execute("git status")); //
git.checkout().setName("master").call(); git.checkout().setName("master").call();
@ -178,38 +178,38 @@ public class StatusTest extends CLIRepositoryTestCase {
git.add().addFilepattern("unmerged").call(); git.add().addFilepattern("unmerged").call();
git.commit().setMessage("changed unmerged in master branch").call(); git.commit().setMessage("changed unmerged in master branch").call();
assertArrayOfLinesEquals(new String[] { // git status output assertArrayOfLinesEquals(new String[] { // git status output
"# On branch master", // "On branch master", //
"# Untracked files:", // "Untracked files:", //
"# ", // "", //
"# \tuntracked", // "\tuntracked", //
"" // "" //
}, execute("git status")); // }, execute("git status")); //
// Merge test branch into master // Merge test branch into master
git.merge().include(testBranch.getId()).call(); git.merge().include(testBranch.getId()).call();
// Test unmerged status // Test unmerged status
assertArrayOfLinesEquals(new String[] { // git status output assertArrayOfLinesEquals(new String[] { // git status output
"# On branch master", // "On branch master", //
"# Unmerged paths:", // "Unmerged paths:", //
"# ", // "", //
"# \tboth modified: unmerged", // "\tboth modified: unmerged", //
"# ", // "", //
"# Untracked files:", // "Untracked files:", //
"# ", // "", //
"# \tuntracked", // "\tuntracked", //
"" // "" //
}, execute("git status")); // }, execute("git status")); //
// Test detached head // Test detached head
String commitId = db.getRef(Constants.MASTER).getObjectId().name(); String commitId = db.getRef(Constants.MASTER).getObjectId().name();
git.checkout().setName(commitId).call(); git.checkout().setName(commitId).call();
assertArrayOfLinesEquals(new String[] { // git status output assertArrayOfLinesEquals(new String[] { // git status output
"# Not currently on any branch.", // "Not currently on any branch.", //
"# Unmerged paths:", // "Unmerged paths:", //
"# ", // "", //
"# \tboth modified: unmerged", // "\tboth modified: unmerged", //
"# ", // "", //
"# Untracked files:", // "Untracked files:", //
"# ", // "", //
"# \tuntracked", // "\tuntracked", //
"" // "" //
}, execute("git status")); // }, execute("git status")); //
} }

2
org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties

@ -67,7 +67,7 @@ fromURI=From {0}
initializedEmptyGitRepositoryIn=Initialized empty Git repository in {0} initializedEmptyGitRepositoryIn=Initialized empty Git repository in {0}
invalidHttpProxyOnlyHttpSupported=Invalid http_proxy: {0}: Only http supported. invalidHttpProxyOnlyHttpSupported=Invalid http_proxy: {0}: Only http supported.
jgitVersion=jgit version {0} jgitVersion=jgit version {0}
lineFormat=# {0} lineFormat={0}
listeningOn=Listening on {0} listeningOn=Listening on {0}
mergeConflict=CONFLICT(content): Merge conflict in {0} mergeConflict=CONFLICT(content): Merge conflict in {0}
mergeCheckoutConflict=error: Your local changes to the following files would be overwritten by merge: mergeCheckoutConflict=error: Your local changes to the following files would be overwritten by merge:

Loading…
Cancel
Save