From 36af9d92df98460a732cbc27b3a55ff6998739f3 Mon Sep 17 00:00:00 2001 From: Ignas Mikalajunas Date: Thu, 15 Aug 2024 02:23:40 +0300 Subject: [PATCH] Correctly handle loading of peeled/unpeeled refs (no idea how to test it) --- .../java/lt/pow/nukagit/dfs/NukagitDfsRepository.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/lt/pow/nukagit/dfs/NukagitDfsRepository.java b/src/main/java/lt/pow/nukagit/dfs/NukagitDfsRepository.java index 1cfeb59..ebabc09 100644 --- a/src/main/java/lt/pow/nukagit/dfs/NukagitDfsRepository.java +++ b/src/main/java/lt/pow/nukagit/dfs/NukagitDfsRepository.java @@ -128,6 +128,14 @@ private Ref toJgitRef(HashMap allRefMap, DfsRef dfsRef) { if (dfsRef.isSymbolic()) { DfsRef target = allRefMap.get(dfsRef.target()); return new SymbolicRef(dfsRef.name(), toJgitRef(allRefMap, target)); + } else if (dfsRef.isPeeled()) { + if (dfsRef.peeledRef() == null) { + return new ObjectIdRef.PeeledNonTag( + Ref.Storage.LOOSE, dfsRef.name(), ObjectId.fromString(dfsRef.objectID())); + + } + return new ObjectIdRef.PeeledTag( + Ref.Storage.LOOSE, dfsRef.name(), ObjectId.fromString(dfsRef.objectID()), ObjectId.fromString(dfsRef.peeledRef())); } return new ObjectIdRef.Unpeeled( Ref.Storage.LOOSE, dfsRef.name(), ObjectId.fromString(dfsRef.objectID()));