The lacking JGit docs dont seem to say anything about how to use/detect branches while using a RevWalk.
This question says pretty much the same thing.
So my question is: How do I get the branch name/id from a RevCommit? Or how do I specify which branch to traverse before hand?
Found out a better way to do it by looping branches.
I looped over the branches by calling
for (Ref branch : git.branchList().call()){
git.checkout().setName(branch.getName()).call();
// Then just revwalk as normal.
}
Looking at the current implementation of JGit (see its git repo and its RevCommit class), I didn't find the equivalent of what is listed in "Git: Finding what branch a commit came from".
Ie:
git branch --contains <commit>
Only some of the options of git branch
are implemented (like in ListBranchCommand.java
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With