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

[PATCH v1 1/1] convert: git cherry-pick -Xrenormalize did not work

From
tboegi@web.de <tboegi@web.de>
Date
Nov 29, 2016, 16:30 UTC
Message-ID
<20161129163023.23403-1-tboegi@web.de>
In-Reply-To
<6a7e155-f399-c9f8-c69e-8164e0735dfb@veekun.com>
From: Torsten Bögershausen <tboegi@web.de>

Working with a repo that used to be all CRLF. At some point it was changed to all LF, with `text=auto` in .gitattributes. Trying to cherry-pick a commit from before the switchover fails:

$ git cherry-pick -Xrenormalize <commit>
    fatal: CRLF would be replaced by LF in [path]

Whenever crlf_action is CRLF_TEXT_XXX and not CRLF_AUTO_XXX, SAFE_CRLF_RENORMALIZE must be turned into CRLF_SAFE_FALSE.

Reported-by: Eevee (Lexy Munroe) <eevee@veekun.com>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
---

Thanks for reporting. Here is a less invasive patch. Please let me know, if the patch is OK for you (email address, does it work..)

 convert.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/convert.c b/convert.c
index be91358..526ec1d 100644
--- a/convert.c
+++ b/convert.c
@@ -286,7 +286,9 @@ static int crlf_to_git(const char *path, const char *src, size_t len,
 			checksafe = SAFE_CRLF_FALSE;
 		else if (has_cr_in_index(path))
 			convert_crlf_into_lf = 0;
-	}
+	} else if (checksafe == SAFE_CRLF_RENORMALIZE)
+		checksafe = SAFE_CRLF_FALSE;
+
 	if (checksafe && len) {
 		struct text_stat new_stats;
 		memcpy(&new_stats, &stats, sizeof(new_stats));
-- 
2.10.0
Next: Junio C Hamano
Message 1 of 9 in “convert: git cherry-pick -Xrenormalize did not work”
  1. 1/1 convert: git cherry-pick -Xrenormalize did not worktboegi@web.de, Nov 29, 2016
  2. Junio C HamanoNov 29, 2016
  3. Torsten BögershausenNov 29, 2016
  4. Junio C HamanoNov 29, 2016
  5. 1/1 convert: git cherry-pick -Xrenormalize did not worktboegi@web.de, Nov 30, 2016
  6. Junio C HamanoDec 1, 2016
  7. Jacob KellerDec 1, 2016
  8. Junio C HamanoDec 1, 2016
  9. Torsten BögershausenDec 2, 2016

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.