line-endings

How can I normalize the EOL character in Java?

若如初见. 提交于 2019-12-03 01:15:15
I have a linux server and many clients with many operating systems. The server takes an input file from clients. Linux has end of line char LF, while Mac has end of line char CR, and Windows has end of line char CR+LF The server needs as end of line char LF. Using java, I want to ensure that the file will always use the linux eol char LF. How can I achieve it? lalli Combining the two answers (by Visage & eumiro): EDIT: After reading the comment. line. System.getProperty("line.separator") has no use then. Before sending the file to server, open it replace all the EOLs and writeback Make sure to

How to fix inconsistent line endings for whole VS solution?

纵然是瞬间 提交于 2019-12-02 17:52:42
Visual Studio will detect inconsistent line endings when opening a file and there is an option to fix it for that specific file. However, if I want to fix line endings for all files in a solution, how do I do that? Just for a more complete answer, this worked best for me: Replace (?<!\r)\n with \r\n in entire solution with "regEx" option. This will set the correct line ending in all files which didn't have the correct line ending so far. It uses the negative lookahead to check for the non-existance of a \r in front of the \n. Be careful with the other solutions: They will either modify all

How can I write a ESLint rule for “linebreak-style”, changing depending on Windows or Unix?

拟墨画扇 提交于 2019-12-02 15:49:40
As we all know, the linebreaks (new line) used in Windows are usually carriage returns (CR) followed by a line feed (LF) i.e. (CRLF) whereas, Linux and Unix use a simple line feed (LF) Now, in my case, my build server uses supports Linux and Unix format so, below rule is working perfectly on build server: linebreak-style: ["error", "unix"] But I am doing development on Windows and I need to update rule on each git pull/git push as below, linebreak-style: ["error", "windows"] So, is there any way to write a generic linebreak-style rule to support both environments, Linux/Unix and Windows? Note

How to make git understand Mac (CR) line endings

痴心易碎 提交于 2019-12-01 20:23:57
For some reasons one of my files contains old style Mac line endings (after editing on OSX). These are "CR" (carriage return) characters and show up as ^M in git diff . Git does not understand that they are line ending codes (really how hard can it be?) and interprets the whole file as a single line. I know that I can convert the files to LF or CRLF endings and then commit them back, however since git automatically converts my Windows (CRLF) line endings to LF, I was hoping that it would take care of CR line endings as well. Is there a way to make git interpret CR as a line ending? TL;DR

Git - Windows AND linux line-endings

此生再无相见时 提交于 2019-12-01 17:25:05
My main OS is windows 10. I have an Ubuntu 14.04 box running in Vagrant that I develop my applications on. The box is running SMB which gives me root file access to the Ubuntu server. On the Ubuntu server I have my application files in a GIT repo with a gitlab server as the origin. I run SourceTree on my windows machine that connects to the ubuntu GIT repo through the SMB share (so I assume it uses my Windows GIT installation). Git status on the ubuntu machine gives no changes. Git status on Windows and SourceTree indicate that all the files have changed (because of the line endings). What

Git - Windows AND linux line-endings

纵然是瞬间 提交于 2019-12-01 16:15:17
问题 My main OS is windows 10. I have an Ubuntu 14.04 box running in Vagrant that I develop my applications on. The box is running SMB which gives me root file access to the Ubuntu server. On the Ubuntu server I have my application files in a GIT repo with a gitlab server as the origin. I run SourceTree on my windows machine that connects to the ubuntu GIT repo through the SMB share (so I assume it uses my Windows GIT installation). Git status on the ubuntu machine gives no changes. Git status on

TMemo cannot handle Unix text (LF as line ending) correctly

偶尔善良 提交于 2019-12-01 13:23:18
TMemo cannot handle Unix enters (LF) correctly. Two lines separated with a LF are shown and treated as one line. I want to handle all possible text formating (Mac, Win, Unix). Obviously I could check the text and replace the LF with CRLF every time I: load text form file paste text use the Add() function use the Insert() function use the Appen() function change the content via Text property But this won't be an elegant solution. Lazarus solved this problem with the Lines.TextLineBreakStyle property. There is anything similar in Delphi XE? You're asking specifically about line-ending sequences,

On git line-endings again

。_饼干妹妹 提交于 2019-12-01 08:03:54
All of our developers work on windows machines and build is done on Linux. In order to conform the true way we decided to normalize line endings and follow scenario described on GitHub . Later it appeared that from time to time when switching from one branch to another, some files are marked as changed while no content changes are detected. Then I came across with GitBook documentation on line endings and its normalization. So I wonder what is the difference between these two approaches? : git rm --cached -r . # Remove everything from the index. git reset --hard # Write both the index and

Changing one character in a file leads to MSysGit thinking the whole file has changed

岁酱吖の 提交于 2019-12-01 05:02:58
问题 I have a git repository containing C# code, and I'm running MSysGit on Windows. core.autocrlf is turned on, and I'm using the .gitattributes from this question, and I "renormalised" my repo as mentioned at the bottom of this Github guide. Now for some of the .cs files in my repository, if I change even one character, MSysGit thinks the whole file has changed. I cloned the repository fresh. I tried editing the file first in Visual Studio, but then I tried opening it in SciTE which shows me

git show modify files but i don't change anything git reset did not work

穿精又带淫゛_ 提交于 2019-12-01 04:11:08
I clone repository switch to my branch and when i print git status i see modify files, i try to do git reset --hard but there was no effect :(( git status On branch release Changes not staged for commit: modified: htdocs/fonts/OfficinaSansBoldC.eot modified: htdocs/fonts/OfficinaSansBoldC.svg modified: htdocs/fonts/OfficinaSansBoldC.ttf modified: htdocs/fonts/OfficinaSansBoldC.woff modified: htdocs/fonts/OfficinaSansC-Book.eot modified: htdocs/fonts/OfficinaSansC-Book.svg modified: htdocs/fonts/OfficinaSansC-Book.ttf modified: htdocs/fonts/OfficinaSansC-Book.woff no changes added to commit git