line-endings

Enforce core.autocrlf=input through .gitattributes

孤街醉人 提交于 2019-12-09 11:20:27
问题 Is there a way to enforce core.autocrlf=input from within the .gitattributes in order to propagate the policy throughout my colleagues? In detail what I want is to convert to lf on add and leave as is on checkout . The problem is that neither text nor eol do what I want in .gitattributes since eol has 3 acceptable values: lf crlf native Ideally I would like my .gitattributes file to look like this: * text eol=asis 回答1: In detail what I want is to convert to lf on commit and leave as is on

Git: autocrlf=true core.eol=native vs autocrlf=input

心不动则不痛 提交于 2019-12-08 03:22:16
问题 Can somebody explain what is the difference between settings: core.autocrlf = true core.eol = native and core.autocrlf = input When we use both cases? 回答1: When [should] we use [either of these settings]? My preference is never . On the other hand, I also don't work on Windows. :-) However, if you read through all of the text below, you will see that if I did, I'd still say "never". (Even if you are sharing some upstream repository in which you're not allowed to create a .gitattributes file,

Ensure Unix-style line endings used when generating XML on Windows with Java

心已入冬 提交于 2019-12-08 01:36:15
问题 I am currently outputting an XML document to a file in Java as follows: final Document xmldoc = toXMLDocument(docTheory); // write the content into xml file TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); DOMSource source = new DOMSource(xmldoc); StreamResult result =

Why does .gitattributes not override core.autocrlf configuration on Linux?

浪子不回头ぞ 提交于 2019-12-07 17:20:23
问题 While setting up Git for a project, I've noticed that the line-ending normalization works a bit different on Linux and on Windows. As I understand the Git documentation on this subject, the behavior on Windows is the correct one. Specifically, when a .gitattributes file is present, it should override the core.autocrlf setting. The following table shows the results of some experimentation I've done. The two left-most columns shows the .gitattributes file and the core.autocrlf setting. The

How to get suppress ^M characters in my ClojureBox (EmacsW32) REPL connected to lein swank

最后都变了- 提交于 2019-12-07 17:20:14
问题 I am connecting to a swank server from my ClojureBox install. I.e. lein swank from my project directory and then M-x slime-connect from EmacsW32. However, when I do this I see the DOS line-endings everywhere in the REPL ( ^M ). I.e. user> (doc map) -------------------------^M clojure.core/map^M ([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls])^M Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of

Preserve end-of-line style when working with files in python

荒凉一梦 提交于 2019-12-06 20:47:29
问题 I am looking for a way to ensure that the end-of-line style of a file is maintained in python program while reading, editing and writing. Python has universal file ending support, which can convert all line endings to \n when the file is read, and then convert them all to the system default when the file is written. In my case I would like to still do the initial conversion, but then write the file with the original EOL style rather than the system default. Is there a standard way to do this

Verify line ending in git repo

痴心易碎 提交于 2019-12-06 14:43:53
Is there any way to verify the line endings for a file in the git repo? If I checkout then the working directory can be influenced by core.autocrlf or .gitattributes, etc. Is there anything like "svn get" that doesn't checkout but simply copies a file from the repository to my local filesystem somewhere (assuming this ignores any line ending conversion settings)? VonC If I checkout then the working directory can be influenced by core.autocrlf or .gitattributes, etc. yes, it can. Is there anything like "svn get" that doesn't checkout but simply copies a file from the repository to my local

Git: autocrlf=true core.eol=native vs autocrlf=input

最后都变了- 提交于 2019-12-06 04:56:04
Can somebody explain what is the difference between settings: core.autocrlf = true core.eol = native and core.autocrlf = input When we use both cases? When [should] we use [either of these settings]? My preference is never . On the other hand, I also don't work on Windows. :-) However, if you read through all of the text below, you will see that if I did, I'd still say "never". (Even if you are sharing some upstream repository in which you're not allowed to create a .gitattributes file, you can use the per-repository $GIT_DIR/info/attributes file in your own clone.) [What's the difference?] To

How to get suppress ^M characters in my ClojureBox (EmacsW32) REPL connected to lein swank

梦想与她 提交于 2019-12-06 04:04:38
I am connecting to a swank server from my ClojureBox install. I.e. lein swank from my project directory and then M-x slime-connect from EmacsW32. However, when I do this I see the DOS line-endings everywhere in the REPL ( ^M ). I.e. user> (doc map) -------------------------^M clojure.core/map^M ([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls])^M Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are

Why does .gitattributes not override core.autocrlf configuration on Linux?

孤街浪徒 提交于 2019-12-06 02:12:07
While setting up Git for a project, I've noticed that the line-ending normalization works a bit different on Linux and on Windows. As I understand the Git documentation on this subject, the behavior on Windows is the correct one. Specifically, when a .gitattributes file is present, it should override the core.autocrlf setting. The following table shows the results of some experimentation I've done. The two left-most columns shows the .gitattributes file and the core.autocrlf setting. The other columns shows the result of the following git commands: git rm --cached <file> (force next checkout