[
https://issues.apache.org/jira/browse/HBASE-29388?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17979329#comment-17979329
]
Hudson commented on HBASE-29388:
--------------------------------
Results for branch master
[build #1307 on
builds.a.o|https://ci-hbase.apache.org/job/HBase%20Nightly/job/master/1307/]:
(x) *{color:red}-1 overall{color}*
----
details (if available):
(x) {color:red}-1 jdk17 hadoop3 checks{color}
-- For more information [see jdk17
report|https://ci-hbase.apache.org/job/HBase%20Nightly/job/master/1307/JDK17_20Nightly_20Build_20Report_20_28Hadoop3_29/]
(x) {color:red}-1 jdk17 hadoop 3.3.5 backward compatibility checks{color}
-- For more information [see jdk17
report|https://ci-hbase.apache.org/job/HBase%20Nightly/job/master/1307/JDK17_20Nightly_20Build_20Report_20_28Hadoop3_29/]
(x) {color:red}-1 source release artifact{color}
-- Something went wrong with this stage, [check relevant console
output|https://ci-hbase.apache.org/job/HBase%20Nightly/job/master/1307//console].
(x) {color:red}-1 client integration test{color}
-- Something went wrong with this stage, [check relevant console
output|https://ci-hbase.apache.org/job/HBase%20Nightly/job/master/1307//console].
> mvn spotless:apply changes line endings (CRLF to LF) on Windows
> ---------------------------------------------------------------
>
> Key: HBASE-29388
> URL: https://issues.apache.org/jira/browse/HBASE-29388
> Project: HBase
> Issue Type: Bug
> Environment: hbase master
> Reporter: guluo
> Assignee: guluo
> Priority: Major
> Labels: pull-request-available
> Fix For: 2.7.0, 3.0.0-beta-2, 2.6.3, 2.5.12
>
>
> For master branch, after executing `mvn spotless:apply` on Windows, executing
> `git diff` commands would display warnings message: "warning: LF will be
> replaced by CRLF in **", as fallow.
> warning: LF will be replaced by CRLF in CHANGES.txt.
> The file will have its original line endings in your working directory
> warning: LF will be replaced by CRLF in LICENSE.txt.
> The file will have its original line endings in your working directory
> warning: LF will be replaced by CRLF in NOTICE.txt.
> The file will have its original line endings in your working directory
> warning: LF will be replaced by CRLF in README.md.
> The file will have its original line endings in your working directory
> ...
> And core.autolf = true or unset core.autolf in my .gitconfig, the results are
> all the same.
> This issue doesn't exist on Linux, I'm unsure if it occurs on macOS.
> I checked the commit history and found that this might have been caused by
> HBASE-29344
> The reason.
> spotless may change line endings (CRLF to LF)
> spotless introduce a feature in version 2.40.0 : Set the default line
> endings to be GIT_ATTRIBUTES_FAST_ALLSAME.
> Details see:
> [https://github.com/diffplug/spotless/commit/54c0af2bb701fc1b0756b8ff1bfd568d0c43bf65]
> [https://github.com/diffplug/spotless/pull/1838/files]
> {code:java}
> // spotless
> // GitAttributesLineEndings.LazyAllTheSame.calculateState()
> protected String calculateState() throws Exception {
> var files = toFormat.get().iterator();
> if (files.hasNext()) {
> Runtime runtime = new RuntimeInit(projectDir).atRuntime();
> return runtime.getEndingFor(files.next());
> } else {
> // I suspect this code might convert some CRLF files to LF format
> after executing 'mvn spotless:apply' on Windows
> return LineEnding.UNIX.str();
> }
> } {code}
>
> My solution:
> Introduce a tag in Spotless's configuration while still using the previously
> default LineEnding.GIT_ATTRIBUTES
> <plugin>
> <groupId>com.diffplug.spotless</groupId>
> <artifactId>spotless-maven-plugin</artifactId>
> <version>${spotless.version}</version>
> <configuration>
> <lineEndings>GIT_ATTRIBUTES</lineEndings>
> </configuration>
> </plugin>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)