Expose ReceiveCommand version of TrackingRefUpdate

If the caller uses a BatchRefUpdate to execute these (e.g. fetch)
there may be more detailed status information inside of the command
that was used to execute it. Allow the caller to obtain that status
data from the ReceiveCommand version of the TrackingRefUpdate.

Change-Id: I47209377fb8fcef0346d7678f1ab27f4790b49bc
This commit is contained in:
Shawn Pearce 2014-04-18 14:03:20 -07:00
parent c8dd915c45
commit 911b115772
1 changed files with 9 additions and 2 deletions

View File

@ -58,6 +58,7 @@ public class TrackingRefUpdate {
private ObjectId newObjectId;
private RefUpdate.Result result;
private ReceiveCommand cmd;
TrackingRefUpdate(
boolean canForceUpdate,
@ -130,8 +131,14 @@ void setResult(RefUpdate.Result result) {
this.result = result;
}
ReceiveCommand asReceiveCommand() {
return new Command();
/**
* @return this update wrapped by a ReceiveCommand.
* @since 3.4
*/
public ReceiveCommand asReceiveCommand() {
if (cmd == null)
cmd = new Command();
return cmd;
}
final class Command extends ReceiveCommand {