@@ -64,6 +64,7 @@ private List<String> revList(ObjectId initialObjectId) throws IOException {
64
64
65
65
Repository repo = git .getRepository ();
66
66
try (RevWalk walk = new RevWalk (repo )) {
67
+ walk .setRetainBody (false );
67
68
RevCommit head = walk .parseCommit (initialObjectId );
68
69
69
70
while (true ) {
@@ -88,16 +89,19 @@ private Map<String, RefWithTagName> mapCommitsToTags(Git git) {
88
89
// Maps commit hash to list of all refs pointing to given commit hash.
89
90
// All keys in this map should be same as commit hashes in 'git show-ref --tags -d'
90
91
Map <String , RefWithTagName > commitHashToTag = new HashMap <>();
91
- for (Map .Entry <String , Ref > entry : git .getRepository ().getTags ().entrySet ()) {
92
- RefWithTagName refWithTagName = new RefWithTagName (entry .getValue (), entry .getKey ());
93
-
94
- ObjectId peeledRef = refWithTagName .getRef ().getPeeledObjectId ();
95
- if (peeledRef == null ) {
96
- // lightweight tag (commit object)
97
- updateCommitHashMap (commitHashToTag , comparator , entry .getValue ().getObjectId (), refWithTagName );
92
+ Repository repository = git .getRepository ();
93
+ for (Map .Entry <String , Ref > entry : repository .getTags ().entrySet ()) {
94
+ Ref peeledRef = repository .peel (entry .getValue ());
95
+ RefWithTagName refWithTagName = new RefWithTagName (peeledRef , entry .getKey ());
96
+
97
+ // Peel ref object
98
+ ObjectId peeledObjectId = peeledRef .getPeeledObjectId ();
99
+ if (peeledObjectId == null ) {
100
+ // Lightweight tag (commit object)
101
+ updateCommitHashMap (commitHashToTag , comparator , peeledRef .getObjectId (), refWithTagName );
98
102
} else {
99
- // annotated tag (tag object)
100
- updateCommitHashMap (commitHashToTag , comparator , peeledRef , refWithTagName );
103
+ // Annotated tag (tag object)
104
+ updateCommitHashMap (commitHashToTag , comparator , peeledObjectId , refWithTagName );
101
105
}
102
106
}
103
107
return commitHashToTag ;
0 commit comments