git - Accessing modified files in repository using JGit -


i using jgit access local repository using java. need access changed files of repository typically executed using git status command in git. jgit implementation command?

so need jgit representation of typical:

git status

my current implementation:

private void initrepository(string path){     try {         file worktree = new file(path);         git git = git.open(worktree);         //i need modified/changed files here          } catch (ioexception ex) {         //handle exception     } } 

the equivalent of git status command can run follows

status status = git.status().call(); 

with various bits of information being retrieved status object:

system.out.println("added: " + status.getadded()); system.out.println("changed: " + status.getchanged()); system.out.println("conflicting: " + status.getconflicting()); system.out.println("conflictingstagestate: " + status.getconflictingstagestate()); system.out.println("ignorednotinindex: " + status.getignorednotinindex()); system.out.println("missing: " + status.getmissing()); system.out.println("modified: " + status.getmodified()); system.out.println("removed: " + status.getremoved()); system.out.println("untracked: " + status.getuntracked()); system.out.println("untrackedfolders: " + status.getuntrackedfolders()); 

source: jgit cookbook


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -