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

Re: git diff returns fatal error with core.safecrlf is set to true.

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 21, 2013, 21:57 UTC
Message-ID
<7vip17ktyz.fsf@alter.siamese.dyndns.org>
In-Reply-To
<7vobazo4ds.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
> The helper may want to learn a way to be told to demote that error
> to a warning.
Perhaps something like this?
 diff.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/diff.c b/diff.c
index f0b3e7c..9b4f3ac 100644
--- a/diff.c
+++ b/diff.c
@@ -2677,6 +2677,10 @@ static int diff_populate_gitlink(struct diff_filespec *s, int size_only)
 int diff_populate_filespec(struct diff_filespec *s, int size_only)
 {
 	int err = 0;
+	enum safe_crlf crlf_warn = (safe_crlf != SAFE_CRLF_FAIL
+				    ? safe_crlf
+				    : SAFE_CRLF_WARN);
+
 	if (!DIFF_FILE_VALID(s))
 		die("internal error: asking to populate invalid file.");
 	if (S_ISDIR(s->mode))
@@ -2732,7 +2736,7 @@ int diff_populate_filespec(struct diff_filespec *s, int size_only)
 		/*
 		 * Convert from working tree format to canonical git format
 		 */
-		if (convert_to_git(s->path, s->data, s->size, &buf, safe_crlf)) {
+		if (convert_to_git(s->path, s->data, s->size, &buf, crlf_warn)) {
 			size_t size = 0;
 			munmap(s->data, s->size);
 			s->should_munmap = 0;
Previous: Junio C HamanoNext: Yann Droneaud
Message 3 of 8 in “git diff returns fatal error with core.safecrlf is set to true.”
  1. Yann DroneaudJun 21, 2013
  2. Junio C HamanoJun 21, 2013
  3. Junio C HamanoJun 21, 2013
  4. Yann DroneaudJun 24, 2013
  5. Junio C HamanoJun 24, 2013
  6. Junio C HamanoJun 24, 2013
  7. Torsten BögershausenJun 25, 2013
  8. Junio C HamanoJun 26, 2013

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.