This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-scm.git


The following commit(s) were added to refs/heads/master by this push:
     new c4bbee338 [SCM-1029] Fix empty commits on JGit checkin
c4bbee338 is described below

commit c4bbee338746f1979e13c8266c689db2c0ad6bd1
Author: Markus Hoffrogge <mhoffro...@gmail.com>
AuthorDate: Tue Apr 1 01:28:32 2025 +0200

    [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
---
 .../scm/provider/git/jgit/command/checkin/JGitCheckInCommand.java  | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git 
a/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
 
b/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
index 3b123904f..d248860e2 100644
--- 
a/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
+++ 
b/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
@@ -89,7 +89,10 @@ protected CheckInScmResult executeCheckInCommand(
                 // add files first
                 doCommit = JGitUtils.addAllFiles(git, fileSet).size() > 0;
                 if (!doCommit) {
-                    doCommit = git.status().call().hasUncommittedChanges();
+                    Status status = git.status().call();
+                    doCommit = status.getAdded().size() > 0
+                            || status.getChanged().size() > 0
+                            || status.getRemoved().size() > 0;
                 }
             } else {
                 // add all tracked files which are modified manually
@@ -132,6 +135,8 @@ protected CheckInScmResult executeCheckInCommand(
                         logger.debug("in commit: " + scmFile);
                     }
                 }
+            } else {
+                logger.info("nothing to commit");
             }
 
             if (repo.isPushChanges()) {

Reply via email to