Merge branch 'jc/renormalize-merge-kill-safer-crlf' into maint
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
This commit is contained in:
commit
7479ca4b44
13
convert.c
13
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))
|
if (convert_is_binary(len, &stats))
|
||||||
return 0;
|
return 0;
|
||||||
/*
|
/*
|
||||||
* If the file in the index has any CR in it, do not convert.
|
* If the file in the index has any CR in it, do not
|
||||||
* This is the new safer autocrlf handling.
|
* convert. This is the new safer autocrlf handling,
|
||||||
|
* unless we want to renormalize in a merge or
|
||||||
|
* cherry-pick.
|
||||||
*/
|
*/
|
||||||
if (checksafe == SAFE_CRLF_RENORMALIZE)
|
if ((checksafe != SAFE_CRLF_RENORMALIZE) && has_cr_in_index(path))
|
||||||
checksafe = SAFE_CRLF_FALSE;
|
|
||||||
else if (has_cr_in_index(path))
|
|
||||||
convert_crlf_into_lf = 0;
|
convert_crlf_into_lf = 0;
|
||||||
}
|
}
|
||||||
if (checksafe && len) {
|
if ((checksafe == SAFE_CRLF_WARN ||
|
||||||
|
(checksafe == SAFE_CRLF_FAIL)) && len) {
|
||||||
struct text_stat new_stats;
|
struct text_stat new_stats;
|
||||||
memcpy(&new_stats, &stats, sizeof(new_stats));
|
memcpy(&new_stats, &stats, sizeof(new_stats));
|
||||||
/* simulate "git add" */
|
/* simulate "git add" */
|
||||||
|
@ -235,6 +235,8 @@ static int add_cacheinfo(struct merge_options *o,
|
|||||||
struct cache_entry *nce;
|
struct cache_entry *nce;
|
||||||
|
|
||||||
nce = refresh_cache_entry(ce, CE_MATCH_REFRESH | CE_MATCH_IGNORE_MISSING);
|
nce = refresh_cache_entry(ce, CE_MATCH_REFRESH | CE_MATCH_IGNORE_MISSING);
|
||||||
|
if (!nce)
|
||||||
|
return err(o, _("addinfo_cache failed for path '%s'"), path);
|
||||||
if (nce != ce)
|
if (nce != ce)
|
||||||
ret = add_cache_entry(nce, options);
|
ret = add_cache_entry(nce, options);
|
||||||
}
|
}
|
||||||
|
@ -141,4 +141,16 @@ test_expect_success 'cherry-pick "-" works with arguments' '
|
|||||||
test_cmp expect actual
|
test_cmp expect actual
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'cherry-pick works with dirty renamed file' '
|
||||||
|
test_commit to-rename &&
|
||||||
|
git checkout -b unrelated &&
|
||||||
|
test_commit unrelated &&
|
||||||
|
git checkout @{-1} &&
|
||||||
|
git mv to-rename.t renamed &&
|
||||||
|
test_tick &&
|
||||||
|
git commit -m renamed &&
|
||||||
|
echo modified >renamed &&
|
||||||
|
git cherry-pick refs/heads/unrelated
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
Loading…
Reference in New Issue
Block a user