Reputation: 194
I have manually made changes on the test repository. Also, I have verified it using git status from cmd line. I am trying to commit this change programmatically using jgit. When I execute the below code, the commit happens successfully. However, the changes which I made is not reflecting. It's just an empty commit without any changes. Can anyone suggest a solution for this?
public static void commit(Git target) {
try {
target.add().addFilepattern("*.*").call();
target.commit().setMessage("test commit").call();
} catch (GitAPIException e) {
e.printStackTrace();
}
}
Upvotes: 1
Views: 749
Reputation: 44962
As per AddCommand.addFilepattern()
method docs:
filepattern - File to add content from. Also a leading directory name (e.g. dir to add dir/file1 and dir/file2) can be given to add all files in the directory, recursively. Fileglobs (e.g. *.c) are not yet supported.
Which suggests that you should specify the path to the working directory e.g. addFilepattern(".")
.
Upvotes: 2