I hope this is the appropriate place to ask questions regarding the JGit code. I am attempting to mimic the result of the following git command:
git blame filename.txt
I would like to identify the author associated with each line in the file. I have the following code:
Repository repo = new FileRepository("myrepo/.git"); BlameGenerator bg = new BlameGenerator(repo, "myrepo/filename.txt"); //the queue in bg is null System.out.println("result path: " + bg.getResultPath()); //this is fine
bg.push(null, repo.resolve("HEAD")); //is push necessary?, this populates the queue? BlameResult br = bg.computeBlameResult(); //br is null after this point
Based on reading the code, it appears the queue in BlameGenerator starts off empty and then is modified based on push and pop operations. My questions are:
1) When should push/pull be used?
2) The BlameResult that is getting returned is null which suggests based on the code that the file doesn't exist, but I can create a File() and check the exists() value for "myrepo/filename.txt" and it's fine.
Is there something I'm missing or not understanding about this structure?