diff options
author | Junio C Hamano <gitster@pobox.com> | 2024-04-01 13:21:33 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-04-01 13:21:33 -0700 |
commit | ccdc7d98bb39aad1dc1bc78357a763d10fe14ddb (patch) | |
tree | 34fde699f6ff8d34ee660fc616eade80242baa4f /t | |
parent | d6fd04375f9196f8b203d442f235bd96a1a068cc (diff) | |
parent | 5a99c1ac1a9640f7ee0374e9b90523f500bdbb5a (diff) | |
download | git-ccdc7d98bb39aad1dc1bc78357a763d10fe14ddb.tar.gz |
Merge branch 'pw/checkout-conflict-errorfix'
"git checkout --conflict=bad" reported a bad conflictStyle as if it
were given to a configuration variable; it has been corrected to
report that the command line option is bad.
* pw/checkout-conflict-errorfix:
checkout: fix interaction between --conflict and --merge
checkout: cleanup --conflict=<style> parsing
merge options: add a conflict style member
merge-ll: introduce LL_MERGE_OPTIONS_INIT
xdiff-interface: refactor parsing of merge.conflictstyle
Diffstat (limited to 't')
-rwxr-xr-x | t/t7201-co.sh | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/t/t7201-co.sh b/t/t7201-co.sh index 10cc6c4605..42352dc0db 100755 --- a/t/t7201-co.sh +++ b/t/t7201-co.sh @@ -631,6 +631,72 @@ test_expect_success 'checkout --conflict=diff3' ' test_cmp merged file ' +test_expect_success 'checkout --conflict=diff3 --no-conflict does not merge' ' + setup_conflicting_index && + echo "none of the above" >expect && + cat expect >fild && + cat expect >file && + test_must_fail git checkout --conflict=diff3 --no-conflict -- fild file 2>err && + test_cmp expect file && + test_cmp expect fild && + echo "error: path ${SQ}file${SQ} is unmerged" >expect && + test_cmp expect err +' + +test_expect_success 'checkout --conflict=diff3 --no-merge does not merge' ' + setup_conflicting_index && + echo "none of the above" >expect && + cat expect >fild && + cat expect >file && + test_must_fail git checkout --conflict=diff3 --no-merge -- fild file 2>err && + test_cmp expect file && + test_cmp expect fild && + echo "error: path ${SQ}file${SQ} is unmerged" >expect && + test_cmp expect err +' + +test_expect_success 'checkout --no-merge --conflict=diff3 does merge' ' + setup_conflicting_index && + echo "none of the above" >fild && + echo "none of the above" >file && + git checkout --no-merge --conflict=diff3 -- fild file && + echo "ourside" >expect && + test_cmp expect fild && + cat >expect <<-\EOF && + <<<<<<< ours + ourside + ||||||| base + original + ======= + theirside + >>>>>>> theirs + EOF + test_cmp expect file +' + +test_expect_success 'checkout --merge --conflict=diff3 --no-conflict does merge' ' + setup_conflicting_index && + echo "none of the above" >fild && + echo "none of the above" >file && + git checkout --merge --conflict=diff3 --no-conflict -- fild file && + echo "ourside" >expect && + test_cmp expect fild && + cat >expect <<-\EOF && + <<<<<<< ours + ourside + ======= + theirside + >>>>>>> theirs + EOF + test_cmp expect file +' + +test_expect_success 'checkout with invalid conflict style' ' + test_must_fail git checkout --conflict=bad 2>actual -- file && + echo "error: unknown conflict style ${SQ}bad${SQ}" >expect && + test_cmp expect actual +' + test_expect_success 'failing checkout -b should not break working tree' ' git clean -fd && # Remove untracked files in the way git reset --hard main && |