Browse Source

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
stable-2.0
Dave Borowitz 13 years ago committed by Shawn O. Pearce
parent
commit
4a01f47e82
  1. 22
      org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceiveCommand.java

22
org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceiveCommand.java

@ -160,6 +160,28 @@ public class ReceiveCommand {
status = Result.NOT_ATTEMPTED; 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. */ /** @return the old value the client thinks the ref has. */
public ObjectId getOldId() { public ObjectId getOldId() {
return oldId; return oldId;

Loading…
Cancel
Save