5

Using JGit, I want to get a list of files changed on commits as is possible with git log --name-status.

Is this possible? If so, how do you do it?

Hope4You
  • 1,927
  • 4
  • 21
  • 45
Supersouth
  • 79
  • 1
  • 3

1 Answers1

3

I use a modified version of the JGitUtils from the great GitBlit-Tool:

Look at the source of the method getFilesInCommit to see how this can work (PathChangeModel is just used to hold the data.)

kostmo
  • 6,222
  • 4
  • 40
  • 51
Sonson123
  • 10,879
  • 12
  • 54
  • 72
  • 2
    That link goes directly to the master branch so the target line moves around. Here's a [more durable link](https://github.com/gitblit/gitblit/blob/3e0c6ca8a65bd4b076cac1451c9cdfde4be1d4b8/src/main/java/com/gitblit/utils/JGitUtils.java#L917) that goes to a specific commit hash so it won't change over time. – Tim Mattison Aug 18 '14 at 22:45
  • @TimMattison, thanks. Github should really have an easy "permalink". – Paul Draper Feb 28 '15 at 18:30
  • What do you do with `DiffStatFormatter.java`? Is there any update to this question? – Whitecat Oct 07 '16 at 23:08