diff options
author | Chris Aniszczyk <caniszczyk@gmail.com> | 2011-03-15 10:01:04 -0400 |
---|---|---|
committer | Code Review <codereview-daemon@eclipse.org> | 2011-03-15 10:01:04 -0400 |
commit | 599a55e4473f493e6f6c696a2b864e918a8e6da4 (patch) | |
tree | 65eb1ee1b28452184abb6756317ead868188344a | |
parent | 582fb91f9238dd30765794d0bdcd470a7093ea59 (diff) | |
parent | c3c4398b649acafc5a774a6c58bc846e54fb641b (diff) | |
download | jgit-599a55e4473f493e6f6c696a2b864e918a8e6da4.tar.gz jgit-599a55e4473f493e6f6c696a2b864e918a8e6da4.zip |
Merge "PushCommand: Default to pushing HEAD"
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java | 7 |
1 files changed, 7 insertions, 0 deletions
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 3ceeec42b0..eefe401d1c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java @@ -58,6 +58,7 @@ import org.eclipse.jgit.errors.TransportException; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.NullProgressMonitor; import org.eclipse.jgit.lib.ProgressMonitor; +import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.transport.CredentialsProvider; import org.eclipse.jgit.transport.PushResult; @@ -123,6 +124,12 @@ public class PushCommand extends GitCommand<Iterable<PushResult>> { ArrayList<PushResult> pushResults = new ArrayList<PushResult>(3); try { + if (refSpecs.isEmpty()) { + Ref head = repo.getRef(Constants.HEAD); + if (head != null && head.isSymbolic()) + refSpecs.add(new RefSpec(head.getLeaf().getName())); + } + if (force) { for (int i = 0; i < refSpecs.size(); i++) refSpecs.set(i, refSpecs.get(i).setForceUpdate(true)); |