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

Allow to configure the git blame command to suppress whitespace changes

      Sometimes the git blame command does not find the right person as there were whitespace changes (e.g. due to formatting) or code was moved. In this case it is possible to use "git blame -w -M" to suppress commits that only contain those changes and get better results

      I suggest to make the used git blame command configurable.

       

      There are two possible places:

      1. in the global configuration.
      2. in the warnings step itself.

      As the implementation in the global settings is much easier I guess it could be done there. The only reason not to have it there would be to have different settings for different parsers (e.g. if you have one parser in the job that would be sensitive to whitespace changes).

          [JENKINS-55719] Allow to configure the git blame command to suppress whitespace changes

          Ulli Hafner added a comment -

          I think it would make sense to provide that as part of the IssuesRecorder then it can be adapted for each job.

          Ulli Hafner added a comment - I think it would make sense to provide that as part of the IssuesRecorder then it can be adapted for each job.

          Yes, I agree. This would allow maximum flexibility. For me this would be an ideal solution

          Till Steinbach added a comment - Yes, I agree. This would allow maximum flexibility. For me this would be an ideal solution

          Since newer versions of git allow one to ignore specific sha's (Reference), perhaps this could be opened up to allowing arbitrary `git blame` arguments?

          Probably out-of-scope for this issue and requires a new issue, but for Git 2.23 and forward, maybe add configuration options specifically for `-ignore-rev` and `-ignore-revs-file`.

          Timothy Brackett added a comment - Since newer versions of git allow one to ignore specific sha's ( Reference ), perhaps this could be opened up to allowing arbitrary `git blame` arguments? Probably out-of-scope for this issue and requires a new issue, but for Git 2.23 and forward, maybe add configuration options specifically for `- ignore-rev` and ` -ignore-revs-file`.

          I like brackett_tcs approach, I guessed that it should already work by setting the config option  "git config blame.ignoreRevsFile .git-blame-ignore-revs" to my file. On the console in the workspace this works, unfortunately it makes no difference for the forensics plugon. Is that a shortcoming of jgit?

          Till Steinbach added a comment - I like brackett_tc s approach, I guessed that it should already work by setting the config option  "git config blame.ignoreRevsFile .git-blame-ignore-revs" to my file. On the console in the workspace this works, unfortunately it makes no difference for the forensics plugon. Is that a shortcoming of jgit?

          Ulli Hafner added a comment -

          I'm not sure if I understand your comment. Did you actually change the code of the git-forensics plugin? Or where did you set this option?

          Ulli Hafner added a comment - I'm not sure if I understand your comment. Did you actually change the code of the git-forensics plugin? Or where did you set this option?

          I set the option after the scm checkout expecting that the git-plugin would use the .git/config file

          Till Steinbach added a comment - I set the option after the scm checkout expecting that the git-plugin would use the .git/config file

          Ulli Hafner added a comment -

          I see. I don't know if that is possible with Jenkins GitClient implementation (or with the underlying JGit library).

          Ulli Hafner added a comment - I see. I don't know if that is possible with Jenkins GitClient implementation (or with the underlying JGit library).

          Doesn't look like it is possible right now: https://bugs.eclipse.org/bugs/show_bug.cgi?id=559671 I was not aware that the forensics plugin uses JGit directly. I thought it is using the git client plugin that has the commandline tool as default

          Till Steinbach added a comment - Doesn't look like it is possible right now:  https://bugs.eclipse.org/bugs/show_bug.cgi?id=559671  I was not aware that the forensics plugin uses JGit directly. I thought it is using the git client plugin that has the commandline tool as default

            Unassigned Unassigned
            tstein Till Steinbach
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: