aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto Tyley2014-01-28 19:01:53 (EST)
committerGerrit Code Review @ Eclipse.org2014-02-13 17:45:41 (EST)
commit47f47ffc07e00109dc069e111274252e4053a599 (patch)
tree10c20429f3a49659ec2abce381fd835a2f501972
parent420cb50cc2eeaaa85cc06f605c7a61fa4798a04e (diff)
downloadjgit-47f47ffc07e00109dc069e111274252e4053a599.zip
jgit-47f47ffc07e00109dc069e111274252e4053a599.tar.gz
jgit-47f47ffc07e00109dc069e111274252e4053a599.tar.bz2
Initialise ReceiveCommand status to NOT_ATTEMPTED for all constructorsrefs/changes/25/21225/2
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>
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefDirectoryTest.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceiveCommand.java3
2 files changed, 2 insertions, 5 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefDirectoryTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefDirectoryTest.java
index a821e94..87b9176 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefDirectoryTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefDirectoryTest.java
@@ -1278,10 +1278,8 @@ public class RefDirectoryTest extends LocalDiskRepositoryTestCase {
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 {
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 37da6c6..7c44dba 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceiveCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceiveCommand.java
@@ -157,7 +157,7 @@ public class ReceiveCommand {
private Ref ref;
- private Result status;
+ private Result status = Result.NOT_ATTEMPTED;
private String message;
@@ -186,7 +186,6 @@ public class ReceiveCommand {
type = Type.CREATE;
if (ObjectId.zeroId().equals(newId))
type = Type.DELETE;
- status = Result.NOT_ATTEMPTED;
}
/**