Initialise ReceiveCommand status to NOT_ATTEMPTED for all constructors

Formerly the 4-arg constructor did not do this, which was unfortunate
as that constructor's the only way for an external user of JGit to set
the /type/ of the ref-update - which you might want to do to indicate
that the update is expected to be a UPDATE_NONFASTFORWARD, and thus does
not require expensive isMergedInto() calculations:

http://dev.eclipse.org/mhonarc/lists/jgit-dev/msg02258.html

Change-Id: I84c5e4927131e105bed93e31a62da6367c78de32
Signed-off-by: Roberto Tyley <roberto.tyley@gmail.com>
This commit is contained in:
Roberto Tyley 2014-01-29 00:01:53 +00:00 committed by Gerrit Code Review @ Eclipse.org
parent 420cb50cc2
commit 47f47ffc07
2 changed files with 2 additions and 5 deletions

View File

@ -1278,10 +1278,8 @@ public void testBatchRefUpdateConflictThanksToDelete() throws IOException {
private static ReceiveCommand newCommand(RevCommit a, RevCommit b,
String string, Type update) {
ReceiveCommand ret = new ReceiveCommand(a != null ? a.getId() : null,
return new ReceiveCommand(a != null ? a.getId() : null,
b != null ? b.getId() : null, string, update);
ret.setResult(ReceiveCommand.Result.NOT_ATTEMPTED);
return ret;
}
private void writeLooseRef(String name, AnyObjectId id) throws IOException {

View File

@ -157,7 +157,7 @@ public static List<ReceiveCommand> filter(List<ReceiveCommand> commands,
private Ref ref;
private Result status;
private Result status = Result.NOT_ATTEMPTED;
private String message;
@ -186,7 +186,6 @@ public ReceiveCommand(final ObjectId oldId, final ObjectId newId,
type = Type.CREATE;
if (ObjectId.zeroId().equals(newId))
type = Type.DELETE;
status = Result.NOT_ATTEMPTED;
}
/**