Skip to content

Commit c4bbee3

Browse files
mhoffrogmichael-o
authored andcommitted
[SCM-1029] Fix empty commits on JGit checkin
- JGitCheckInCommand.java: - in case of a includes / excludes FileSet is specified then: - use OR condition of - status.getAdded().size() > 0 - status.getChanged().size() > 0 - status.getRemoved() > 0 instead of status.hasUncommittedChanges() - log info "nothing to commit" if nothing is to be commited This closes #238
1 parent 8b44e4f commit c4bbee3

File tree

1 file changed

+6
-1
lines changed
  • maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/main/java/org/apache/maven/scm/provider/git/jgit/command/checkin

1 file changed

+6
-1
lines changed

maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/main/java/org/apache/maven/scm/provider/git/jgit/command/checkin/JGitCheckInCommand.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ protected CheckInScmResult executeCheckInCommand(
8989
// add files first
9090
doCommit = JGitUtils.addAllFiles(git, fileSet).size() > 0;
9191
if (!doCommit) {
92-
doCommit = git.status().call().hasUncommittedChanges();
92+
Status status = git.status().call();
93+
doCommit = status.getAdded().size() > 0
94+
|| status.getChanged().size() > 0
95+
|| status.getRemoved().size() > 0;
9396
}
9497
} else {
9598
// add all tracked files which are modified manually
@@ -132,6 +135,8 @@ protected CheckInScmResult executeCheckInCommand(
132135
logger.debug("in commit: " + scmFile);
133136
}
134137
}
138+
} else {
139+
logger.info("nothing to commit");
135140
}
136141

137142
if (repo.isPushChanges()) {

0 commit comments

Comments
 (0)