diff options
author | Christian Halstrick <christian.halstrick@sap.com> | 2016-09-27 15:38:53 +0200 |
---|---|---|
committer | Christian Halstrick <christian.halstrick@sap.com> | 2016-09-27 15:58:24 +0200 |
commit | 83e43f7960de7e62dd1e7b2950ceed24ce85e8ac (patch) | |
tree | dfa9024397dcc9853971d9ba5908c5e61b833e39 /org.eclipse.jgit/src/org/eclipse | |
parent | 8ed16fa1005405837cbb6f515333f89dbda876f5 (diff) | |
download | jgit-83e43f7960de7e62dd1e7b2950ceed24ce85e8ac.tar.gz jgit-83e43f7960de7e62dd1e7b2950ceed24ce85e8ac.zip |
Fix CheckoutCommand to return updated files even on NONDELETED status
CheckoutCommand was not returning updated and removed files in case of
an overall status of NONDELETED. That's status which occurs especially
on the Windows platform when Checkout wanted to delete files but the
filesystem doesn't allow this. The situation is more seldom on linux/mac
because open filehandles don't stop a deletion attempt and checkout
succeeds more often.
Change-Id: I4828008e58c09bd8f9edaf0f7eda0a79c629fb57
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java | 4 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutResult.java | 26 |
2 files changed, 27 insertions, 3 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java index 65508eff40..20d0704509 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java @@ -318,7 +318,9 @@ public class CheckoutCommand extends GitCommand<Ref> { if (!dco.getToBeDeleted().isEmpty()) { status = new CheckoutResult(Status.NONDELETED, - dco.getToBeDeleted()); + dco.getToBeDeleted(), + new ArrayList<String>(dco.getUpdated().keySet()), + dco.getRemoved()); } else status = new CheckoutResult(new ArrayList<String>(dco .getUpdated().keySet()), dco.getRemoved()); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutResult.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutResult.java index 6a1bfb8f0e..92a67f46af 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutResult.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutResult.java @@ -113,6 +113,28 @@ public class CheckoutResult { * {@link Status#CONFLICTS} or {@link Status#NONDELETED}. */ CheckoutResult(Status status, List<String> fileList) { + this(status, fileList, null, null); + } + + /** + * Create a new fail result. If status is {@link Status#CONFLICTS}, + * <code>fileList</code> is a list of conflicting files, if status is + * {@link Status#NONDELETED}, <code>fileList</code> is a list of not deleted + * files. All other values ignore <code>fileList</code>. To create a result + * for {@link Status#OK}, see {@link #CheckoutResult(List, List)}. + * + * @param status + * the failure status + * @param fileList + * the list of files to store, status has to be either + * {@link Status#CONFLICTS} or {@link Status#NONDELETED}. + * @param modified + * the modified files + * @param removed + * the removed files. + */ + CheckoutResult(Status status, List<String> fileList, List<String> modified, + List<String> removed) { myStatus = status; if (status == Status.CONFLICTS) this.conflictList = fileList; @@ -123,8 +145,8 @@ public class CheckoutResult { else this.undeletedList = new ArrayList<String>(0); - this.modifiedList = new ArrayList<String>(0); - this.removedList = new ArrayList<String>(0); + this.modifiedList = modified; + this.removedList = removed; } /** |