Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-64902

git scm exclude not working, if more then one extension is enabled

XMLWordPrintable

      the code logic in https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/GitSCM.java#L2040-L2058

       

      has a bug, it is not implementing the behavior described in https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/extensions/GitSCMExtension.java#L58-L60

       

      what should happen is, that the first extension that return true of false value is returned. only if the extension return null, other extensions should be check.

       

      but what actually happens is, that if a extension returns true. it will loop thru the other extensions, instead of returning the actual value.

       

      a possible fix for this, that fits the documented behavior could look like this:

       

                  int idx=0;
                  for (String line : revShow) {
                      if (line.startsWith("commit ") && idx!=0) {
                          boolean showEntireCommitSummary = GitChangeSet.isShowEntireCommitSummaryInChanges() || !(git instanceof CliGitAPIImpl);
                          GitChangeSet change = new GitChangeSet(revShow.subList(start,idx), getExtensions().get(AuthorInChangelog.class)!=null, showEntireCommitSummary);                    Boolean excludeThisCommit=null;
                          for (GitSCMExtension ext : extensions) {
                              excludeThisCommit = ext.isRevExcluded(this, git, change, listener, buildData);
                              if(excludeThisCommit!=null)
                                  return excludeThisCommit;
                          }
                      }
                      idx++;

      please review and check.

      i marked this as critical, since it prevents exclusions form functioning.

            Unassigned Unassigned
            schlitzered Stephan Schultchen
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: