Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Borowitz2012-02-15 19:10:52 +0000
committerShawn O. Pearce2012-03-01 03:09:22 +0000
commit4a01f47e824aba1898ee7aa1f0677b8014210cfb (patch)
treeeec07e85158be94ce382ecf37fc6ac77868c1345
parent4bf22ff6e840b190e0a019e86cce19001dc587f4 (diff)
downloadjgit-4a01f47e824aba1898ee7aa1f0677b8014210cfb.tar.gz
jgit-4a01f47e824aba1898ee7aa1f0677b8014210cfb.tar.xz
jgit-4a01f47e824aba1898ee7aa1f0677b8014210cfb.zip
Allow creating ReceiveCommands with a specified type
This allows callers who know in advance whether a command is UPDATE or UPDATE_NONFASTFORWARD to specify this in the constructor rather than with a separate method call. Change-Id: Iae483594a4ff370ff75d17a7b0648c5590b3d1bd
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceiveCommand.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceiveCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceiveCommand.java
index da19f4c04c..a1788d1282 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceiveCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceiveCommand.java
@@ -160,6 +160,28 @@ public class ReceiveCommand {
status = Result.NOT_ATTEMPTED;
}
+ /**
+ * Create a new command for {@link ReceivePack}.
+ *
+ * @param oldId
+ * the old object id; must not be null. Use
+ * {@link ObjectId#zeroId()} to indicate a ref creation.
+ * @param newId
+ * the new object id; must not be null. Use
+ * {@link ObjectId#zeroId()} to indicate a ref deletion.
+ * @param name
+ * name of the ref being affected.
+ * @param type
+ * type of the command.
+ */
+ public ReceiveCommand(final ObjectId oldId, final ObjectId newId,
+ final String name, final Type type) {
+ this.oldId = oldId;
+ this.newId = newId;
+ this.name = name;
+ this.type = type;
+ }
+
/** @return the old value the client thinks the ref has. */
public ObjectId getOldId() {
return oldId;

Back to the top