diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java index b6a10518a..83f1ee177 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java @@ -77,14 +77,10 @@ class Push extends TextBuiltin { private final List refSpecs = new ArrayList(); @Option(name = "--all") - void addAll(final boolean ignored) { - refSpecs.add(Transport.REFSPEC_PUSH_ALL); - } + private boolean all; @Option(name = "--tags") - void addTags(final boolean ignored) { - refSpecs.add(Transport.REFSPEC_TAGS); - } + private boolean tags; @Option(name = "--verbose", aliases = { "-v" }) private boolean verbose = false; @@ -117,6 +113,10 @@ class Push extends TextBuiltin { push.setProgressMonitor(new TextProgressMonitor()); push.setReceivePack(receivePack); push.setRefSpecs(refSpecs); + if (all) + push.setPushAll(); + if (tags) + push.setPushTags(); push.setRemote(remote); push.setThin(thin); push.setTimeout(timeout); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java index eefe401d1..d3512cc0c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java @@ -297,6 +297,26 @@ public class PushCommand extends GitCommand> { return this; } + /** + * Push all branches under refs/heads/*. + * + * @return {code this} + */ + public PushCommand setPushAll() { + refSpecs.add(Transport.REFSPEC_PUSH_ALL); + return this; + } + + /** + * Push all tags under refs/tags/*. + * + * @return {code this} + */ + public PushCommand setPushTags() { + refSpecs.add(Transport.REFSPEC_TAGS); + return this; + } + /** * @return the dry run preference for the push operation */