All of lore.kernel.org
 help / color / mirror / Atom feed
* cherry-pick -Xrenormalize fails with formerly CRLF files
@ 2016-11-28  6:19 Eevee (Lexy Munroe)
  2016-11-28 15:54 ` Torsten Bögershausen
  0 siblings, 1 reply; 3+ messages in thread
From: Eevee (Lexy Munroe) @ 2016-11-28  6:19 UTC (permalink / raw)
  To: git

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: cherry-pick -Xrenormalize fails with formerly CRLF files
  2016-11-28  6:19 cherry-pick -Xrenormalize fails with formerly CRLF files Eevee (Lexy Munroe)
@ 2016-11-28 15:54 ` Torsten Bögershausen
  2016-11-29  0:27   ` Eevee (Lexy Munroe)
  0 siblings, 1 reply; 3+ messages in thread
From: Torsten Bögershausen @ 2016-11-28 15:54 UTC (permalink / raw)
  To: eevee.reply; +Cc: git

On Sun, Nov 27, 2016 at 10:19:35PM -0800, Eevee (Lexy Munroe) wrote:
> 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]
> 

Which version of Git are you using, what does
git --version
say?


> 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.  :)
>
I am not sure either.
Could you send me the diff you made ?
git diff

I am happy to look into it, (in the amount of time I have).

> 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.

This is what I tried:

user@pc:~/NoBackup> cd zdoom/          9fb2daf58e9d512170859302a1ac0ea9c2ec5993                                      t9fb2daf5Note: checking out '9fb2daf58e9d512170859302a1ac0ea9c2ec5993'.02a1ac0ea9c2ec5993 

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 9fb2daf... - Force use of GL nodes when 3D floors are present. - Move MAPINFO line modification flags into P_AdjustLine().
user@pc:~/NoBackup/zdoom> git format-patch HEAD^..HEAD --stdout >9fb2daf.patch
user@pc:~/NoBackup/zdoom> git format-patch HEAD^..HEAD --stdout | tr -d "\r" >9fb2daf-noCRLF.patch
user@pc:~/NoBackup/zdoom> git checkout 6384e81d0f135a2c292ac3e874f6fe26093f45b1
Previous HEAD position was 9fb2daf... - Force use of GL nodes when 3D floors are present. - Move MAPINFO line modification flags into P_AdjustLine().
HEAD is now at 6384e81... - Add support for Skulltag ACS IsNetworkGame.
user@pc:~/NoBackup/zdoom> git cherry-pick 9fb2daf58e9d512170859302a1ac0ea9c2ec5993'.02a1ac0ea9c2ec5993
> 
user@pc:~/NoBackup/zdoom> git cherry-pick 9fb2daf58e9d512170859302a1ac0ea9c2ec5993
error: could not apply 9fb2daf... - Force use of GL nodes when 3D floors are present.
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
user@pc:~/NoBackup/zdoom> git status
HEAD detached at 6384e81
You are currently cherry-picking commit 9fb2daf.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)

        both modified:   src/p_setup.cpp

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        9fb2daf-noCRLF.patch
        9fb2daf.patch

no changes added to commit (use "git add" and/or "git commit -a")
user@pc:~/NoBackup/zdoom> git cherry-pick --abort
user@pc:~/NoBackup/zdoom> git am < 9fb2daf-noCRLF.patch 
Applying: - Force use of GL nodes when 3D floors are present. - Move MAPINFO line modification flags into P_AdjustLine().
error: patch failed: src/p_setup.cpp:1798
error: src/p_setup.cpp: patch does not apply
Patch failed at 0001 - Force use of GL nodes when 3D floors are present. - Move MAPINFO line modification flags into P_AdjustLine().
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".



The patch did not apply, but for different reasons.

Could you send us, what exactly you did, to help me out ?

 




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: cherry-pick -Xrenormalize fails with formerly CRLF files
  2016-11-28 15:54 ` Torsten Bögershausen
@ 2016-11-29  0:27   ` Eevee (Lexy Munroe)
  0 siblings, 0 replies; 3+ messages in thread
From: Eevee (Lexy Munroe) @ 2016-11-29  0:27 UTC (permalink / raw)
  To: Torsten Bögershausen; +Cc: git

On 11/28/2016 07:54 AM, Torsten Bögershausen wrote:
> On Sun, Nov 27, 2016 at 10:19:35PM -0800, Eevee (Lexy Munroe) wrote:
>> 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]
>>
>
> Which version of Git are you using, what does
> git --version
> say?

Oh, sorry.  2.10.2, but I also tried building next (c8190e7) with the 
same result.

>> 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.  :)
>>
> I am not sure either.
> Could you send me the diff you made ?
> git diff
>
> I am happy to look into it, (in the amount of time I have).

It's pretty straightforward:

diff --git a/convert.c b/convert.c
index be91358..f9ff6a5 100644
--- a/convert.c
+++ b/convert.c
@@ -275,6 +275,8 @@ static int crlf_to_git(const char *path, const char 
*src, size_t len,
         /* Optimization: No CRLF? Nothing to convert, regardless. */
         convert_crlf_into_lf = !!stats.crlf;

+       if (checksafe == SAFE_CRLF_RENORMALIZE)
+               checksafe = SAFE_CRLF_FALSE;
         if (crlf_action == CRLF_AUTO || crlf_action == CRLF_AUTO_INPUT 
|| crlf_action == CRLF_AUTO_CRLF) {
                 if (convert_is_binary(len, &stats))
                         return 0;

(The new lines are copied from the block immediately following, just 
past where the context ends.)

>> 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.
>
> This is what I tried:
>
> ...
>
> The patch did not apply, but for different reasons.
>
> Could you send us, what exactly you did, to help me out ?

I did notice it works when there's a conflict, but I thought I 
specifically named a commit that applied cleanly.  Apparently not, 
sorry.  Try ddba3dd325054e71d48634cb19708cb7bcd8f20b:

eevee@perushian ~/dev-foreign/zdoom.git/src ⚘ git checkout -b 
git-renormalize-test 6384e81d0f135a2c292ac3e874f6fe26093f45b1
Switched to a new branch 'git-renormalize-test'
eevee@perushian ~/dev-foreign/zdoom.git/src ⚘ git cherry-pick 
-Xrenormalize ddba3dd325054e71d48634cb19708cb7bcd8f20b
fatal: CRLF would be replaced by LF in src/r_plane.cpp.


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-29  0:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-28  6:19 cherry-pick -Xrenormalize fails with formerly CRLF files Eevee (Lexy Munroe)
2016-11-28 15:54 ` Torsten Bögershausen
2016-11-29  0:27   ` Eevee (Lexy Munroe)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.