diff options
-rw-r--r-- | org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java | 4 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java | 20 |
2 files changed, 21 insertions, 3 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java index 629b47a9a0..0c3b720fb6 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java @@ -95,9 +95,7 @@ class Checkout extends TextBuiltin { if (paths.size() == 1 && paths.get(0).equals(".")) { //$NON-NLS-1$ command.setAllPaths(true); } else { - for (String path : paths) { - command.addPath(path); - } + command.addPaths(paths); } } else { command.setCreateBranch(createBranch); 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 20d0704509..c17ae5c00d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java @@ -367,6 +367,26 @@ public class CheckoutCommand extends GitCommand<Ref> { } /** + * Add multiple slash-separated paths to the list of paths to check out. To + * check out all paths, use {@link #setAllPaths(boolean)}. + * <p> + * If this option is set, neither the {@link #setCreateBranch(boolean)} nor + * {@link #setName(String)} option is considered. In other words, these + * options are exclusive. + * + * @param p + * paths to update in the working tree and index (with + * <code>/</code> as separator) + * @return {@code this} + * @since 4.6 + */ + public CheckoutCommand addPaths(List<String> p) { + checkCallable(); + this.paths.addAll(p); + return this; + } + + /** * Set whether to checkout all paths. * <p> * This options should be used when you want to do a path checkout on the |