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

cherry-pick -Xrenormalize fails with formerly CRLF files

From
EMEevee (Lexy Munroe) <eevee@veekun.com>
Date
Nov 28, 2016, 06:19 UTC
Message-ID
<777ee899-4cfb-e3b4-da0d-793fde35e412@veekun.com>

I'm working with a repo that used to be all CRLF. At some point it was changed to all LF, with `text=auto` in .gitattributes for the sake of Windows devs. I'm on Linux and have never touched any twiddles relating to line endings. I'm trying to cherry-pick some commits from before the switchover.

Straightforward cherry-picking causes entire files at a time to conflict, which I've seen before when switching from tabs to spaces. So I tried -Xrenormalize and got:

     fatal: CRLF would be replaced by LF in [path]

The error comes from check_safe_crlf, which warns if checksafe is CRLF_SAFE_WARN and dies if it's (presumably) CRLF_SAFE_FAIL. The funny thing is that it's CRLF_SAFE_RENORMALIZE.

I don't know what the semantics of this value are, but the caller (crlf_to_git) explicitly checks for CRLF_SAFE_RENORMALIZE and changes it to CRLF_SAFE_FALSE instead. But that check only happens if crlf_action is CRLF_AUTO*, and for me it's CRLF_TEXT_INPUT.

I moved the check to happen regardless of the value of crlf_action, and at least in this case, git appears to happily do the right thing. So I think this is a bug, but line endings are such a tangle that I'm really not sure. :)

The repository in question is ZDoom: https://github.com/rheit/zdoom I'm trying to cherry-pick commits from the 3dfloors3 branch (e.g., 9fb2daf58e9d512170859302a1ac0ea9c2ec5993) onto a slightly outdated master, 6384e81d0f135a2c292ac3e874f6fe26093f45b1.

Next: Torsten Bögershausen
Message 1 of 3 in “cherry-pick -Xrenormalize fails with formerly CRLF files”
  1. Eevee (Lexy Munroe)Nov 28, 2016
  2. Torsten BögershausenNov 28, 2016
  3. Eevee (Lexy Munroe)Nov 29, 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.