Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java29
1 files changed, 17 insertions, 12 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java
index c521e80514..f041765b8a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java
@@ -80,9 +80,12 @@ import org.eclipse.jgit.errors.TransportException;
import org.eclipse.jgit.lib.Config;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
+import org.eclipse.jgit.lib.ObjectIdRef;
import org.eclipse.jgit.lib.ProgressMonitor;
import org.eclipse.jgit.lib.Ref;
+import org.eclipse.jgit.lib.RefDirectory;
import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.lib.SymbolicRef;
import org.eclipse.jgit.lib.Config.SectionParser;
import org.eclipse.jgit.util.HttpSupport;
import org.eclipse.jgit.util.IO;
@@ -240,16 +243,17 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
br = toBufferedReader(openInputStream(conn));
try {
String line = br.readLine();
- if (line != null && line.startsWith("ref: ")) {
- Ref src = refs.get(line.substring(5));
- if (src != null) {
- refs.put(Constants.HEAD, new Ref(
- Ref.Storage.NETWORK, Constants.HEAD, src
- .getName(), src.getObjectId()));
- }
+ if (line != null && line.startsWith(RefDirectory.SYMREF)) {
+ String target = line.substring(RefDirectory.SYMREF.length());
+ Ref r = refs.get(target);
+ if (r == null)
+ r = new ObjectIdRef.Unpeeled(Ref.Storage.NEW, target, null);
+ r = new SymbolicRef(Constants.HEAD, r);
+ refs.put(r.getName(), r);
} else if (line != null && ObjectId.isId(line)) {
- refs.put(Constants.HEAD, new Ref(Ref.Storage.NETWORK,
- Constants.HEAD, ObjectId.fromString(line)));
+ Ref r = new ObjectIdRef.Unpeeled(Ref.Storage.NETWORK,
+ Constants.HEAD, ObjectId.fromString(line));
+ refs.put(r.getName(), r);
}
} finally {
br.close();
@@ -527,10 +531,11 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
if (prior.getPeeledObjectId() != null)
throw duplicateAdvertisement(name + "^{}");
- avail.put(name, new Ref(Ref.Storage.NETWORK, name, prior
- .getObjectId(), id, true));
+ avail.put(name, new ObjectIdRef.PeeledTag(
+ Ref.Storage.NETWORK, name,
+ prior.getObjectId(), id));
} else {
- final Ref prior = avail.put(name, new Ref(
+ Ref prior = avail.put(name, new ObjectIdRef.PeeledNonTag(
Ref.Storage.NETWORK, name, id));
if (prior != null)
throw duplicateAdvertisement(name);

Back to the top