mirror of
https://github.com/git/git.git
synced 2026-01-27 02:48:32 +00:00
Merge branch 'cherry-pick-segfault'
This branch fixes the problem where merge-recursive's add_cacheinfo() expected refresh_cache_entry() always to return a valid cache entry (but it does not do that e.g. when the file in the worktree is modified). Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
@@ -235,7 +235,7 @@ static int add_cacheinfo(struct merge_options *o,
|
||||
struct cache_entry *nce;
|
||||
|
||||
nce = refresh_cache_entry(ce, CE_MATCH_REFRESH | CE_MATCH_IGNORE_MISSING);
|
||||
if (nce != ce)
|
||||
if (nce && nce != ce)
|
||||
ret = add_cache_entry(nce, options);
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -141,4 +141,16 @@ test_expect_success 'cherry-pick "-" works with arguments' '
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user