Ignore submodules for detect local changes

This commit is contained in:
s1lent 2019-09-24 01:38:08 +07:00
parent 0b517e036f
commit 46624d95b8
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C

View File

@ -9,6 +9,7 @@ import org.eclipse.jgit.api.Status;
import org.eclipse.jgit.lib.ObjectId
import org.eclipse.jgit.lib.Repository
import org.eclipse.jgit.lib.StoredConfig
import org.eclipse.jgit.submodule.SubmoduleWalk;
import org.eclipse.jgit.revwalk.RevCommit
import org.eclipse.jgit.revwalk.RevWalk
import org.eclipse.jgit.storage.file.FileRepositoryBuilder
@ -58,10 +59,8 @@ class GitVersioner {
// check uncommited changes
static boolean getUncommittedChanges(Repository repo) {
Git git = new Git(repo);
Status status = git.status().call();
Set<String> uncommittedChanges = status.getUncommittedChanges();
for(String uncommitted : uncommittedChanges) {
Status status = git.status().setIgnoreSubmodules(SubmoduleWalk.IgnoreSubmoduleMode.ALL).call();
if (!status.getUncommittedChanges().isEmpty()) {
return true;
}