Skip to content

Commit

Permalink
Confirm that JGit 3.4.1 [Fixed JENKINS-23424]
Browse files Browse the repository at this point in the history
Prior to JGit 3.4.1, tracked files which were locally modified were
not reset to their unmodified state by JGit checkout, while the CliGit
arguments used in the same cases would reset the locally modified file
to their unmodified state.
  • Loading branch information
MarkEWaite committed Jun 28, 2014
1 parent dfd8c98 commit fffa4c7
Showing 1 changed file with 6 additions and 8 deletions.
Expand Up @@ -1385,11 +1385,9 @@ private void base_checkout_replaces_tracked_changes(boolean defineBranch) throws

/* Modify the pom file by adding a comment */
String comment = " <!-- JENKINS-23424 comment -->";
if (w.git instanceof CliGitAPIImpl) {
/* JGit implementation does not reset modified tracked files */
w.touch("pom.xml", pomContent + comment);
assertTrue(w.contentOf("pom.xml").contains(comment));
}
/* JGit implementation prior to 3.4.1 did not reset modified tracked files */
w.touch("pom.xml", pomContent + comment);
assertTrue(w.contentOf("pom.xml").contains(comment));

/* Create an untracked file. Both implementations retain
* untracked files across checkout.
Expand All @@ -1398,11 +1396,11 @@ private void base_checkout_replaces_tracked_changes(boolean defineBranch) throws
assertTrue("Missing untracked file", w.file("untracked-file").exists());

/* Checkout should erase local modification */
CheckoutCommand cmd = w.git.checkout().ref("JENKINS-23424/1.4.x").deleteBranchIfExist(true);
if (defineBranch) {
w.git.checkout().branch("1.4.x").ref("JENKINS-23424/1.4.x").deleteBranchIfExist(true).execute();
} else {
w.git.checkout().ref("JENKINS-23424/1.4.x").deleteBranchIfExist(true).execute();
cmd.branch("1.4.x");
}
cmd.execute();

/* Tracked file should not contain added comment, nor the jacoco reference */
pomContent = w.contentOf("pom.xml");
Expand Down

0 comments on commit fffa4c7

Please sign in to comment.