Hi all,

I have created a patch[1][2] for Apache Dubbo 3.0 branch to reformat the
newlines separator for all source files to Unix style.
Also, end lines with LF checker is enabled defaultly in Github Actions.
Please note that this[3] requires that all new files should end with the LF
line separator.

[1] https://github.com/apache/dubbo/pull/8019
[2] https://github.com/apache/dubbo/pull/8027
[3] https://checkstyle.sourceforge.io/config_misc.html#NewlineAtEndOfFile

Thanks,
Albumen Kevin


On Mon, May 31, 2021 at 5:59 PM Ian Luo <[email protected]> wrote:

> +1. Dubbo 3.0 is a chance to fix this particular issue completely.
>
> -Ian.
>
> On Sat, May 22, 2021 at 4:35 PM Albumen Kevin <[email protected]> wrote:
>
> > Hi community,
> >
> > In apache/dubbo, there are a great amount of source files using CR LF
> > newline format due to Windows System.
> >
> > If contributors change these files, the git and IDE will
> > automatically reformat the files to LF newline format as default.
> >
> > It is possible for users to prevent this. That is setting `git config
> > --global core.autocrlf false`[1], but this will cause
> > IDE to warn users to remove this setting[2]. I have tried to create a
> > patch[3] for this, but it just works for new contributors,
> > who clone the repo after this pr.
> >
> > Git best practices recommend that all the files in repo are using LF
> > newline format and not only Git client in Windows but
> > Intellij IDEA has already made this action default for many years.
> >
> > There is a solution that is reformatting all source files at once and
> > adding a restricted code format checker to prevent users
> > from submitting CR LF newline format files. But this will cause that we
> > cannot easily track the source file's history previous
> > version by git blame[4]. In the file's history, there will be a node that
> > changes all lines, but we can still find the real previous
> > version by finding the reformatting commit's parent, which is the real
> > version of the history. The reformatting commit will be
> > a little like the pr[5][6] in dubbo-samples when removing golang samples.
> >
> > What do you think about this? Shall we make such a change to make all
> > source files more cleaner.
> >
> > [1] https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration
> > [2]
> >
> >
> https://blog.jetbrains.com/idea/2012/10/better-line-endings-managing-in-intellij-idea-12/
> > [3] https://github.com/apache/dubbo/pull/7229
> > [4] https://git-scm.com/docs/git-blame
> > [5]
> >
> >
> https://github.com/apache/dubbo-samples/commit/19f02c2dc8a95cf18de33077bd1967ab048f462f
> > [6]
> >
> >
> https://github.com/apache/dubbo-samples/commits/19f02c2dc8a95cf18de33077bd1967ab048f462f/dubbo-samples-annotation/src/main/java/org/apache/dubbo/samples/annotation/api/GreetingService.java
> >
> > Thanks,
> > Albumen Kevin
> >
>

Reply via email to