diff options
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java | 8 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java | 24 |
2 files changed, 16 insertions, 16 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java index 7ef713bf45..9c43c0b0a4 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java @@ -1367,13 +1367,13 @@ public class UploadPackTest { PacketLineIn.END); PacketLineIn pckIn = new PacketLineIn(recvStream); - // wanted-refs appears first, then shallow-info. - assertThat(pckIn.readString(), is("wanted-refs")); - assertThat(pckIn.readString(), is(child.toObjectId().getName() + " refs/heads/branch1")); - assertThat(pckIn.readString(), theInstance(PacketLineIn.DELIM)); + // shallow-info appears first, then wanted-refs. assertThat(pckIn.readString(), is("shallow-info")); assertThat(pckIn.readString(), is("shallow " + child.toObjectId().getName())); assertThat(pckIn.readString(), theInstance(PacketLineIn.DELIM)); + assertThat(pckIn.readString(), is("wanted-refs")); + assertThat(pckIn.readString(), is(child.toObjectId().getName() + " refs/heads/branch1")); + assertThat(pckIn.readString(), theInstance(PacketLineIn.DELIM)); assertThat(pckIn.readString(), is("packfile")); parsePack(recvStream); assertTrue(client.hasObject(child.toObjectId())); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java index c093e8b1db..3ad350d0db 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java @@ -1083,18 +1083,6 @@ public class UploadPack { } if (doneReceived || okToGiveUp()) { - if (!wantedRefs.isEmpty()) { - if (sectionSent) { - pckOut.writeDelim(); - } - pckOut.writeString("wanted-refs\n"); //$NON-NLS-1$ - for (Map.Entry<String, ObjectId> entry : wantedRefs.entrySet()) { - pckOut.writeString(entry.getValue().getName() + ' ' + - entry.getKey() + '\n'); - } - sectionSent = true; - } - if (shallowCommits != null) { if (sectionSent) pckOut.writeDelim(); @@ -1108,6 +1096,18 @@ public class UploadPack { sectionSent = true; } + if (!wantedRefs.isEmpty()) { + if (sectionSent) { + pckOut.writeDelim(); + } + pckOut.writeString("wanted-refs\n"); //$NON-NLS-1$ + for (Map.Entry<String, ObjectId> entry : wantedRefs.entrySet()) { + pckOut.writeString(entry.getValue().getName() + ' ' + + entry.getKey() + '\n'); + } + sectionSent = true; + } + if (sectionSent) pckOut.writeDelim(); pckOut.writeString("packfile\n"); //$NON-NLS-1$ |