Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Problems locating multiple tags that reference the same commit (Using List<Ref> call = git.tagList().call(); does not return all tags.)
Problems locating multiple tags that reference the same commit [message #1795753] Fri, 28 September 2018 01:08
Mike Engledew is currently offline Mike EngledewFriend
Messages: 1
Registered: September 2018
Junior Member
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?
Many thanks.
Previous Topic:Remove/add file to some commit
Next Topic:Running a Local Language Server in a Docker Container
Goto Forum:
  


Current Time: Fri Apr 19 13:32:45 GMT 2024

Powered by FUDForum. Page generated in 0.02398 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top