From: Junio C Hamano Date: Mon, 30 Sep 2019 04:19:30 +0000 (+0900) Subject: Merge branch 'dl/use-sq-from-test-lib' X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/d693345518e9d5145902ec001a364ccdec8e148b?ds=inline;hp=-c Merge branch 'dl/use-sq-from-test-lib' Code cleanup. * dl/use-sq-from-test-lib: t: use common $SQ variable --- d693345518e9d5145902ec001a364ccdec8e148b diff --combined t/t3005-ls-files-relative.sh index 583e467683,c841f9b454..2ec69a8a26 --- a/t/t3005-ls-files-relative.sh +++ b/t/t3005-ls-files-relative.sh @@@ -7,8 -7,9 +7,6 @@@ This test runs git ls-files with variou . ./test-lib.sh - sq=\' -new_line=' -' -- test_expect_success 'prepare' ' : >never-mind-me && git add never-mind-me && @@@ -42,9 -43,9 +40,9 @@@ test_expect_success 'ls-files -c' cd top/sub && for f in ../y* do - echo "error: pathspec $sq$f$sq did not match any file(s) known to git" + echo "error: pathspec $SQ$f$SQ did not match any file(s) known to git" done >expect.err && - echo "Did you forget to ${sq}git add${sq}?" >>expect.err && + echo "Did you forget to ${SQ}git add${SQ}?" >>expect.err && ls ../x* >expect.out && test_must_fail git ls-files -c --error-unmatch ../[xy]* >actual.out 2>actual.err && test_cmp expect.out actual.out && @@@ -57,9 -58,9 +55,9 @@@ test_expect_success 'ls-files -o' cd top/sub && for f in ../x* do - echo "error: pathspec $sq$f$sq did not match any file(s) known to git" + echo "error: pathspec $SQ$f$SQ did not match any file(s) known to git" done >expect.err && - echo "Did you forget to ${sq}git add${sq}?" >>expect.err && + echo "Did you forget to ${SQ}git add${SQ}?" >>expect.err && ls ../y* >expect.out && test_must_fail git ls-files -o --error-unmatch ../[xy]* >actual.out 2>actual.err && test_cmp expect.out actual.out && diff --combined t/t3404-rebase-interactive.sh index 3ea67d75b5,9c152b6245..04affcc38a --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@@ -29,6 -29,9 +29,6 @@@ Initial setup . "$TEST_DIRECTORY"/lib-rebase.sh -# WARNING: Modifications to the initial repository can change the SHA ID used -# in the expect2 file for the 'stop on conflicting pick' test. - test_expect_success 'setup' ' test_commit A file1 && test_commit B file1 && @@@ -152,6 -155,8 +152,6 @@@ test_expect_success 'rebase -x with emp test_i18ncmp expected actual ' -LF=' -' test_expect_success 'rebase -x with newline in command fails' ' test_when_finished "git rebase --abort ||:" && test_must_fail env git rebase -x "a${LF}b" @ 2>actual && @@@ -228,28 -233,25 +228,28 @@@ test_expect_success 'exchange two commi set_fake_editor && FAKE_LINES="2 1" git rebase -i HEAD~2 && test H = $(git cat-file commit HEAD^ | sed -ne \$p) && - test G = $(git cat-file commit HEAD | sed -ne \$p) + test G = $(git cat-file commit HEAD | sed -ne \$p) && + blob1=$(git rev-parse --short HEAD^:file1) && + blob2=$(git rev-parse --short HEAD:file1) && + commit=$(git rev-parse --short HEAD) ' test_expect_success 'stop on conflicting pick' ' - cat >expect <<-\EOF && + cat >expect <<-EOF && diff --git a/file1 b/file1 - index f70f10e..fd79235 100644 + index $blob1..$blob2 100644 --- a/file1 +++ b/file1 @@ -1 +1 @@ -A +G EOF - cat >expect2 <<-\EOF && + cat >expect2 <<-EOF && <<<<<<< HEAD D ======= G - >>>>>>> 5d18e54... G + >>>>>>> $commit... G EOF git tag new-branch1 && set_fake_editor && @@@ -1001,7 -1003,7 +1001,7 @@@ test_expect_success 'rebase -i --root t git checkout B && set_fake_editor && test_must_fail env FAKE_LINES="2" git rebase -i --root && - git cat-file commit HEAD | grep "^tree 4b825dc642cb" && + git cat-file commit HEAD | grep "^tree $EMPTY_TREE" && git rebase --abort ' @@@ -1159,7 -1161,7 +1159,7 @@@ test_expect_success 'rebase -i error o test_expect_code 1 grep " emp" error ' -test_expect_success 'short SHA-1 setup' ' +test_expect_success SHA1 'short SHA-1 setup' ' test_when_finished "git checkout master" && git checkout --orphan collide && git rm -rf . && @@@ -1171,7 -1173,7 +1171,7 @@@ ) ' -test_expect_success 'short SHA-1 collide' ' +test_expect_success SHA1 'short SHA-1 collide' ' test_when_finished "reset_rebase && git checkout master" && git checkout collide && ( @@@ -1417,7 -1419,6 +1417,6 @@@ test_expect_success 'editor saves as CR ) ' - SQ="'" test_expect_success 'rebase -i --gpg-sign=' ' test_when_finished "test_might_fail git rebase --abort" && set_fake_editor && diff --combined t/t3430-rebase-merges.sh index cefed4e617,11141ac864..9efcf4808a --- a/t/t3430-rebase-merges.sh +++ b/t/t3430-rebase-merges.sh @@@ -37,27 -37,20 +37,27 @@@ test_expect_success 'setup' test_commit A && git checkout -b first && test_commit B && + b=$(git rev-parse --short HEAD) && git checkout master && test_commit C && + c=$(git rev-parse --short HEAD) && test_commit D && + d=$(git rev-parse --short HEAD) && git merge --no-commit B && test_tick && git commit -m E && git tag -m E E && + e=$(git rev-parse --short HEAD) && git checkout -b second C && test_commit F && + f=$(git rev-parse --short HEAD) && test_commit G && + g=$(git rev-parse --short HEAD) && git checkout master && git merge --no-commit G && test_tick && git commit -m H && + h=$(git rev-parse --short HEAD) && git tag -m H H && git checkout A && test_commit conflicting-G G.t @@@ -100,24 -93,24 +100,24 @@@ test_expect_success 'create completely ' test_expect_success 'generate correct todo list' ' - cat >expect <<-\EOF && + cat >expect <<-EOF && label onto reset onto - pick d9df450 B + pick $b B label E reset onto - pick 5dee784 C + pick $c C label branch-point - pick ca2c861 F - pick 088b00a G + pick $f F + pick $g G label H reset branch-point # C - pick 12bd07b D - merge -C 2051b56 E # E - merge -C 233d48a H # H + pick $d D + merge -C $e E # E + merge -C $h H # H EOF @@@ -158,7 -151,6 +158,6 @@@ test_expect_success 'failed `merge -C` test_path_is_file .git/rebase-merge/patch ' - SQ="'" test_expect_success 'failed `merge ` does not crash' ' test_when_finished "test_might_fail git rebase --abort" && git checkout conflicting-G && @@@ -448,25 -440,4 +447,25 @@@ test_expect_success '--continue after r test_path_is_missing .git/MERGE_HEAD ' +test_expect_success '--rebase-merges with strategies' ' + git checkout -b with-a-strategy F && + test_tick && + git merge -m "Merge conflicting-G" conflicting-G && + + : first, test with a merge strategy option && + git rebase -ir -Xtheirs G && + echo conflicting-G >expect && + test_cmp expect G.t && + + : now, try with a merge strategy other than recursive && + git reset --hard @{1} && + write_script git-merge-override <<-\EOF && + echo overridden$1 >>G.t + git add G.t + EOF + PATH="$PWD:$PATH" git rebase -ir -s override -Xxopt G && + test_write_lines G overridden--xopt >expect && + test_cmp expect G.t +' + test_done diff --combined t/t5601-clone.sh index 2e94354e5b,3be025a658..ad8c41176e --- a/t/t5601-clone.sh +++ b/t/t5601-clone.sh @@@ -434,7 -434,6 +434,6 @@@ test_expect_success 'double quoted plin expect_ssh "-v -P 123" myhost src ' - SQ="'" test_expect_success 'single quoted plink.exe in GIT_SSH_COMMAND' ' copy_ssh_wrapper_as "$TRASH_DIRECTORY/plink.exe" && GIT_SSH_COMMAND="$SQ$TRASH_DIRECTORY/plink.exe$SQ -v" \ @@@ -654,8 -653,7 +653,8 @@@ partial_clone () git -C client fsck && # Ensure that unneeded blobs are not inadvertently fetched. - test_config -C client extensions.partialclone "not a remote" && + test_config -C client remote.origin.promisor "false" && + git -C client config --unset remote.origin.partialclonefilter && test_must_fail git -C client cat-file -e "$HASH1" && # But this blob was fetched, because clone performs an initial checkout