|Problems locating multiple tags that reference the same commit [message #1795753]
||Fri, 28 September 2018 01:08
| Mike Engledew
Registered: September 2018
I have written code that uses jgit to obtain and process a list of tags on the current branch without any problems, until now.|
The code performs
Map<ObjectId, String> namedCommits = git.nameRev().addPrefix("refs/tags/").add(commit).call();
Then retrieves the information for each one using
Ref annotatedTag = repository.findRef(tagName);
RevObject any = walk.parseAny(annotatedTag.getObjectId());
By reading sample code, and experimenting I realize this might not be the most efficient method but it worked, until now, because I have more than on tag pointing at the same commit. In this situation I only ever get the first tag and am unable to "see" the others. With more reading, I came to realize this is "working as designed" and the correct procedure is
- Obtain a list of the commits your interested in.
- Obtain a list of all tags, and process them to determine if they are referencing a commit in your "interesting commits" set.
The problem I encountered is that
List<Ref> call = git.tagList().call();
Only returns a partial list of refs for tags, and in my case does not include all the tags I need to process.
(It also returns some "PeeledNonTag" instances that cause issues if you don't skip them, I am not sure what these are or what to do with them)
Is the partial list of tags a bug or am I missing something?
Powered by FUDForum
. Page generated in 0.01814 seconds