git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[JGIT PATCH/RFC] Added -crlf attribute for test patch files

From
CPConstantine Plotnikov <constantine.plotnikov@gmail.com>
Date
Apr 1, 2009, 10:59 UTC
Message-ID
<85647ef50904010359r639f5278t23c85d7c91a59d6b@mail.gmail.com>

The method RawParseUtils.nextLF(byte[],int,char) used for parsing patches expects \n as a line separator. However on MinGW git uses \r\n as line separator for text files by default, and patch files in egit/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/patch are treated as text files. This caused test suit failure. To prevent test suit failure, "-crlf" attribute is added for patch files.

Signed-off-by: Constantine Plotnikov <constantine.plotnikov@gmail.com>
---
I'm not completely sure whether I have fixed a correct place.
MinGW itself uses \n as line separator in patches. Thus I think
it is an error to have \r\n in the patch file, so I have fixed
patch files rather than parsing code. Other possible solution
is to fix nextLF() to handle \r\n as well.

Without this fix the egit could not be built on the maven when it is checked out using MinGW git.

 .../tst-rsrc/org/spearce/jgit/patch/.gitattributes |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644
org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/patch/.gitattributes
diff --git a/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/patch/.gitattributes
b/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/patch/.gitattributes
new file mode 100644
index 0000000..b38f87f
--- /dev/null
+++ b/org.spearce.jgit.test/tst-rsrc/org/spearce/jgit/patch/.gitattributes
@@ -0,0 +1 @@
+*.patch -crlf
-- 
1.6.0.2.1172.ga5ed0
Message 1 of 1 in “Added -crlf attribute for test patch files”
  1. Added -crlf attribute for test patch filesConstantine Plotnikov, Apr 1, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.