]> source.dussan.org Git - jgit.git/commitdiff
Initialise ReceiveCommand status to NOT_ATTEMPTED for all constructors 25/21225/2
authorRoberto Tyley <roberto.tyley@gmail.com>
Wed, 29 Jan 2014 00:01:53 +0000 (00:01 +0000)
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>
Thu, 13 Feb 2014 22:45:41 +0000 (17:45 -0500)
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>
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefDirectoryTest.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceiveCommand.java

index a821e948e795e283df59a8f28dbc4d1cf7519a58..87b917636848b1bf19ba3deb14f476cafd9b368c 100644 (file)
@@ -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 {
index 37da6c646254418d68b11ca8cb8a245d11c6ae05..7c44dba4a254c234e0b30cdf7f113a665aba5914 100644 (file)
@@ -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;
        }
 
        /**