summaryrefslogtreecommitdiff
path: root/convert.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2016-12-19 14:45:30 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-12-19 14:45:30 -0800
commit1749053d0278f2a533f79915f03c379e5f738b39 (patch)
treeb4de22a11564dc1248cbce10a3d7ac1c5129e81f /convert.c
parentMerge branch 'jt/use-trailer-api-in-commands' (diff)
parentconvert: git cherry-pick -Xrenormalize did not work (diff)
downloadtgif-1749053d0278f2a533f79915f03c379e5f738b39.tar.xz
Merge branch 'jc/renormalize-merge-kill-safer-crlf'
Fix a corner case in merge-recursive regression that crept in during 2.10 development cycle. * jc/renormalize-merge-kill-safer-crlf: convert: git cherry-pick -Xrenormalize did not work merge-recursive: handle NULL in add_cacheinfo() correctly cherry-pick: demonstrate a segmentation fault
Diffstat (limited to 'convert.c')
-rw-r--r--convert.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/convert.c b/convert.c
index be91358462..4e17e45ed2 100644
--- a/convert.c
+++ b/convert.c
@@ -279,15 +279,16 @@ static int crlf_to_git(const char *path, const char *src, size_t len,
if (convert_is_binary(len, &stats))
return 0;
/*
- * If the file in the index has any CR in it, do not convert.
- * This is the new safer autocrlf handling.
+ * 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" */