From: Junio C Hamano <gitster@pobox.com>
To: tboegi@web.de
Cc: git@vger.kernel.org, eevee.reply@veekun.com
Subject: Re: [PATCH v2 1/1] convert: git cherry-pick -Xrenormalize did not work
Date: Thu, 01 Dec 2016 10:27:37 -0800 [thread overview]
Message-ID: <xmqq1sxrbj3a.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20161130170232.19685-1-tboegi@web.de> (tboegi@web.de's message of "Wed, 30 Nov 2016 18:02:32 +0100")
tboegi@web.de writes:
> 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]
>
> Commit 65237284 "unify the "auto" handling of CRLF" introduced
> a regression:
>
> Whenever crlf_action is CRLF_TEXT_XXX and not CRLF_AUTO_XXX,
> SAFE_CRLF_RENORMALIZE was feed into check_safe_crlf().
> This is wrong because here everything else than SAFE_CRLF_WARN is
> treated as SAFE_CRLF_FAIL.
>
> Call check_safe_crlf() only if checksafe is SAFE_CRLF_WARN or SAFE_CRLF_FAIL.
>
> Reported-by: Eevee (Lexy Munroe) <eevee@veekun.com>
> Signed-off-by: Torsten Bögershausen <tboegi@web.de>
> ---
I think the description and the code match with each other much
better and the resulting code explains what is going on more
clearly. Thanks---will queue.
> convert.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/convert.c b/convert.c
> index be91358..f8e4dfe 100644
> --- a/convert.c
> +++ b/convert.c
> @@ -281,13 +281,13 @@ static int crlf_to_git(const char *path, const char *src, size_t len,
> /*
> * If the file in the index has any CR in it, do not convert.
> * This is the new safer autocrlf handling.
> + - unless we want to renormalize in a merge or cherry-pick
> */
> - if (checksafe == SAFE_CRLF_RENORMALIZE)
> - checksafe = SAFE_CRLF_FALSE;
> - else if (has_cr_in_index(path))
> + if ((checksafe != SAFE_CRLF_RENORMALIZE) && has_cr_in_index(path))
> convert_crlf_into_lf = 0;
> }
> - if (checksafe && len) {
> + if ((checksafe == SAFE_CRLF_WARN ||
> + (checksafe == SAFE_CRLF_FAIL)) && len) {
> struct text_stat new_stats;
> memcpy(&new_stats, &stats, sizeof(new_stats));
> /* simulate "git add" */
next prev parent reply other threads:[~2016-12-01 18:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <6a7e155-f399-c9f8-c69e-8164e0735dfb@veekun.com>
2016-11-29 16:30 ` [PATCH v1 1/1] convert: git cherry-pick -Xrenormalize did not work tboegi
2016-11-29 18:42 ` Junio C Hamano
2016-11-29 20:16 ` Torsten Bögershausen
2016-11-29 20:45 ` Junio C Hamano
2016-11-30 17:02 ` [PATCH v2 " tboegi
2016-12-01 18:27 ` Junio C Hamano [this message]
2016-12-01 20:07 ` Jacob Keller
2016-12-01 20:24 ` Junio C Hamano
2016-12-02 12:20 ` Torsten Bögershausen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq1sxrbj3a.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=eevee.reply@veekun.com \
--cc=git@vger.kernel.org \
--cc=tboegi@web.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).