Looping over commits for a file with jGit

前端 未结 4 1483
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-28 10:12

I\'ve managed to get to grips with the basics of jGit file in terms of connecting to a repos and adding, commiting, and even looping of the commit messages for the files.

4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-28 10:31

    The general approach with git to find the history of a specific file is to walk through the revision graph (which you are doing) and for each one, test the object referred to by the path in question (can be either a blob or a tree to find the history for an entire subtree). So essentially act as a filter on the revision set output by the revision walker.

    The jgit documentation seems... sparse. But you should be able to get a RevTree corresponding to each RevCommit, and if necessarily walk through that with each path segment in turn down to a terminal object ID.

提交回复
热议问题