{"thread":{"id":"52061","subject":"[PATCH 00/12] t5520: various test cleanup","startedAt":"2019-10-17T23:16:59Z","lastAt":"2019-11-14T00:52:21Z","messageCount":116,"participants":["Denton Liu","Eric Sunshine","SZEDER Gábor","Johannes Sixt","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":12},"messages":[{"id":"384304","messageId":"cover.1571354136.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":null,"subject":"[PATCH 00/12] t5520: various test cleanup","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-17T23:16:53Z","receivedAt":"2019-10-17T23:16:59Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Like earlier patchsets, I want to implement a feature that involves\nmodifications to the test suite. Since that feature will probably take a\nwhile to polish up, however, let's clean up the test suite in a separate\npatchset first so it's not blocked by the feature work.\n\nDenton Liu (12):\n  t5520: improve test style\n  t5520: use sq for test case names\n  t5520: let sed open its own input\n  t5520: replace test -f with test_path_is_file\n  t5520: remove spaces after redirect operator\n  t5520: use test_line_count where possible\n  t5520: replace test -{n,z} with test-lib functions\n  t5520: use test_cmp_rev where possible\n  t5520: test single-line files by git with test_cmp\n  t5520: don't put git in upstream of pipe\n  t5520: replace subshell cat comparison with test_cmp\n  t5520: replace `! git` with `test_must_fail git`\n\n t/t5520-pull.sh | 351 +++++++++++++++++++++++++++++-------------------\n 1 file changed, 213 insertions(+), 138 deletions(-)\n\n-- \n2.23.0.897.g0a19638b1e\n\n"},{"id":"384305","messageId":"cb7fe664ca3d5feaecd2226a8f4aba843e3a05f6.1571354136.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571354136.git.liu.denton@gmail.com","subject":"[PATCH 01/12] t5520: improve test style","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-17T23:16:57Z","receivedAt":"2019-10-17T23:17:03Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Improve the test style by removing leading and trailing empty lines\nwithin test cases. Also, reformat multi-line subshells to conform to the\nexisting style.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 88 +++++++++++++++++++++++++------------------------\n 1 file changed, 45 insertions(+), 43 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex cf4cc32fd0..51d6ce8aec 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -538,7 +538,6 @@ test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-m\n '\n \n test_expect_success '--rebase with rebased upstream' '\n-\n \tgit remote add -f me . &&\n \tgit checkout copy &&\n \tgit tag copy-orig &&\n@@ -552,7 +551,6 @@ test_expect_success '--rebase with rebased upstream' '\n \tgit pull --rebase me copy &&\n \ttest \"conflicting modification\" = \"$(cat file)\" &&\n \ttest file = \"$(cat file2)\"\n-\n '\n \n test_expect_success '--rebase -f with rebased upstream' '\n@@ -564,14 +562,12 @@ test_expect_success '--rebase -f with rebased upstream' '\n '\n \n test_expect_success '--rebase with rebased default upstream' '\n-\n \tgit update-ref refs/remotes/me/copy copy-orig &&\n \tgit checkout --track -b to-rebase2 me/copy &&\n \tgit reset --hard to-rebase-orig &&\n \tgit pull --rebase &&\n \ttest \"conflicting modification\" = \"$(cat file)\" &&\n \ttest file = \"$(cat file2)\"\n-\n '\n \n test_expect_success 'rebased upstream + fetch + pull --rebase' '\n@@ -588,7 +584,6 @@ test_expect_success 'rebased upstream + fetch + pull --rebase' '\n '\n \n test_expect_success 'pull --rebase dies early with dirty working directory' '\n-\n \tgit checkout to-rebase &&\n \tgit update-ref refs/remotes/me/copy copy^ &&\n \tCOPY=\"$(git rev-parse --verify me/copy)\" &&\n@@ -603,16 +598,16 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '\n \tgit checkout HEAD -- file &&\n \tgit pull &&\n \ttest \"$COPY\" != \"$(git rev-parse --verify me/copy)\"\n-\n '\n \n test_expect_success 'pull --rebase works on branch yet to be born' '\n \tgit rev-parse master >expect &&\n \tmkdir empty_repo &&\n-\t(cd empty_repo &&\n-\t git init &&\n-\t git pull --rebase .. master &&\n-\t git rev-parse HEAD >../actual\n+\t(\n+\t\tcd empty_repo &&\n+\t\tgit init &&\n+\t\tgit pull --rebase .. master &&\n+\t\tgit rev-parse HEAD >../actual\n \t) &&\n \ttest_cmp expect actual\n '\n@@ -646,58 +641,65 @@ test_expect_success 'pull --rebase fails on corrupt HEAD' '\n \n test_expect_success 'setup for detecting upstreamed changes' '\n \tmkdir src &&\n-\t(cd src &&\n-\t git init &&\n-\t printf \"1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n10\\n\" > stuff &&\n-\t git add stuff &&\n-\t git commit -m \"Initial revision\"\n+\t(\n+\t\tcd src &&\n+\t\tgit init &&\n+\t\tprintf \"1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n10\\n\" > stuff &&\n+\t\tgit add stuff &&\n+\t\tgit commit -m \"Initial revision\"\n \t) &&\n \tgit clone src dst &&\n-\t(cd src &&\n-\t modify s/5/43/ stuff &&\n-\t git commit -a -m \"5->43\" &&\n-\t modify s/6/42/ stuff &&\n-\t git commit -a -m \"Make it bigger\"\n+\t(\n+\t\tcd src &&\n+\t\tmodify s/5/43/ stuff &&\n+\t\tgit commit -a -m \"5->43\" &&\n+\t\tmodify s/6/42/ stuff &&\n+\t\tgit commit -a -m \"Make it bigger\"\n \t) &&\n-\t(cd dst &&\n-\t modify s/5/43/ stuff &&\n-\t git commit -a -m \"Independent discovery of 5->43\"\n+\t(\n+\t\tcd dst &&\n+\t\tmodify s/5/43/ stuff &&\n+\t\tgit commit -a -m \"Independent discovery of 5->43\"\n \t)\n '\n \n test_expect_success 'git pull --rebase detects upstreamed changes' '\n-\t(cd dst &&\n-\t git pull --rebase &&\n-\t test -z \"$(git ls-files -u)\"\n+\t(\n+\t\tcd dst &&\n+\t\tgit pull --rebase &&\n+\t\ttest -z \"$(git ls-files -u)\"\n \t)\n '\n \n test_expect_success 'setup for avoiding reapplying old patches' '\n-\t(cd dst &&\n-\t test_might_fail git rebase --abort &&\n-\t git reset --hard origin/master\n+\t(\n+\t\tcd dst &&\n+\t\ttest_might_fail git rebase --abort &&\n+\t\tgit reset --hard origin/master\n \t) &&\n \tgit clone --bare src src-replace.git &&\n \trm -rf src &&\n \tmv src-replace.git src &&\n-\t(cd dst &&\n-\t modify s/2/22/ stuff &&\n-\t git commit -a -m \"Change 2\" &&\n-\t modify s/3/33/ stuff &&\n-\t git commit -a -m \"Change 3\" &&\n-\t modify s/4/44/ stuff &&\n-\t git commit -a -m \"Change 4\" &&\n-\t git push &&\n-\n-\t modify s/44/55/ stuff &&\n-\t git commit --amend -a -m \"Modified Change 4\"\n+\t(\n+\t\tcd dst &&\n+\t\tmodify s/2/22/ stuff &&\n+\t\tgit commit -a -m \"Change 2\" &&\n+\t\tmodify s/3/33/ stuff &&\n+\t\tgit commit -a -m \"Change 3\" &&\n+\t\tmodify s/4/44/ stuff &&\n+\t\tgit commit -a -m \"Change 4\" &&\n+\t\tgit push &&\n+\n+\t\tmodify s/44/55/ stuff &&\n+\t\tgit commit --amend -a -m \"Modified Change 4\"\n \t)\n '\n \n test_expect_success 'git pull --rebase does not reapply old patches' '\n-\t(cd dst &&\n-\t test_must_fail git pull --rebase &&\n-\t test 1 = $(find .git/rebase-apply -name \"000*\" | wc -l)\n+\t(\n+\t\tcd dst &&\n+\t\ttest_must_fail git pull --rebase &&\n+\t\ttest 1 = $(find .git/rebase-apply -name \"000*\" | wc -l)\n \t)\n '\n \n-- \n2.23.0.897.g0a19638b1e\n\n"},{"id":"384306","messageId":"42ce20d4f8daa9e166dfd681b39457222741f153.1571354136.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571354136.git.liu.denton@gmail.com","subject":"[PATCH 02/12] t5520: use sq for test case names","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-17T23:16:59Z","receivedAt":"2019-10-17T23:17:04Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"The usual convention is for test case names to be written between\nsingle-quotes. Change all double-quoted test case names to single-quotes\nexcept for two test case names that use variables within.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 51d6ce8aec..a3de2e19b6 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -408,7 +408,7 @@ test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n \ttest new = \"$(git show HEAD:file2)\"\n '\n \n-test_expect_success \"pull --rebase warns on --verify-signatures\" '\n+test_expect_success 'pull --rebase warns on --verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --verify-signatures . copy 2>err &&\n \ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n@@ -416,7 +416,7 @@ test_expect_success \"pull --rebase warns on --verify-signatures\" '\n \ttest_i18ngrep \"ignoring --verify-signatures for rebase\" err\n '\n \n-test_expect_success \"pull --rebase does not warn on --no-verify-signatures\" '\n+test_expect_success 'pull --rebase does not warn on --no-verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --no-verify-signatures . copy 2>err &&\n \ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n-- \n2.23.0.897.g0a19638b1e\n\n"},{"id":"384307","messageId":"5f2078c84ce9a95ef868c34f1e8afb4335f5fa38.1571354136.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571354136.git.liu.denton@gmail.com","subject":"[PATCH 03/12] t5520: let sed open its own input","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-17T23:17:01Z","receivedAt":"2019-10-17T23:17:06Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"We were using a redirection operator to feed input into sed. However,\nsince sed is capable of opening its own files, make sed open its own\nfiles instead of redirecting input into it.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex a3de2e19b6..55560ce3cd 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -5,7 +5,7 @@ test_description='pulling into void'\n . ./test-lib.sh\n \n modify () {\n-\tsed -e \"$1\" <\"$2\" >\"$2.x\" &&\n+\tsed -e \"$1\" \"$2\" >\"$2.x\" &&\n \tmv \"$2.x\" \"$2\"\n }\n \n-- \n2.23.0.897.g0a19638b1e\n\n"},{"id":"384308","messageId":"60ee00535e95400bedc76300efdf781c83cfc8aa.1571354136.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571354136.git.liu.denton@gmail.com","subject":"[PATCH 05/12] t5520: remove spaces after redirect operator","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-17T23:17:05Z","receivedAt":"2019-10-17T23:17:10Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"The style for tests in Git is to have the redirect operator attached to\nthe filename with no spaces. Fix test cases where this is not the case.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 5ab5ec508a..68b8822db2 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -243,10 +243,10 @@ test_expect_success 'fast-forward fails with conflicting work tree' '\n \n test_expect_success '--rebase' '\n \tgit branch to-rebase &&\n-\techo modified again > file &&\n+\techo modified again >file &&\n \tgit commit -m file file &&\n \tgit checkout to-rebase &&\n-\techo new > file2 &&\n+\techo new >file2 &&\n \tgit add file2 &&\n \tgit commit -m \"new file\" &&\n \tgit tag before-rebase &&\n@@ -542,10 +542,10 @@ test_expect_success '--rebase with rebased upstream' '\n \tgit checkout copy &&\n \tgit tag copy-orig &&\n \tgit reset --hard HEAD^ &&\n-\techo conflicting modification > file &&\n+\techo conflicting modification >file &&\n \tgit commit -m conflict file &&\n \tgit checkout to-rebase &&\n-\techo file > file2 &&\n+\techo file >file2 &&\n \tgit commit -m to-rebase file2 &&\n \tgit tag to-rebase-orig &&\n \tgit pull --rebase me copy &&\n@@ -591,7 +591,7 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '\n \ttest_config branch.to-rebase.remote me &&\n \ttest_config branch.to-rebase.merge refs/heads/copy &&\n \ttest_config branch.to-rebase.rebase true &&\n-\techo dirty >> file &&\n+\techo dirty >>file &&\n \tgit add file &&\n \ttest_must_fail git pull &&\n \ttest \"$COPY\" = \"$(git rev-parse --verify me/copy)\" &&\n-- \n2.23.0.897.g0a19638b1e\n\n"},{"id":"384309","messageId":"f3cb583110f508b4a421326ea6667280e848930d.1571354136.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571354136.git.liu.denton@gmail.com","subject":"[PATCH 04/12] t5520: replace test -f with test_path_is_file","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-17T23:17:03Z","receivedAt":"2019-10-17T23:17:11Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Although `test -f` has the same functionality as test_path_is_file(), in\nthe case where test_path_is_file() fails, we get much better debugging\ninformation. Replace `test -f` with test_path_is_file so that future\ndevelopers will have a better experience debugging these test cases.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 55560ce3cd..5ab5ec508a 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -39,8 +39,8 @@ test_expect_success 'pulling into void' '\n \t\tcd cloned &&\n \t\tgit pull ..\n \t) &&\n-\ttest -f file &&\n-\ttest -f cloned/file &&\n+\ttest_path_is_file file &&\n+\ttest_path_is_file cloned/file &&\n \ttest_cmp file cloned/file\n '\n \n@@ -50,8 +50,8 @@ test_expect_success 'pulling into void using master:master' '\n \t\tcd cloned-uho &&\n \t\tgit pull .. master:master\n \t) &&\n-\ttest -f file &&\n-\ttest -f cloned-uho/file &&\n+\ttest_path_is_file file &&\n+\ttest_path_is_file cloned-uho/file &&\n \ttest_cmp file cloned-uho/file\n '\n \n@@ -99,7 +99,7 @@ test_expect_success 'pulling into void must not create an octopus' '\n \t(\n \t\tcd cloned-octopus &&\n \t\ttest_must_fail git pull .. master master &&\n-\t\t! test -f file\n+\t\ttest_must_fail test_path_is_file file\n \t)\n '\n \n-- \n2.23.0.897.g0a19638b1e\n\n"},{"id":"384310","messageId":"7ffbbc329f0d49f63cf5fafc211a964e8238650c.1571354136.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571354136.git.liu.denton@gmail.com","subject":"[PATCH 06/12] t5520: use test_line_count where possible","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-17T23:17:07Z","receivedAt":"2019-10-17T23:17:15Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Instead of rolling our own functionality to test the number of lines a\ncommand outputs, use test_line_count() which provides better debugging\ninformation in the case of a failure.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 68b8822db2..9452779f40 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -699,7 +699,8 @@ test_expect_success 'git pull --rebase does not reapply old patches' '\n \t(\n \t\tcd dst &&\n \t\ttest_must_fail git pull --rebase &&\n-\t\ttest 1 = $(find .git/rebase-apply -name \"000*\" | wc -l)\n+\t\tfind .git/rebase-apply -name \"000*\" >patches &&\n+\t\ttest_line_count = 1 patches\n \t)\n '\n \n-- \n2.23.0.897.g0a19638b1e\n\n"},{"id":"384311","messageId":"d6b74c5e58d9a45ca8b915ba699cafe08f300723.1571354136.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571354136.git.liu.denton@gmail.com","subject":"[PATCH 07/12] t5520: replace test -{n,z} with test-lib functions","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-17T23:17:09Z","receivedAt":"2019-10-17T23:17:15Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Instead of using `test -n` or `test -z`, replace them respectively with\ninvocations of test_file_not_empty() and test_must_be_empty().\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 12 ++++++++----\n 1 file changed, 8 insertions(+), 4 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 9452779f40..c7797b13e6 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -206,15 +206,18 @@ test_expect_success 'fail if the index has unresolved entries' '\n \ttest_when_finished \"git checkout -f copy && git branch -D third\" &&\n \ttest \"$(cat file)\" = file &&\n \ttest_commit modified2 file &&\n-\ttest -z \"$(git ls-files -u)\" &&\n+\tgit ls-files -u >unmerged &&\n+\ttest_must_be_empty unmerged &&\n \ttest_must_fail git pull . second &&\n-\ttest -n \"$(git ls-files -u)\" &&\n+\tgit ls-files -u >unmerged &&\n+\ttest_file_not_empty unmerged &&\n \tcp file expected &&\n \ttest_must_fail git pull . second 2>err &&\n \ttest_i18ngrep \"Pulling is not possible because you have unmerged files.\" err &&\n \ttest_cmp expected file &&\n \tgit add file &&\n-\ttest -z \"$(git ls-files -u)\" &&\n+\tgit ls-files -u >unmerged &&\n+\ttest_must_be_empty unmerged &&\n \ttest_must_fail git pull . second 2>err &&\n \ttest_i18ngrep \"You have not concluded your merge\" err &&\n \ttest_cmp expected file\n@@ -667,7 +670,8 @@ test_expect_success 'git pull --rebase detects upstreamed changes' '\n \t(\n \t\tcd dst &&\n \t\tgit pull --rebase &&\n-\t\ttest -z \"$(git ls-files -u)\"\n+\t\tgit ls-files -u >untracked &&\n+\t\ttest_must_be_empty untracked\n \t)\n '\n \n-- \n2.23.0.897.g0a19638b1e\n\n"},{"id":"384312","messageId":"ff05a0a8f7dc91d988e290b7d606e8a64f5daf54.1571354136.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571354136.git.liu.denton@gmail.com","subject":"[PATCH 08/12] t5520: use test_cmp_rev where possible","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-17T23:17:11Z","receivedAt":"2019-10-17T23:17:18Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"In case an invocation of `git rev-list` fails within the subshell, the\nfailure will be masked. Remove the subshell and use test_cmp_rev() so\nthat failures can be discovered.\n\nThis change was done with the following sed expressions:\n\n\ts/test \"$(git rev-parse.* \\([^)]*\\))\" = \"$(git rev-parse \\([^)]*\\))\"/test_cmp_rev \\1 \\2/\n\ts/test \\([^ ]*\\) = \"$(git rev-parse.* \\([^)]*\\))\"/test_cmp_rev \\1 \\2/\n\ts/test \"$(git rev-parse.* \\([^)]*\\))\" != \"$(git rev-parse.* \\([^)]*\\))\"/test_must_fail test_cmp_rev \\1 \\2/\n\ts/test \\([^ ]*\\) != \"$(git rev-parse.* \\([^)]*\\))\"/test_must_fail test_cmp_rev \\1 \\2/\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 50 ++++++++++++++++++++++++-------------------------\n 1 file changed, 25 insertions(+), 25 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex c7797b13e6..f11fadc075 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -230,7 +230,7 @@ test_expect_success 'fast-forwards working tree if branch head is updated' '\n \tgit pull . second:third 2>err &&\n \ttest_i18ngrep \"fetch updated the current branch head\" err &&\n \ttest \"$(cat file)\" = modified &&\n-\ttest \"$(git rev-parse third)\" = \"$(git rev-parse second)\"\n+\ttest_cmp_rev third second\n '\n \n test_expect_success 'fast-forward fails with conflicting work tree' '\n@@ -241,7 +241,7 @@ test_expect_success 'fast-forward fails with conflicting work tree' '\n \ttest_must_fail git pull . second:third 2>err &&\n \ttest_i18ngrep \"Cannot fast-forward your working tree\" err &&\n \ttest \"$(cat file)\" = conflict &&\n-\ttest \"$(git rev-parse third)\" = \"$(git rev-parse second)\"\n+\ttest_cmp_rev third second\n '\n \n test_expect_success '--rebase' '\n@@ -254,7 +254,7 @@ test_expect_success '--rebase' '\n \tgit commit -m \"new file\" &&\n \tgit tag before-rebase &&\n \tgit pull --rebase . copy &&\n-\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\"\n '\n \n@@ -266,7 +266,7 @@ test_expect_success '--rebase fast forward' '\n \n \tgit checkout to-rebase &&\n \tgit pull --rebase . ff &&\n-\ttest \"$(git rev-parse HEAD)\" = \"$(git rev-parse ff)\" &&\n+\ttest_cmp_rev HEAD ff &&\n \n \t# The above only validates the result.  Did we actually bypass rebase?\n \tgit reflog -1 >reflog.actual &&\n@@ -290,7 +290,7 @@ test_expect_success '--rebase --autostash fast forward' '\n \tgit checkout behind &&\n \techo dirty >file &&\n \tgit pull --rebase --autostash . to-rebase-ff &&\n-\ttest \"$(git rev-parse HEAD)\" = \"$(git rev-parse to-rebase-ff)\"\n+\ttest_cmp_rev HEAD to-rebase-ff\n '\n \n test_expect_success '--rebase with conflicts shows advice' '\n@@ -328,7 +328,7 @@ test_expect_success 'failed --rebase shows advice' '\n test_expect_success '--rebase fails with multiple branches' '\n \tgit reset --hard before-rebase &&\n \ttest_must_fail git pull --rebase . copy master 2>err &&\n-\ttest \"$(git rev-parse HEAD)\" = \"$(git rev-parse before-rebase)\" &&\n+\ttest_cmp_rev HEAD before-rebase &&\n \ttest_i18ngrep \"Cannot rebase onto multiple branches\" err &&\n \ttest modified = \"$(git show HEAD:file)\"\n '\n@@ -380,7 +380,7 @@ test_expect_success 'pull.rebase' '\n \tgit reset --hard before-rebase &&\n \ttest_config pull.rebase true &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\"\n '\n \n@@ -398,7 +398,7 @@ test_expect_success 'branch.to-rebase.rebase' '\n \tgit reset --hard before-rebase &&\n \ttest_config branch.to-rebase.rebase true &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\"\n '\n \n@@ -407,14 +407,14 @@ test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n \ttest_config pull.rebase true &&\n \ttest_config branch.to-rebase.rebase false &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^)\" != \"$(git rev-parse copy)\" &&\n+\ttest_must_fail test_cmp_rev HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\"\n '\n \n test_expect_success 'pull --rebase warns on --verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --verify-signatures . copy 2>err &&\n-\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\" &&\n \ttest_i18ngrep \"ignoring --verify-signatures for rebase\" err\n '\n@@ -422,7 +422,7 @@ test_expect_success 'pull --rebase warns on --verify-signatures' '\n test_expect_success 'pull --rebase does not warn on --no-verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --no-verify-signatures . copy 2>err &&\n-\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\" &&\n \ttest_i18ngrep ! \"verify-signatures\" err\n '\n@@ -443,8 +443,8 @@ test_expect_success 'pull.rebase=false create a new merge commit' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase false &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^1)\" = \"$(git rev-parse before-preserve-rebase)\" &&\n-\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^1 before-preserve-rebase &&\n+\ttest_cmp_rev HEAD^2 copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -452,7 +452,7 @@ test_expect_success 'pull.rebase=true flattens keep-merge' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase true &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^^ copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -460,7 +460,7 @@ test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase 1 &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^^ copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -469,8 +469,8 @@ test_expect_success REBASE_P \\\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase preserve &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n-\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse keep-merge)\"\n+\ttest_cmp_rev HEAD^^ copy &&\n+\ttest_cmp_rev HEAD^2 keep-merge\n '\n \n test_expect_success 'pull.rebase=interactive' '\n@@ -505,8 +505,8 @@ test_expect_success '--rebase=false create a new merge commit' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase true &&\n \tgit pull --rebase=false . copy &&\n-\ttest \"$(git rev-parse HEAD^1)\" = \"$(git rev-parse before-preserve-rebase)\" &&\n-\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^1 before-preserve-rebase &&\n+\ttest_cmp_rev HEAD^2 copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -514,7 +514,7 @@ test_expect_success '--rebase=true rebases and flattens keep-merge' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase preserve &&\n \tgit pull --rebase=true . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^^ copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -523,8 +523,8 @@ test_expect_success REBASE_P \\\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase true &&\n \tgit pull --rebase=preserve . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n-\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse keep-merge)\"\n+\ttest_cmp_rev HEAD^^ copy &&\n+\ttest_cmp_rev HEAD^2 keep-merge\n '\n \n test_expect_success '--rebase=invalid fails' '\n@@ -536,7 +536,7 @@ test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-m\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase preserve &&\n \tgit pull --rebase . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^^ copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -597,10 +597,10 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '\n \techo dirty >>file &&\n \tgit add file &&\n \ttest_must_fail git pull &&\n-\ttest \"$COPY\" = \"$(git rev-parse --verify me/copy)\" &&\n+\ttest_cmp_rev \"$COPY\" me/copy &&\n \tgit checkout HEAD -- file &&\n \tgit pull &&\n-\ttest \"$COPY\" != \"$(git rev-parse --verify me/copy)\"\n+\ttest_must_fail test_cmp_rev \"$COPY\" me/copy\n '\n \n test_expect_success 'pull --rebase works on branch yet to be born' '\n-- \n2.23.0.897.g0a19638b1e\n\n"},{"id":"384313","messageId":"f1b515fc0ed431f03244eefbe9f8f34921f4c62d.1571354136.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571354136.git.liu.denton@gmail.com","subject":"[PATCH 09/12] t5520: test single-line files by git with test_cmp","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-17T23:17:14Z","receivedAt":"2019-10-17T23:17:19Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"In case an invocation of a Git command fails within the subshell, the\nfailure will be masked. Replace the subshell with a file-redirection and\na call to test_cmp.\n\nThis change was done with the following GNU sed expressions:\n\n\ts/\\(\\s*\\)test \\([^ ]*\\) = \"$(\\(git [^)]*\\))\"/\\1echo \\2 >expect \\&\\&\\n\\1\\3 >actual \\&\\&\\n\\1test_cmp expect actual/\n\ts/\\(\\s*\\)test \"$(\\(git [^)]*\\))\" = \\([^ ]*\\)/\\1echo \\3 >expect \\&\\&\\n\\1\\2 >actual \\&\\&\\n\\1test_cmp expect actual/\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 64 ++++++++++++++++++++++++++++++++++++-------------\n 1 file changed, 48 insertions(+), 16 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex f11fadc075..0eebab7d86 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -255,7 +255,9 @@ test_expect_success '--rebase' '\n \tgit tag before-rebase &&\n \tgit pull --rebase . copy &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\"\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success '--rebase fast forward' '\n@@ -330,7 +332,9 @@ test_expect_success '--rebase fails with multiple branches' '\n \ttest_must_fail git pull --rebase . copy master 2>err &&\n \ttest_cmp_rev HEAD before-rebase &&\n \ttest_i18ngrep \"Cannot rebase onto multiple branches\" err &&\n-\ttest modified = \"$(git show HEAD:file)\"\n+\techo modified >expect &&\n+\tgit show HEAD:file >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'pull --rebase succeeds with dirty working directory and rebase.autostash set' '\n@@ -381,7 +385,9 @@ test_expect_success 'pull.rebase' '\n \ttest_config pull.rebase true &&\n \tgit pull . copy &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\"\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'pull --autostash & pull.rebase=true' '\n@@ -399,7 +405,9 @@ test_expect_success 'branch.to-rebase.rebase' '\n \ttest_config branch.to-rebase.rebase true &&\n \tgit pull . copy &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\"\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n@@ -408,14 +416,18 @@ test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n \ttest_config branch.to-rebase.rebase false &&\n \tgit pull . copy &&\n \ttest_must_fail test_cmp_rev HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\"\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'pull --rebase warns on --verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --verify-signatures . copy 2>err &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\" &&\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual &&\n \ttest_i18ngrep \"ignoring --verify-signatures for rebase\" err\n '\n \n@@ -423,7 +435,9 @@ test_expect_success 'pull --rebase does not warn on --no-verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --no-verify-signatures . copy 2>err &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\" &&\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual &&\n \ttest_i18ngrep ! \"verify-signatures\" err\n '\n \n@@ -445,7 +459,9 @@ test_expect_success 'pull.rebase=false create a new merge commit' '\n \tgit pull . copy &&\n \ttest_cmp_rev HEAD^1 before-preserve-rebase &&\n \ttest_cmp_rev HEAD^2 copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'pull.rebase=true flattens keep-merge' '\n@@ -453,7 +469,9 @@ test_expect_success 'pull.rebase=true flattens keep-merge' '\n \ttest_config pull.rebase true &&\n \tgit pull . copy &&\n \ttest_cmp_rev HEAD^^ copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' '\n@@ -461,7 +479,9 @@ test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' '\n \ttest_config pull.rebase 1 &&\n \tgit pull . copy &&\n \ttest_cmp_rev HEAD^^ copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success REBASE_P \\\n@@ -507,7 +527,9 @@ test_expect_success '--rebase=false create a new merge commit' '\n \tgit pull --rebase=false . copy &&\n \ttest_cmp_rev HEAD^1 before-preserve-rebase &&\n \ttest_cmp_rev HEAD^2 copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success '--rebase=true rebases and flattens keep-merge' '\n@@ -515,7 +537,9 @@ test_expect_success '--rebase=true rebases and flattens keep-merge' '\n \ttest_config pull.rebase preserve &&\n \tgit pull --rebase=true . copy &&\n \ttest_cmp_rev HEAD^^ copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success REBASE_P \\\n@@ -537,7 +561,9 @@ test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-m\n \ttest_config pull.rebase preserve &&\n \tgit pull --rebase . copy &&\n \ttest_cmp_rev HEAD^^ copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success '--rebase with rebased upstream' '\n@@ -622,10 +648,16 @@ test_expect_success 'pull --rebase fails on unborn branch with staged changes' '\n \t\tcd empty_repo2 &&\n \t\techo staged-file >staged-file &&\n \t\tgit add staged-file &&\n-\t\ttest \"$(git ls-files)\" = staged-file &&\n+\t\techo staged-file >expect &&\n+\t\tgit ls-files >actual &&\n+\t\ttest_cmp expect actual &&\n \t\ttest_must_fail git pull --rebase .. master 2>err &&\n-\t\ttest \"$(git ls-files)\" = staged-file &&\n-\t\ttest \"$(git show :staged-file)\" = staged-file &&\n+\t\techo staged-file >expect &&\n+\t\tgit ls-files >actual &&\n+\t\ttest_cmp expect actual &&\n+\t\techo staged-file >expect &&\n+\t\tgit show :staged-file >actual &&\n+\t\ttest_cmp expect actual &&\n \t\ttest_i18ngrep \"unborn branch with changes added to the index\" err\n \t)\n '\n-- \n2.23.0.897.g0a19638b1e\n\n"},{"id":"384314","messageId":"148d05cacda5fcfe686e787a6ed180c48239a21a.1571354136.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571354136.git.liu.denton@gmail.com","subject":"[PATCH 10/12] t5520: don't put git in upstream of pipe","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-17T23:17:16Z","receivedAt":"2019-10-17T23:17:22Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Before, if the invocation of git failed, it would be masked by the pipe\nsince only the return code of the last element of a pipe is used.\nRewrite the test to put the Git command on its own line so its return\ncode is not masked.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 0eebab7d86..e611d414c8 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -668,7 +668,8 @@ test_expect_success 'pull --rebase fails on corrupt HEAD' '\n \t(\n \t\tcd corrupt &&\n \t\ttest_commit one &&\n-\t\tobj=$(git rev-parse --verify HEAD | sed \"s#^..#&/#\") &&\n+\t\tgit rev-parse --verify HEAD >head &&\n+\t\tobj=$(sed \"s#^..#&/#\" head) &&\n \t\trm -f .git/objects/$obj &&\n \t\ttest_must_fail git pull --rebase\n \t)\n-- \n2.23.0.897.g0a19638b1e\n\n"},{"id":"384315","messageId":"24a283f5f730ec240f414bdc1a8a39f2361c5169.1571354136.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571354136.git.liu.denton@gmail.com","subject":"[PATCH 11/12] t5520: replace subshell cat comparison with test_cmp","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-17T23:17:18Z","receivedAt":"2019-10-17T23:17:23Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"We currently have many instances of `test <line> = $(cat <file>)` and\n`test $(cat <file>) = <line>`.  In the case where this fails, it will be\ndifficult for a developer to debug since the output will be masked.\nReplace these instances with invocations of test_cmp().\n\nThis change was done with the following GNU sed expressions:\n\n\ts/\\(\\s*\\)test \\([^=]*\\)= \"$(cat \\([^)]*\\))\"/\\1echo \\2>expect \\&\\&\\n\\1test_cmp expect \\3/\n\ts/\\(\\s*\\)test \"$(cat \\([^)]*\\))\" = \\([^&]*\\)\\( &&\\)\\?$/\\1echo \\3 >expect \\&\\&\\n\\1test_cmp expect \\2\\4/\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 105 ++++++++++++++++++++++++++++++++----------------\n 1 file changed, 70 insertions(+), 35 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex e611d414c8..c6425d20ab 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -15,8 +15,10 @@ test_pull_autostash () {\n \tgit add new_file &&\n \tgit pull \"$@\" . copy &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest \"$(cat new_file)\" = dirty &&\n-\ttest \"$(cat file)\" = \"modified again\"\n+\techo dirty >expect &&\n+\ttest_cmp expect new_file &&\n+\techo \"modified again\" >expect &&\n+\ttest_cmp expect file\n }\n \n test_pull_autostash_fail () {\n@@ -110,9 +112,11 @@ test_expect_success 'test . as a remote' '\n \techo updated >file &&\n \tgit commit -a -m updated &&\n \tgit checkout copy &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \tgit pull &&\n-\ttest \"$(cat file)\" = updated &&\n+\techo updated >expect &&\n+\ttest_cmp expect file &&\n \tgit reflog -1 >reflog.actual &&\n \tsed \"s/^[0-9a-f][0-9a-f]*/OBJID/\" reflog.actual >reflog.fuzzy &&\n \techo \"OBJID HEAD@{0}: pull: Fast-forward\" >reflog.expected &&\n@@ -125,9 +129,11 @@ test_expect_success 'the default remote . should not break explicit pull' '\n \tgit commit -a -m modified &&\n \tgit checkout copy &&\n \tgit reset --hard HEAD^ &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \tgit pull . second &&\n-\ttest \"$(cat file)\" = modified &&\n+\techo modified >expect &&\n+\ttest_cmp expect file &&\n \tgit reflog -1 >reflog.actual &&\n \tsed \"s/^[0-9a-f][0-9a-f]*/OBJID/\" reflog.actual >reflog.fuzzy &&\n \techo \"OBJID HEAD@{0}: pull . second: Fast-forward\" >reflog.expected &&\n@@ -137,10 +143,12 @@ test_expect_success 'the default remote . should not break explicit pull' '\n test_expect_success 'fail if wildcard spec does not match any refs' '\n \tgit checkout -b test copy^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_must_fail git pull . \"refs/nonexisting1/*:refs/nonexisting2/*\" 2>err &&\n \ttest_i18ngrep \"no candidates for merging\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'fail if no branches specified with non-default remote' '\n@@ -148,11 +156,13 @@ test_expect_success 'fail if no branches specified with non-default remote' '\n \ttest_when_finished \"git remote remove test_remote\" &&\n \tgit checkout -b test copy^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_config branch.test.remote origin &&\n \ttest_must_fail git pull test_remote 2>err &&\n \ttest_i18ngrep \"specify a branch on the command line\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'fail if not on a branch' '\n@@ -160,10 +170,12 @@ test_expect_success 'fail if not on a branch' '\n \ttest_when_finished \"git remote remove origin\" &&\n \tgit checkout HEAD^ &&\n \ttest_when_finished \"git checkout -f copy\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"not currently on a branch\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'fail if no configuration for current branch' '\n@@ -172,10 +184,12 @@ test_expect_success 'fail if no configuration for current branch' '\n \tgit checkout -b test copy^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n \ttest_config branch.test.remote test_remote &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"no tracking information\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'pull --all: fail if no configuration for current branch' '\n@@ -184,10 +198,12 @@ test_expect_success 'pull --all: fail if no configuration for current branch' '\n \tgit checkout -b test copy^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n \ttest_config branch.test.remote test_remote &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_must_fail git pull --all 2>err &&\n \ttest_i18ngrep \"There is no tracking information\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'fail if upstream branch does not exist' '\n@@ -195,16 +211,19 @@ test_expect_success 'fail if upstream branch does not exist' '\n \ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n \ttest_config branch.test.remote . &&\n \ttest_config branch.test.merge refs/heads/nonexisting &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"no such ref was fetched\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'fail if the index has unresolved entries' '\n \tgit checkout -b third second^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D third\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_commit modified2 file &&\n \tgit ls-files -u >unmerged &&\n \ttest_must_be_empty unmerged &&\n@@ -226,21 +245,25 @@ test_expect_success 'fail if the index has unresolved entries' '\n test_expect_success 'fast-forwards working tree if branch head is updated' '\n \tgit checkout -b third second^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D third\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \tgit pull . second:third 2>err &&\n \ttest_i18ngrep \"fetch updated the current branch head\" err &&\n-\ttest \"$(cat file)\" = modified &&\n+\techo modified >expect &&\n+\ttest_cmp expect file &&\n \ttest_cmp_rev third second\n '\n \n test_expect_success 'fast-forward fails with conflicting work tree' '\n \tgit checkout -b third second^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D third\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \techo conflict >file &&\n \ttest_must_fail git pull . second:third 2>err &&\n \ttest_i18ngrep \"Cannot fast-forward your working tree\" err &&\n-\ttest \"$(cat file)\" = conflict &&\n+\techo conflict >expect &&\n+\ttest_cmp expect file &&\n \ttest_cmp_rev third second\n '\n \n@@ -501,7 +524,8 @@ test_expect_success 'pull.rebase=interactive' '\n \ttest_set_editor \"$TRASH_DIRECTORY/fake-editor\" &&\n \ttest_when_finished \"test_might_fail git rebase --abort\" &&\n \ttest_must_fail git pull --rebase=interactive . copy &&\n-\ttest \"I was here\" = \"$(cat fake.out)\"\n+\techo \"I was here\" >expect &&\n+\ttest_cmp expect fake.out\n '\n \n test_expect_success 'pull --rebase=i' '\n@@ -512,7 +536,8 @@ test_expect_success 'pull --rebase=i' '\n \ttest_set_editor \"$TRASH_DIRECTORY/fake-editor\" &&\n \ttest_when_finished \"test_might_fail git rebase --abort\" &&\n \ttest_must_fail git pull --rebase=i . copy &&\n-\ttest \"I was here, too\" = \"$(cat fake.out)\"\n+\techo \"I was here, too\" >expect &&\n+\ttest_cmp expect fake.out\n '\n \n test_expect_success 'pull.rebase=invalid fails' '\n@@ -578,16 +603,20 @@ test_expect_success '--rebase with rebased upstream' '\n \tgit commit -m to-rebase file2 &&\n \tgit tag to-rebase-orig &&\n \tgit pull --rebase me copy &&\n-\ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = \"$(cat file2)\"\n+\techo \"conflicting modification\" >expect &&\n+\ttest_cmp expect file &&\n+\techo file >expect &&\n+\ttest_cmp expect file2\n '\n \n test_expect_success '--rebase -f with rebased upstream' '\n \ttest_when_finished \"test_might_fail git rebase --abort\" &&\n \tgit reset --hard to-rebase-orig &&\n \tgit pull --rebase -f me copy &&\n-\ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = \"$(cat file2)\"\n+\techo \"conflicting modification\" >expect &&\n+\ttest_cmp expect file &&\n+\techo file >expect &&\n+\ttest_cmp expect file2\n '\n \n test_expect_success '--rebase with rebased default upstream' '\n@@ -595,8 +624,10 @@ test_expect_success '--rebase with rebased default upstream' '\n \tgit checkout --track -b to-rebase2 me/copy &&\n \tgit reset --hard to-rebase-orig &&\n \tgit pull --rebase &&\n-\ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = \"$(cat file2)\"\n+\techo \"conflicting modification\" >expect &&\n+\ttest_cmp expect file &&\n+\techo file >expect &&\n+\ttest_cmp expect file2\n '\n \n test_expect_success 'rebased upstream + fetch + pull --rebase' '\n@@ -607,8 +638,10 @@ test_expect_success 'rebased upstream + fetch + pull --rebase' '\n \tgit reset --hard to-rebase-orig &&\n \tgit fetch &&\n \tgit pull --rebase &&\n-\ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = \"$(cat file2)\"\n+\techo \"conflicting modification\" >expect &&\n+\ttest_cmp expect file &&\n+\techo file >expect &&\n+\ttest_cmp expect file2\n \n '\n \n@@ -744,8 +777,10 @@ test_expect_success 'git pull --rebase does not reapply old patches' '\n test_expect_success 'git pull --rebase against local branch' '\n \tgit checkout -b copy2 to-rebase-orig &&\n \tgit pull --rebase . to-rebase &&\n-\ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = \"$(cat file2)\"\n+\techo \"conflicting modification\" >expect &&\n+\ttest_cmp expect file &&\n+\techo file >expect &&\n+\ttest_cmp expect file2\n '\n \n test_done\n-- \n2.23.0.897.g0a19638b1e\n\n"},{"id":"384316","messageId":"4d2bf64cf8b2e51c36808e0784b96575ce89b656.1571354136.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571354136.git.liu.denton@gmail.com","subject":"[PATCH 12/12] t5520: replace `! git` with `test_must_fail git`","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-17T23:17:20Z","receivedAt":"2019-10-17T23:17:27Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Currently, if a Git command fails in an unexpected way, such as a\nsegfault, it will be masked and ignored. Replace the ! with\ntest_must_fail so that only expected failures pass.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex c6425d20ab..0c187b025b 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -543,7 +543,7 @@ test_expect_success 'pull --rebase=i' '\n test_expect_success 'pull.rebase=invalid fails' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase invalid &&\n-\t! git pull . copy\n+\ttest_must_fail git pull . copy\n '\n \n test_expect_success '--rebase=false create a new merge commit' '\n@@ -578,7 +578,7 @@ test_expect_success REBASE_P \\\n \n test_expect_success '--rebase=invalid fails' '\n \tgit reset --hard before-preserve-rebase &&\n-\t! git pull --rebase=invalid . copy\n+\ttest_must_fail git pull --rebase=invalid . copy\n '\n \n test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-merge' '\n-- \n2.23.0.897.g0a19638b1e\n\n"},{"id":"384317","messageId":"CAPig+cRBA-guwHN-bhRvgbzc52YU-e_ipSQ7BYqDV6yNnvXmTA@mail.gmail.com","threadId":"52061","inReplyTo":"f3cb583110f508b4a421326ea6667280e848930d.1571354136.git.liu.denton@gmail.com","subject":"Re: [PATCH 04/12] t5520: replace test -f with test_path_is_file","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2019-10-17T23:26:30Z","receivedAt":"2019-10-17T23:26:45Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Thu, Oct 17, 2019 at 7:17 PM Denton Liu <liu.denton@gmail.com> wrote:\n> Although `test -f` has the same functionality as test_path_is_file(), in\n> the case where test_path_is_file() fails, we get much better debugging\n> information. Replace `test -f` with test_path_is_file so that future\n> developers will have a better experience debugging these test cases.\n>\n> Signed-off-by: Denton Liu <liu.denton@gmail.com>\n> ---\n> diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\n> @@ -99,7 +99,7 @@ test_expect_success 'pulling into void must not create an octopus' '\n>         (\n>                 cd cloned-octopus &&\n>                 test_must_fail git pull .. master master &&\n> -               ! test -f file\n> +               test_must_fail test_path_is_file file\n>         )\n\nAccording to t/README, this is not a valid use of test_must_fail(),\nwhich is reserved for detecting failure of Git commands. Either use\n'!' as the original code did, or perhaps use test_path_is_missing().\n"},{"id":"384318","messageId":"CAPig+cT5Xp_=QG9965_Nmdo2kbt3wnDGb9J0Nwt3-xkYGb0jBQ@mail.gmail.com","threadId":"52061","inReplyTo":"d6b74c5e58d9a45ca8b915ba699cafe08f300723.1571354136.git.liu.denton@gmail.com","subject":"Re: [PATCH 07/12] t5520: replace test -{n,z} with test-lib functions","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2019-10-17T23:31:31Z","receivedAt":"2019-10-17T23:31:45Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Thu, Oct 17, 2019 at 7:17 PM Denton Liu <liu.denton@gmail.com> wrote:\n> Instead of using `test -n` or `test -z`, replace them respectively with\n> invocations of test_file_not_empty() and test_must_be_empty().\n>\n> Signed-off-by: Denton Liu <liu.denton@gmail.com>\n> ---\n> diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\n> @@ -206,15 +206,18 @@ test_expect_success 'fail if the index has unresolved entries' '\n> -       test -z \"$(git ls-files -u)\" &&\n> +       git ls-files -u >unmerged &&\n> +       test_must_be_empty unmerged &&\n\nA better justification for these change (and all others in this patch)\nis that the original threw away the exit code of the \"git ls-files -u\"\ninvocation, whereas the new code takes the exit code into account. The\ncommit message perhaps instead ought to focus on that benefit.\n"},{"id":"384319","messageId":"542cd04c2ebda88b8fa63dc4dcb1c42d10afc844.1571355109.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"f3cb583110f508b4a421326ea6667280e848930d.1571354136.git.liu.denton@gmail.com","subject":"[PATCH 4.5/12] t5520: replace test -f with test-lib functions","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-17T23:35:15Z","receivedAt":"2019-10-17T23:35:21Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Although `test -f` has the same functionality as test_path_is_file(), in\nthe case where test_path_is_file() fails, we get much better debugging\ninformation.\n\nReplace `test -f` with test_path_is_file() so that future developers\nwill have a better experience debugging these test cases. Also, in the\ncase of `! test -f`, replace it with test_path_is_missing().\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\nI just realised that test_path_is_missing() is a much better replacement\nthan `test_must_fail test_path_is_file`. Please use this patch instead\nof 04/12.\n\n t/t5520-pull.sh | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 55560ce3cd..004d5884cd 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -39,8 +39,8 @@ test_expect_success 'pulling into void' '\n \t\tcd cloned &&\n \t\tgit pull ..\n \t) &&\n-\ttest -f file &&\n-\ttest -f cloned/file &&\n+\ttest_path_is_file file &&\n+\ttest_path_is_file cloned/file &&\n \ttest_cmp file cloned/file\n '\n \n@@ -50,8 +50,8 @@ test_expect_success 'pulling into void using master:master' '\n \t\tcd cloned-uho &&\n \t\tgit pull .. master:master\n \t) &&\n-\ttest -f file &&\n-\ttest -f cloned-uho/file &&\n+\ttest_path_is_file file &&\n+\ttest_path_is_file cloned-uho/file &&\n \ttest_cmp file cloned-uho/file\n '\n \n@@ -99,7 +99,7 @@ test_expect_success 'pulling into void must not create an octopus' '\n \t(\n \t\tcd cloned-octopus &&\n \t\ttest_must_fail git pull .. master master &&\n-\t\t! test -f file\n+\t\ttest_path_is_missing file\n \t)\n '\n \n-- \n2.23.0.897.g0a19638b1e\n\n"},{"id":"384320","messageId":"CAPig+cRF0taNhmZVu0z+P+Oe3em11Jz33GY8eBZRTGkx3z=TOw@mail.gmail.com","threadId":"52061","inReplyTo":"ff05a0a8f7dc91d988e290b7d606e8a64f5daf54.1571354136.git.liu.denton@gmail.com","subject":"Re: [PATCH 08/12] t5520: use test_cmp_rev where possible","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2019-10-17T23:41:44Z","receivedAt":"2019-10-17T23:41:58Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Thu, Oct 17, 2019 at 7:17 PM Denton Liu <liu.denton@gmail.com> wrote:\n> In case an invocation of `git rev-list` fails within the subshell, the\n> failure will be masked. Remove the subshell and use test_cmp_rev() so\n> that failures can be discovered.\n>\n> Signed-off-by: Denton Liu <liu.denton@gmail.com>\n> ---\n> diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\n> @@ -597,10 +597,10 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '\n>         test_must_fail git pull &&\n> -       test \"$COPY\" = \"$(git rev-parse --verify me/copy)\" &&\n> +       test_cmp_rev \"$COPY\" me/copy &&\n\nThis transformation doesn't look correct. COPY already holds the\nresult of a git-rev-parse invocation:\n\n    COPY=\"$(git rev-parse --verify me/copy)\" &&\n\nso passing it to test_cmp_rev() -- which applies its own git-rev-parse\ninvocation -- doesn't make sense.\n\n>         git checkout HEAD -- file &&\n>         git pull &&\n> -       test \"$COPY\" != \"$(git rev-parse --verify me/copy)\"\n> +       test_must_fail test_cmp_rev \"$COPY\" me/copy\n\nAs mentioned in my review of the other patch, this is not a valid use\nof test_must_fail().\n"},{"id":"384321","messageId":"CAPig+cTkqu6mmBV2sfXzfnxomkji1bhH-u=OToGkLQMVF1CRMQ@mail.gmail.com","threadId":"52061","inReplyTo":"f1b515fc0ed431f03244eefbe9f8f34921f4c62d.1571354136.git.liu.denton@gmail.com","subject":"Re: [PATCH 09/12] t5520: test single-line files by git with test_cmp","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2019-10-17T23:49:01Z","receivedAt":"2019-10-17T23:49:15Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Thu, Oct 17, 2019 at 7:17 PM Denton Liu <liu.denton@gmail.com> wrote:\n> In case an invocation of a Git command fails within the subshell, the\n> failure will be masked. Replace the subshell with a file-redirection and\n> a call to test_cmp.\n>\n> Signed-off-by: Denton Liu <liu.denton@gmail.com>\n> ---\n> diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\n> @@ -622,10 +648,16 @@ test_expect_success 'pull --rebase fails on unborn branch with staged changes' '\n>                 git add staged-file &&\n> -               test \"$(git ls-files)\" = staged-file &&\n> +               echo staged-file >expect &&\n> +               git ls-files >actual &&\n> +               test_cmp expect actual &&\n>                 test_must_fail git pull --rebase .. master 2>err &&\n> -               test \"$(git ls-files)\" = staged-file &&\n> -               test \"$(git show :staged-file)\" = staged-file &&\n> +               echo staged-file >expect &&\n> +               git ls-files >actual &&\n> +               test_cmp expect actual &&\n> +               echo staged-file >expect &&\n> +               git show :staged-file >actual &&\n> +               test_cmp expect actual &&\n\nNit: I'm not convinced that it makes sense to re-create the \"expect\"\nfile with the exact same content repeatedly in this one test. There is\nsome value in creating the file once and then _using_ it repeatedly\nsince that shows intent that the the result of these various commands\nis not expected to change.\n"},{"id":"384325","messageId":"CAPig+cTEHkWn528uMfrMNxrFFMnj8942wP0XmAEGuv_jZ1-6Lw@mail.gmail.com","threadId":"52061","inReplyTo":"542cd04c2ebda88b8fa63dc4dcb1c42d10afc844.1571355109.git.liu.denton@gmail.com","subject":"Re: [PATCH 4.5/12] t5520: replace test -f with test-lib functions","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2019-10-18T00:11:56Z","receivedAt":"2019-10-18T00:12:10Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Thu, Oct 17, 2019 at 7:35 PM Denton Liu <liu.denton@gmail.com> wrote:\n> Although `test -f` has the same functionality as test_path_is_file(), in\n> the case where test_path_is_file() fails, we get much better debugging\n> information.\n>\n> Replace `test -f` with test_path_is_file() so that future developers\n> will have a better experience debugging these test cases. Also, in the\n> case of `! test -f`, replace it with test_path_is_missing().\n>\n> Signed-off-by: Denton Liu <liu.denton@gmail.com>\n> ---\n> I just realised that test_path_is_missing() is a much better replacement\n> than `test_must_fail test_path_is_file`.\n\nThat depends upon context...\n\n> diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\n> @@ -99,7 +99,7 @@ test_expect_success 'pulling into void must not create an octopus' '\n> -               ! test -f file\n> +               test_path_is_missing file\n\nThere is a semantic difference between checking that \"file\" is not a\n_file_ versus checking that the a path itself (which may be a\ndirectory or a \"special file\") does not exist. In this particular\ntest, the difference doesn't matter, so the conversion is sensible\nenough, but it would save reviewers time if you, as author of the\npatch, state that you carefully considered the distinction before\nmaking each change.\n"},{"id":"384400","messageId":"20191018185227.GA74877@generichostname","threadId":"52061","inReplyTo":"CAPig+cRF0taNhmZVu0z+P+Oe3em11Jz33GY8eBZRTGkx3z=TOw@mail.gmail.com","subject":"Re: [PATCH 08/12] t5520: use test_cmp_rev where possible","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-18T18:52:27Z","receivedAt":"2019-10-18T18:52:31Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Hi Eric,\n\nThanks for the reviews. I have no idea how you always get to my patches\nso quickly but I appreciate the prompt reviews whenever I send a\ntest-related patchset in.\n\nI've fixed up the other concerns you had and I'll send a v2 later but I\nwanted to address this one.\n\nOn Thu, Oct 17, 2019 at 07:41:44PM -0400, Eric Sunshine wrote:\n> On Thu, Oct 17, 2019 at 7:17 PM Denton Liu <liu.denton@gmail.com> wrote:\n> > In case an invocation of `git rev-list` fails within the subshell, the\n> > failure will be masked. Remove the subshell and use test_cmp_rev() so\n> > that failures can be discovered.\n> >\n> > Signed-off-by: Denton Liu <liu.denton@gmail.com>\n> > ---\n> > diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\n> > @@ -597,10 +597,10 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '\n> >         test_must_fail git pull &&\n> > -       test \"$COPY\" = \"$(git rev-parse --verify me/copy)\" &&\n> > +       test_cmp_rev \"$COPY\" me/copy &&\n> \n> This transformation doesn't look correct. COPY already holds the\n> result of a git-rev-parse invocation:\n> \n>     COPY=\"$(git rev-parse --verify me/copy)\" &&\n> \n> so passing it to test_cmp_rev() -- which applies its own git-rev-parse\n> invocation -- doesn't make sense.\n\nI'll annotate the entire test case with my comments:\n\n\t# so we'll be testing that pull --rebase dies early\n\ttest_expect_success 'pull --rebase dies early with dirty working directory' '\n\t\tgit checkout to-rebase &&\n\t\tgit update-ref refs/remotes/me/copy copy^ &&\n\t\tCOPY=\"$(git rev-parse --verify me/copy)\" &&\n\t\tgit rebase --onto $COPY copy &&\n\n\t\t# according to git log --graph, we have this currently:\n\t\t#\n\t\t# $ git log --pretty=oneline --graph to-rebase copy me/copy\n\t\t# * 9366795adb50ef6eb482b610b37cb1fb6edbd3d0 (HEAD -> to-rebase) to-rebase\n\t\t# * b3dcf50eea47c4ad85faabb0fb74eded71cc829f file3\n\t\t# * faf459539411b4557cf735232a3746be073177a9 new file\n\t\t# | * f340b1b8932f7b1e016c06867cbdc3f637eeea2d (copy) conflict\n\t\t# |/  \n\t\t# * 5e86d50a28977ebee5ea378f81591ea558149272 (me/second, me/copy, second) modified\n\t\t# * d25cf184567afad1dc1e018b2b7d793bc1bd2dc1 original\n\n\t\ttest_config branch.to-rebase.remote me &&\n\t\ttest_config branch.to-rebase.merge refs/heads/copy &&\n\t\ttest_config branch.to-rebase.rebase true &&\n\n\t\t# we make the tree dirty here\n\t\techo dirty >>file &&\n\t\tgit add file &&\n\n\t\t# and over here, the pull should fail\n\t\ttest_must_fail git pull &&\n\n\t\t# but since we're testing that it dies early, we want to\n\t\t# make sure that the remote ref doesn't change, which is\n\t\t# why it should still be equal\n\t\ttest_cmp_rev \"$COPY\" me/copy &&\n\n\t\tgit checkout HEAD -- file &&\n\n\t\t# but over here, the pull succeeds...\n\t\tgit pull &&\n\n\t\t# so as a result, the remote ref should now be updated\n\t\ttest_cmp_rev ! \"$COPY\" me/copy\n\t'\n\nSo after grokking the test case, it seems like the the transformation is\nindeed correct. Maybe we can replace the last line with\n\n\ttest_cmp_rev copy me/copy\n\nbut I think I'll leave it unless you have any strong opinions.\n\nThanks,\n\nDenton\n"},{"id":"384417","messageId":"987fee4652ae1bd8d3eb50ed51f7c9694d567dfc.1571435195.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571435195.git.liu.denton@gmail.com","subject":"[PATCH v2 01/15] t7408: replace `test_must_fail test_path_is_file`","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-18T22:04:06Z","receivedAt":"2019-10-18T22:04:11Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"According to t/README, test_must_fail() should only be used to test for\nfailure in git commands. Replace the only invocation of\n`test_must_fail test_path_is_file` with `test_path_is_missing` since in\nthis test case, the path should not exist at all.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t7408-submodule-reference.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t7408-submodule-reference.sh b/t/t7408-submodule-reference.sh\nindex 34ac28c056..9e62d43cac 100755\n--- a/t/t7408-submodule-reference.sh\n+++ b/t/t7408-submodule-reference.sh\n@@ -123,7 +123,7 @@ test_expect_success 'missing submodule alternate fails clone and submodule updat\n \t\ttest_must_fail git submodule update --init &&\n \t\t# and we have no alternates:\n \t\ttest_must_fail test_alternate_is_used .git/modules/sub/objects/info/alternates sub &&\n-\t\ttest_must_fail test_path_is_file sub/file1\n+\t\ttest_path_is_missing sub/file1\n \t)\n '\n \n-- \n2.23.0.897.g0a19638b1e\n\n"},{"id":"384418","messageId":"2bca4f046d72615045e584d89817f99b6c0c61ec.1571435195.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571435195.git.liu.denton@gmail.com","subject":"[PATCH v2 09/15] t5520: replace test -{n,z} with test-lib functions","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-18T22:04:26Z","receivedAt":"2019-10-18T22:04:34Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"When wrapping a Git command in a subshell within another command, we\nthrow away the Git command's exit code. In case the Git command fails,\nwe would like to know about it rather than the failure being silent.\nExtract Git commands so that their exit codes are not lost.\n\nInstead of using `test -n` or `test -z`, replace them respectively with\ninvocations of test_file_not_empty() and test_must_be_empty() so that we\nget better debugging information in the case of a failure.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 12 ++++++++----\n 1 file changed, 8 insertions(+), 4 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 0ca4867e96..18225d8430 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -206,15 +206,18 @@ test_expect_success 'fail if the index has unresolved entries' '\n \ttest_when_finished \"git checkout -f copy && git branch -D third\" &&\n \ttest \"$(cat file)\" = file &&\n \ttest_commit modified2 file &&\n-\ttest -z \"$(git ls-files -u)\" &&\n+\tgit ls-files -u >unmerged &&\n+\ttest_must_be_empty unmerged &&\n \ttest_must_fail git pull . second &&\n-\ttest -n \"$(git ls-files -u)\" &&\n+\tgit ls-files -u >unmerged &&\n+\ttest_file_not_empty unmerged &&\n \tcp file expected &&\n \ttest_must_fail git pull . second 2>err &&\n \ttest_i18ngrep \"Pulling is not possible because you have unmerged files.\" err &&\n \ttest_cmp expected file &&\n \tgit add file &&\n-\ttest -z \"$(git ls-files -u)\" &&\n+\tgit ls-files -u >unmerged &&\n+\ttest_must_be_empty unmerged &&\n \ttest_must_fail git pull . second 2>err &&\n \ttest_i18ngrep \"You have not concluded your merge\" err &&\n \ttest_cmp expected file\n@@ -667,7 +670,8 @@ test_expect_success 'git pull --rebase detects upstreamed changes' '\n \t(\n \t\tcd dst &&\n \t\tgit pull --rebase &&\n-\t\ttest -z \"$(git ls-files -u)\"\n+\t\tgit ls-files -u >untracked &&\n+\t\ttest_must_be_empty untracked\n \t)\n '\n \n-- \n2.23.0.897.g0a19638b1e\n\n"},{"id":"384419","messageId":"52cf4f0d0fbab70ed90e24bba9271521d3e55d5b.1571435195.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571435195.git.liu.denton@gmail.com","subject":"[PATCH v2 11/15] t5520: test single-line files by git with test_cmp","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-18T22:04:32Z","receivedAt":"2019-10-18T22:04:38Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"In case an invocation of a Git command fails within the subshell, the\nfailure will be masked. Replace the subshell with a file-redirection and\na call to test_cmp.\n\nThis change was done with the following GNU sed expressions:\n\n\ts/\\(\\s*\\)test \\([^ ]*\\) = \"$(\\(git [^)]*\\))\"/\\1echo \\2 >expect \\&\\&\\n\\1\\3 >actual \\&\\&\\n\\1test_cmp expect actual/\n\ts/\\(\\s*\\)test \"$(\\(git [^)]*\\))\" = \\([^ ]*\\)/\\1echo \\3 >expect \\&\\&\\n\\1\\2 >actual \\&\\&\\n\\1test_cmp expect actual/\n\nA future patch will clean up situations where we have multiple duplicate\nstatements within a test case. This is done to keep this patch purely\nmechanical.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 64 ++++++++++++++++++++++++++++++++++++-------------\n 1 file changed, 48 insertions(+), 16 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 1af6ea06ee..8b7e7ae55d 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -255,7 +255,9 @@ test_expect_success '--rebase' '\n \tgit tag before-rebase &&\n \tgit pull --rebase . copy &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\"\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success '--rebase fast forward' '\n@@ -330,7 +332,9 @@ test_expect_success '--rebase fails with multiple branches' '\n \ttest_must_fail git pull --rebase . copy master 2>err &&\n \ttest_cmp_rev HEAD before-rebase &&\n \ttest_i18ngrep \"Cannot rebase onto multiple branches\" err &&\n-\ttest modified = \"$(git show HEAD:file)\"\n+\techo modified >expect &&\n+\tgit show HEAD:file >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'pull --rebase succeeds with dirty working directory and rebase.autostash set' '\n@@ -381,7 +385,9 @@ test_expect_success 'pull.rebase' '\n \ttest_config pull.rebase true &&\n \tgit pull . copy &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\"\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'pull --autostash & pull.rebase=true' '\n@@ -399,7 +405,9 @@ test_expect_success 'branch.to-rebase.rebase' '\n \ttest_config branch.to-rebase.rebase true &&\n \tgit pull . copy &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\"\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n@@ -408,14 +416,18 @@ test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n \ttest_config branch.to-rebase.rebase false &&\n \tgit pull . copy &&\n \ttest_cmp_rev ! HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\"\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'pull --rebase warns on --verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --verify-signatures . copy 2>err &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\" &&\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual &&\n \ttest_i18ngrep \"ignoring --verify-signatures for rebase\" err\n '\n \n@@ -423,7 +435,9 @@ test_expect_success 'pull --rebase does not warn on --no-verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --no-verify-signatures . copy 2>err &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\" &&\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual &&\n \ttest_i18ngrep ! \"verify-signatures\" err\n '\n \n@@ -445,7 +459,9 @@ test_expect_success 'pull.rebase=false create a new merge commit' '\n \tgit pull . copy &&\n \ttest_cmp_rev HEAD^1 before-preserve-rebase &&\n \ttest_cmp_rev HEAD^2 copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'pull.rebase=true flattens keep-merge' '\n@@ -453,7 +469,9 @@ test_expect_success 'pull.rebase=true flattens keep-merge' '\n \ttest_config pull.rebase true &&\n \tgit pull . copy &&\n \ttest_cmp_rev HEAD^^ copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' '\n@@ -461,7 +479,9 @@ test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' '\n \ttest_config pull.rebase 1 &&\n \tgit pull . copy &&\n \ttest_cmp_rev HEAD^^ copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success REBASE_P \\\n@@ -507,7 +527,9 @@ test_expect_success '--rebase=false create a new merge commit' '\n \tgit pull --rebase=false . copy &&\n \ttest_cmp_rev HEAD^1 before-preserve-rebase &&\n \ttest_cmp_rev HEAD^2 copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success '--rebase=true rebases and flattens keep-merge' '\n@@ -515,7 +537,9 @@ test_expect_success '--rebase=true rebases and flattens keep-merge' '\n \ttest_config pull.rebase preserve &&\n \tgit pull --rebase=true . copy &&\n \ttest_cmp_rev HEAD^^ copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success REBASE_P \\\n@@ -537,7 +561,9 @@ test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-m\n \ttest_config pull.rebase preserve &&\n \tgit pull --rebase . copy &&\n \ttest_cmp_rev HEAD^^ copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success '--rebase with rebased upstream' '\n@@ -622,10 +648,16 @@ test_expect_success 'pull --rebase fails on unborn branch with staged changes' '\n \t\tcd empty_repo2 &&\n \t\techo staged-file >staged-file &&\n \t\tgit add staged-file &&\n-\t\ttest \"$(git ls-files)\" = staged-file &&\n+\t\techo staged-file >expect &&\n+\t\tgit ls-files >actual &&\n+\t\ttest_cmp expect actual &&\n \t\ttest_must_fail git pull --rebase .. master 2>err &&\n-\t\ttest \"$(git ls-files)\" = staged-file &&\n-\t\ttest \"$(git show :staged-file)\" = staged-file &&\n+\t\techo staged-file >expect &&\n+\t\tgit ls-files >actual &&\n+\t\ttest_cmp expect actual &&\n+\t\techo staged-file >expect &&\n+\t\tgit show :staged-file >actual &&\n+\t\ttest_cmp expect actual &&\n \t\ttest_i18ngrep \"unborn branch with changes added to the index\" err\n \t)\n '\n-- \n2.23.0.897.g0a19638b1e\n\n"},{"id":"384420","messageId":"cover.1571435195.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571354136.git.liu.denton@gmail.com","subject":"[PATCH v2 00/15] t5520: various test cleanup","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-18T22:10:15Z","receivedAt":"2019-10-18T22:10:21Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Like earlier patchsets, I want to implement a feature that involves\nmodifications to the test suite. Since that feature will probably take a\nwhile to polish up, however, let's clean up the test suite in a separate\npatchset first so it's not blocked by the feature work.\n\n1/15 is a cleanup to an unrelated test that I found while addressing\nsome of Eric's comments.\n\n2/15 is a general improvement to test_rev_cmp() that will be used later\nin the series.\n\nChanges since v1:\n\n* Incorporate Eric's feedback\n\nDenton Liu (15):\n  t7408: replace `test_must_fail test_path_is_file`\n  t: teach test_cmp_rev to accept ! for not-equals\n  t5520: improve test style\n  t5520: use sq for test case names\n  t5520: let sed open its own input\n  t5520: replace test -f with test-lib functions\n  t5520: remove spaces after redirect operator\n  t5520: use test_line_count where possible\n  t5520: replace test -{n,z} with test-lib functions\n  t5520: use test_cmp_rev where possible\n  t5520: test single-line files by git with test_cmp\n  t5520: don't put git in upstream of pipe\n  t5520: replace subshell cat comparison with test_cmp\n  t5520: remove redundant lines in test cases\n  t5520: replace `! git` with `test_must_fail git`\n\n t/t2400-worktree-add.sh             |   4 +-\n t/t3400-rebase.sh                   |   2 +-\n t/t3421-rebase-topology-linear.sh   |   6 +-\n t/t3430-rebase-merges.sh            |   2 +-\n t/t3432-rebase-fast-forward.sh      |   2 +-\n t/t3501-revert-cherry-pick.sh       |   2 +-\n t/t3508-cherry-pick-many-commits.sh |   2 +-\n t/t5520-pull.sh                     | 343 +++++++++++++++++-----------\n t/t7408-submodule-reference.sh      |   2 +-\n t/test-lib-functions.sh             |  13 +-\n 10 files changed, 227 insertions(+), 151 deletions(-)\n\nRange-diff against v1:\n -:  ---------- >  1:  987fee4652 t7408: replace `test_must_fail test_path_is_file`\n -:  ---------- >  2:  417e808466 t: teach test_cmp_rev to accept ! for not-equals\n 1:  0bc54dd330 =  3:  0a56980857 t5520: improve test style\n 2:  a5dee82ecc =  4:  dfa89ba1cb t5520: use sq for test case names\n 3:  58cc2fcda3 =  5:  9fac3dff83 t5520: let sed open its own input\n 4:  d2946208d3 !  6:  c6ca45eb17 t5520: replace test -f with test_path_is_file\n    @@ Metadata\n     Author: Denton Liu <liu.denton@gmail.com>\n     \n      ## Commit message ##\n    -    t5520: replace test -f with test_path_is_file\n    +    t5520: replace test -f with test-lib functions\n     \n         Although `test -f` has the same functionality as test_path_is_file(), in\n         the case where test_path_is_file() fails, we get much better debugging\n    -    information. Replace `test -f` with test_path_is_file so that future\n    -    developers will have a better experience debugging these test cases.\n    +    information.\n    +\n    +    Replace `test -f` with test_path_is_file() so that future developers\n    +    will have a better experience debugging these test cases.\n    +\n    +    Also, in the case of `! test -f`, not only should that path not be a\n    +    file, it shouldn't exist at all so replace it with\n    +    test_path_is_missing().\n     \n         Signed-off-by: Denton Liu <liu.denton@gmail.com>\n     \n    @@ t/t5520-pull.sh: test_expect_success 'pulling into void must not create an octop\n      \t\tcd cloned-octopus &&\n      \t\ttest_must_fail git pull .. master master &&\n     -\t\t! test -f file\n    -+\t\ttest_must_fail test_path_is_file file\n    ++\t\ttest_path_is_missing file\n      \t)\n      '\n      \n 5:  5b4c1dd291 =  7:  830a8212ae t5520: remove spaces after redirect operator\n 6:  26fea15950 =  8:  3d982230be t5520: use test_line_count where possible\n 7:  3fc0354c9c !  9:  2bca4f046d t5520: replace test -{n,z} with test-lib functions\n    @@ Metadata\n      ## Commit message ##\n         t5520: replace test -{n,z} with test-lib functions\n     \n    +    When wrapping a Git command in a subshell within another command, we\n    +    throw away the Git command's exit code. In case the Git command fails,\n    +    we would like to know about it rather than the failure being silent.\n    +    Extract Git commands so that their exit codes are not lost.\n    +\n         Instead of using `test -n` or `test -z`, replace them respectively with\n    -    invocations of test_file_not_empty() and test_must_be_empty().\n    +    invocations of test_file_not_empty() and test_must_be_empty() so that we\n    +    get better debugging information in the case of a failure.\n     \n         Signed-off-by: Denton Liu <liu.denton@gmail.com>\n     \n 8:  f4eb80c9ac ! 10:  1a54db1d5c t5520: use test_cmp_rev where possible\n    @@ Commit message\n     \n                 s/test \"$(git rev-parse.* \\([^)]*\\))\" = \"$(git rev-parse \\([^)]*\\))\"/test_cmp_rev \\1 \\2/\n                 s/test \\([^ ]*\\) = \"$(git rev-parse.* \\([^)]*\\))\"/test_cmp_rev \\1 \\2/\n    -            s/test \"$(git rev-parse.* \\([^)]*\\))\" != \"$(git rev-parse.* \\([^)]*\\))\"/test_must_fail test_cmp_rev \\1 \\2/\n    -            s/test \\([^ ]*\\) != \"$(git rev-parse.* \\([^)]*\\))\"/test_must_fail test_cmp_rev \\1 \\2/\n    +            s/test \"$(git rev-parse.* \\([^)]*\\))\" != \"$(git rev-parse.* \\([^)]*\\))\"/test_cmp_rev ! \\1 \\2/\n    +            s/test \\([^ ]*\\) != \"$(git rev-parse.* \\([^)]*\\))\"/test_cmp_rev ! \\1 \\2/\n     \n         Signed-off-by: Denton Liu <liu.denton@gmail.com>\n     \n    @@ t/t5520-pull.sh: test_expect_success 'branch.to-rebase.rebase should override pu\n      \ttest_config branch.to-rebase.rebase false &&\n      \tgit pull . copy &&\n     -\ttest \"$(git rev-parse HEAD^)\" != \"$(git rev-parse copy)\" &&\n    -+\ttest_must_fail test_cmp_rev HEAD^ copy &&\n    ++\ttest_cmp_rev ! HEAD^ copy &&\n      \ttest new = \"$(git show HEAD:file2)\"\n      '\n      \n    @@ t/t5520-pull.sh: test_expect_success 'pull --rebase dies early with dirty workin\n      \tgit checkout HEAD -- file &&\n      \tgit pull &&\n     -\ttest \"$COPY\" != \"$(git rev-parse --verify me/copy)\"\n    -+\ttest_must_fail test_cmp_rev \"$COPY\" me/copy\n    ++\ttest_cmp_rev ! \"$COPY\" me/copy\n      '\n      \n      test_expect_success 'pull --rebase works on branch yet to be born' '\n 9:  bd3ec4239c ! 11:  52cf4f0d0f t5520: test single-line files by git with test_cmp\n    @@ Commit message\n                 s/\\(\\s*\\)test \\([^ ]*\\) = \"$(\\(git [^)]*\\))\"/\\1echo \\2 >expect \\&\\&\\n\\1\\3 >actual \\&\\&\\n\\1test_cmp expect actual/\n                 s/\\(\\s*\\)test \"$(\\(git [^)]*\\))\" = \\([^ ]*\\)/\\1echo \\3 >expect \\&\\&\\n\\1\\2 >actual \\&\\&\\n\\1test_cmp expect actual/\n     \n    +    A future patch will clean up situations where we have multiple duplicate\n    +    statements within a test case. This is done to keep this patch purely\n    +    mechanical.\n    +\n         Signed-off-by: Denton Liu <liu.denton@gmail.com>\n     \n      ## t/t5520-pull.sh ##\n    @@ t/t5520-pull.sh: test_expect_success 'branch.to-rebase.rebase' '\n     @@ t/t5520-pull.sh: test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n      \ttest_config branch.to-rebase.rebase false &&\n      \tgit pull . copy &&\n    - \ttest_must_fail test_cmp_rev HEAD^ copy &&\n    + \ttest_cmp_rev ! HEAD^ copy &&\n     -\ttest new = \"$(git show HEAD:file2)\"\n     +\techo new >expect &&\n     +\tgit show HEAD:file2 >actual &&\n10:  61b4df0f7c = 12:  0cfabb201c t5520: don't put git in upstream of pipe\n11:  f3429bbb57 ! 13:  b2d0ce21c8 t5520: replace subshell cat comparison with test_cmp\n    @@ Commit message\n                 s/\\(\\s*\\)test \\([^=]*\\)= \"$(cat \\([^)]*\\))\"/\\1echo \\2>expect \\&\\&\\n\\1test_cmp expect \\3/\n                 s/\\(\\s*\\)test \"$(cat \\([^)]*\\))\" = \\([^&]*\\)\\( &&\\)\\?$/\\1echo \\3 >expect \\&\\&\\n\\1test_cmp expect \\2\\4/\n     \n    +    A future patch will clean up situations where we have multiple duplicate\n    +    statements within a test case. This is done to keep this patch purely\n    +    mechanical.\n    +\n         Signed-off-by: Denton Liu <liu.denton@gmail.com>\n     \n      ## t/t5520-pull.sh ##\n -:  ---------- > 14:  5aac40a029 t5520: remove redundant lines in test cases\n12:  3e6c591b2b = 15:  2c0d3ac416 t5520: replace `! git` with `test_must_fail git`\n-- \n2.23.0.897.g0a19638b1e\n\n"},{"id":"384421","messageId":"c6ca45eb17644be2cefe16af67564f310ddd8ad2.1571435195.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571435195.git.liu.denton@gmail.com","subject":"[PATCH v2 06/15] t5520: replace test -f with test-lib functions","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-18T22:10:32Z","receivedAt":"2019-10-18T22:10:38Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Although `test -f` has the same functionality as test_path_is_file(), in\nthe case where test_path_is_file() fails, we get much better debugging\ninformation.\n\nReplace `test -f` with test_path_is_file() so that future developers\nwill have a better experience debugging these test cases.\n\nAlso, in the case of `! test -f`, not only should that path not be a\nfile, it shouldn't exist at all so replace it with\ntest_path_is_missing().\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 55560ce3cd..004d5884cd 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -39,8 +39,8 @@ test_expect_success 'pulling into void' '\n \t\tcd cloned &&\n \t\tgit pull ..\n \t) &&\n-\ttest -f file &&\n-\ttest -f cloned/file &&\n+\ttest_path_is_file file &&\n+\ttest_path_is_file cloned/file &&\n \ttest_cmp file cloned/file\n '\n \n@@ -50,8 +50,8 @@ test_expect_success 'pulling into void using master:master' '\n \t\tcd cloned-uho &&\n \t\tgit pull .. master:master\n \t) &&\n-\ttest -f file &&\n-\ttest -f cloned-uho/file &&\n+\ttest_path_is_file file &&\n+\ttest_path_is_file cloned-uho/file &&\n \ttest_cmp file cloned-uho/file\n '\n \n@@ -99,7 +99,7 @@ test_expect_success 'pulling into void must not create an octopus' '\n \t(\n \t\tcd cloned-octopus &&\n \t\ttest_must_fail git pull .. master master &&\n-\t\t! test -f file\n+\t\ttest_path_is_missing file\n \t)\n '\n \n-- \n2.23.0.897.g0a19638b1e\n\n"},{"id":"384422","messageId":"0cfabb201c5a79f665e79252edcfc28aa3df59ff.1571435195.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571435195.git.liu.denton@gmail.com","subject":"[PATCH v2 12/15] t5520: don't put git in upstream of pipe","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-18T22:10:47Z","receivedAt":"2019-10-18T22:10:54Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Before, if the invocation of git failed, it would be masked by the pipe\nsince only the return code of the last element of a pipe is used.\nRewrite the test to put the Git command on its own line so its return\ncode is not masked.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 8b7e7ae55d..8ddf89e550 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -668,7 +668,8 @@ test_expect_success 'pull --rebase fails on corrupt HEAD' '\n \t(\n \t\tcd corrupt &&\n \t\ttest_commit one &&\n-\t\tobj=$(git rev-parse --verify HEAD | sed \"s#^..#&/#\") &&\n+\t\tgit rev-parse --verify HEAD >head &&\n+\t\tobj=$(sed \"s#^..#&/#\" head) &&\n \t\trm -f .git/objects/$obj &&\n \t\ttest_must_fail git pull --rebase\n \t)\n-- \n2.23.0.897.g0a19638b1e\n\n"},{"id":"384423","messageId":"5aac40a029a95f0a72415f80b546310a3940f053.1571435195.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571435195.git.liu.denton@gmail.com","subject":"[PATCH v2 14/15] t5520: remove redundant lines in test cases","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-18T22:10:52Z","receivedAt":"2019-10-18T22:10:59Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"In the previous patches, the mechanical application of changes left some\nduplicate statements in the test case which were not strictly incorrect\nbut were redundant and possibly misleading. Remove these duplicate\nstatements so that it is clear that the intent behind the tests are that\nthe content of the file stays the same throughout the whole test case.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 8 --------\n 1 file changed, 8 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex c9e4eec004..ef3dbc201a 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -147,7 +147,6 @@ test_expect_success 'fail if wildcard spec does not match any refs' '\n \ttest_cmp expect file &&\n \ttest_must_fail git pull . \"refs/nonexisting1/*:refs/nonexisting2/*\" 2>err &&\n \ttest_i18ngrep \"no candidates for merging\" err &&\n-\techo file >expect &&\n \ttest_cmp expect file\n '\n \n@@ -161,7 +160,6 @@ test_expect_success 'fail if no branches specified with non-default remote' '\n \ttest_config branch.test.remote origin &&\n \ttest_must_fail git pull test_remote 2>err &&\n \ttest_i18ngrep \"specify a branch on the command line\" err &&\n-\techo file >expect &&\n \ttest_cmp expect file\n '\n \n@@ -174,7 +172,6 @@ test_expect_success 'fail if not on a branch' '\n \ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"not currently on a branch\" err &&\n-\techo file >expect &&\n \ttest_cmp expect file\n '\n \n@@ -188,7 +185,6 @@ test_expect_success 'fail if no configuration for current branch' '\n \ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"no tracking information\" err &&\n-\techo file >expect &&\n \ttest_cmp expect file\n '\n \n@@ -202,7 +198,6 @@ test_expect_success 'pull --all: fail if no configuration for current branch' '\n \ttest_cmp expect file &&\n \ttest_must_fail git pull --all 2>err &&\n \ttest_i18ngrep \"There is no tracking information\" err &&\n-\techo file >expect &&\n \ttest_cmp expect file\n '\n \n@@ -215,7 +210,6 @@ test_expect_success 'fail if upstream branch does not exist' '\n \ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"no such ref was fetched\" err &&\n-\techo file >expect &&\n \ttest_cmp expect file\n '\n \n@@ -685,10 +679,8 @@ test_expect_success 'pull --rebase fails on unborn branch with staged changes' '\n \t\tgit ls-files >actual &&\n \t\ttest_cmp expect actual &&\n \t\ttest_must_fail git pull --rebase .. master 2>err &&\n-\t\techo staged-file >expect &&\n \t\tgit ls-files >actual &&\n \t\ttest_cmp expect actual &&\n-\t\techo staged-file >expect &&\n \t\tgit show :staged-file >actual &&\n \t\ttest_cmp expect actual &&\n \t\ttest_i18ngrep \"unborn branch with changes added to the index\" err\n-- \n2.23.0.897.g0a19638b1e\n\n"},{"id":"384424","messageId":"2c0d3ac416ff1373ea74514e36a1a8f9afa2ff2b.1571435195.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571435195.git.liu.denton@gmail.com","subject":"[PATCH v2 15/15] t5520: replace `! git` with `test_must_fail git`","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-18T22:10:55Z","receivedAt":"2019-10-18T22:11:02Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Currently, if a Git command fails in an unexpected way, such as a\nsegfault, it will be masked and ignored. Replace the ! with\ntest_must_fail so that only expected failures pass.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex ef3dbc201a..602d996a33 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -537,7 +537,7 @@ test_expect_success 'pull --rebase=i' '\n test_expect_success 'pull.rebase=invalid fails' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase invalid &&\n-\t! git pull . copy\n+\ttest_must_fail git pull . copy\n '\n \n test_expect_success '--rebase=false create a new merge commit' '\n@@ -572,7 +572,7 @@ test_expect_success REBASE_P \\\n \n test_expect_success '--rebase=invalid fails' '\n \tgit reset --hard before-preserve-rebase &&\n-\t! git pull --rebase=invalid . copy\n+\ttest_must_fail git pull --rebase=invalid . copy\n '\n \n test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-merge' '\n-- \n2.23.0.897.g0a19638b1e\n\n"},{"id":"384425","messageId":"b2d0ce21c8cd5fa3e2eb7003a9c56b2289cb5de4.1571435195.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571435195.git.liu.denton@gmail.com","subject":"[PATCH v2 13/15] t5520: replace subshell cat comparison with test_cmp","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-18T22:10:50Z","receivedAt":"2019-10-18T22:11:07Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"We currently have many instances of `test <line> = $(cat <file>)` and\n`test $(cat <file>) = <line>`.  In the case where this fails, it will be\ndifficult for a developer to debug since the output will be masked.\nReplace these instances with invocations of test_cmp().\n\nThis change was done with the following GNU sed expressions:\n\n\ts/\\(\\s*\\)test \\([^=]*\\)= \"$(cat \\([^)]*\\))\"/\\1echo \\2>expect \\&\\&\\n\\1test_cmp expect \\3/\n\ts/\\(\\s*\\)test \"$(cat \\([^)]*\\))\" = \\([^&]*\\)\\( &&\\)\\?$/\\1echo \\3 >expect \\&\\&\\n\\1test_cmp expect \\2\\4/\n\nA future patch will clean up situations where we have multiple duplicate\nstatements within a test case. This is done to keep this patch purely\nmechanical.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 105 ++++++++++++++++++++++++++++++++----------------\n 1 file changed, 70 insertions(+), 35 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 8ddf89e550..c9e4eec004 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -15,8 +15,10 @@ test_pull_autostash () {\n \tgit add new_file &&\n \tgit pull \"$@\" . copy &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest \"$(cat new_file)\" = dirty &&\n-\ttest \"$(cat file)\" = \"modified again\"\n+\techo dirty >expect &&\n+\ttest_cmp expect new_file &&\n+\techo \"modified again\" >expect &&\n+\ttest_cmp expect file\n }\n \n test_pull_autostash_fail () {\n@@ -110,9 +112,11 @@ test_expect_success 'test . as a remote' '\n \techo updated >file &&\n \tgit commit -a -m updated &&\n \tgit checkout copy &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \tgit pull &&\n-\ttest \"$(cat file)\" = updated &&\n+\techo updated >expect &&\n+\ttest_cmp expect file &&\n \tgit reflog -1 >reflog.actual &&\n \tsed \"s/^[0-9a-f][0-9a-f]*/OBJID/\" reflog.actual >reflog.fuzzy &&\n \techo \"OBJID HEAD@{0}: pull: Fast-forward\" >reflog.expected &&\n@@ -125,9 +129,11 @@ test_expect_success 'the default remote . should not break explicit pull' '\n \tgit commit -a -m modified &&\n \tgit checkout copy &&\n \tgit reset --hard HEAD^ &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \tgit pull . second &&\n-\ttest \"$(cat file)\" = modified &&\n+\techo modified >expect &&\n+\ttest_cmp expect file &&\n \tgit reflog -1 >reflog.actual &&\n \tsed \"s/^[0-9a-f][0-9a-f]*/OBJID/\" reflog.actual >reflog.fuzzy &&\n \techo \"OBJID HEAD@{0}: pull . second: Fast-forward\" >reflog.expected &&\n@@ -137,10 +143,12 @@ test_expect_success 'the default remote . should not break explicit pull' '\n test_expect_success 'fail if wildcard spec does not match any refs' '\n \tgit checkout -b test copy^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_must_fail git pull . \"refs/nonexisting1/*:refs/nonexisting2/*\" 2>err &&\n \ttest_i18ngrep \"no candidates for merging\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'fail if no branches specified with non-default remote' '\n@@ -148,11 +156,13 @@ test_expect_success 'fail if no branches specified with non-default remote' '\n \ttest_when_finished \"git remote remove test_remote\" &&\n \tgit checkout -b test copy^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_config branch.test.remote origin &&\n \ttest_must_fail git pull test_remote 2>err &&\n \ttest_i18ngrep \"specify a branch on the command line\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'fail if not on a branch' '\n@@ -160,10 +170,12 @@ test_expect_success 'fail if not on a branch' '\n \ttest_when_finished \"git remote remove origin\" &&\n \tgit checkout HEAD^ &&\n \ttest_when_finished \"git checkout -f copy\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"not currently on a branch\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'fail if no configuration for current branch' '\n@@ -172,10 +184,12 @@ test_expect_success 'fail if no configuration for current branch' '\n \tgit checkout -b test copy^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n \ttest_config branch.test.remote test_remote &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"no tracking information\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'pull --all: fail if no configuration for current branch' '\n@@ -184,10 +198,12 @@ test_expect_success 'pull --all: fail if no configuration for current branch' '\n \tgit checkout -b test copy^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n \ttest_config branch.test.remote test_remote &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_must_fail git pull --all 2>err &&\n \ttest_i18ngrep \"There is no tracking information\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'fail if upstream branch does not exist' '\n@@ -195,16 +211,19 @@ test_expect_success 'fail if upstream branch does not exist' '\n \ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n \ttest_config branch.test.remote . &&\n \ttest_config branch.test.merge refs/heads/nonexisting &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"no such ref was fetched\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'fail if the index has unresolved entries' '\n \tgit checkout -b third second^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D third\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_commit modified2 file &&\n \tgit ls-files -u >unmerged &&\n \ttest_must_be_empty unmerged &&\n@@ -226,21 +245,25 @@ test_expect_success 'fail if the index has unresolved entries' '\n test_expect_success 'fast-forwards working tree if branch head is updated' '\n \tgit checkout -b third second^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D third\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \tgit pull . second:third 2>err &&\n \ttest_i18ngrep \"fetch updated the current branch head\" err &&\n-\ttest \"$(cat file)\" = modified &&\n+\techo modified >expect &&\n+\ttest_cmp expect file &&\n \ttest_cmp_rev third second\n '\n \n test_expect_success 'fast-forward fails with conflicting work tree' '\n \tgit checkout -b third second^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D third\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \techo conflict >file &&\n \ttest_must_fail git pull . second:third 2>err &&\n \ttest_i18ngrep \"Cannot fast-forward your working tree\" err &&\n-\ttest \"$(cat file)\" = conflict &&\n+\techo conflict >expect &&\n+\ttest_cmp expect file &&\n \ttest_cmp_rev third second\n '\n \n@@ -501,7 +524,8 @@ test_expect_success 'pull.rebase=interactive' '\n \ttest_set_editor \"$TRASH_DIRECTORY/fake-editor\" &&\n \ttest_when_finished \"test_might_fail git rebase --abort\" &&\n \ttest_must_fail git pull --rebase=interactive . copy &&\n-\ttest \"I was here\" = \"$(cat fake.out)\"\n+\techo \"I was here\" >expect &&\n+\ttest_cmp expect fake.out\n '\n \n test_expect_success 'pull --rebase=i' '\n@@ -512,7 +536,8 @@ test_expect_success 'pull --rebase=i' '\n \ttest_set_editor \"$TRASH_DIRECTORY/fake-editor\" &&\n \ttest_when_finished \"test_might_fail git rebase --abort\" &&\n \ttest_must_fail git pull --rebase=i . copy &&\n-\ttest \"I was here, too\" = \"$(cat fake.out)\"\n+\techo \"I was here, too\" >expect &&\n+\ttest_cmp expect fake.out\n '\n \n test_expect_success 'pull.rebase=invalid fails' '\n@@ -578,16 +603,20 @@ test_expect_success '--rebase with rebased upstream' '\n \tgit commit -m to-rebase file2 &&\n \tgit tag to-rebase-orig &&\n \tgit pull --rebase me copy &&\n-\ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = \"$(cat file2)\"\n+\techo \"conflicting modification\" >expect &&\n+\ttest_cmp expect file &&\n+\techo file >expect &&\n+\ttest_cmp expect file2\n '\n \n test_expect_success '--rebase -f with rebased upstream' '\n \ttest_when_finished \"test_might_fail git rebase --abort\" &&\n \tgit reset --hard to-rebase-orig &&\n \tgit pull --rebase -f me copy &&\n-\ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = \"$(cat file2)\"\n+\techo \"conflicting modification\" >expect &&\n+\ttest_cmp expect file &&\n+\techo file >expect &&\n+\ttest_cmp expect file2\n '\n \n test_expect_success '--rebase with rebased default upstream' '\n@@ -595,8 +624,10 @@ test_expect_success '--rebase with rebased default upstream' '\n \tgit checkout --track -b to-rebase2 me/copy &&\n \tgit reset --hard to-rebase-orig &&\n \tgit pull --rebase &&\n-\ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = \"$(cat file2)\"\n+\techo \"conflicting modification\" >expect &&\n+\ttest_cmp expect file &&\n+\techo file >expect &&\n+\ttest_cmp expect file2\n '\n \n test_expect_success 'rebased upstream + fetch + pull --rebase' '\n@@ -607,8 +638,10 @@ test_expect_success 'rebased upstream + fetch + pull --rebase' '\n \tgit reset --hard to-rebase-orig &&\n \tgit fetch &&\n \tgit pull --rebase &&\n-\ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = \"$(cat file2)\"\n+\techo \"conflicting modification\" >expect &&\n+\ttest_cmp expect file &&\n+\techo file >expect &&\n+\ttest_cmp expect file2\n \n '\n \n@@ -744,8 +777,10 @@ test_expect_success 'git pull --rebase does not reapply old patches' '\n test_expect_success 'git pull --rebase against local branch' '\n \tgit checkout -b copy2 to-rebase-orig &&\n \tgit pull --rebase . to-rebase &&\n-\ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = \"$(cat file2)\"\n+\techo \"conflicting modification\" >expect &&\n+\ttest_cmp expect file &&\n+\techo file >expect &&\n+\ttest_cmp expect file2\n '\n \n test_done\n-- \n2.23.0.897.g0a19638b1e\n\n"},{"id":"384426","messageId":"1a54db1d5ce6dde8f3526d19b617b7587acba851.1571435195.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571435195.git.liu.denton@gmail.com","subject":"[PATCH v2 10/15] t5520: use test_cmp_rev where possible","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-18T22:10:42Z","receivedAt":"2019-10-18T22:11:17Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"In case an invocation of `git rev-list` fails within the subshell, the\nfailure will be masked. Remove the subshell and use test_cmp_rev() so\nthat failures can be discovered.\n\nThis change was done with the following sed expressions:\n\n\ts/test \"$(git rev-parse.* \\([^)]*\\))\" = \"$(git rev-parse \\([^)]*\\))\"/test_cmp_rev \\1 \\2/\n\ts/test \\([^ ]*\\) = \"$(git rev-parse.* \\([^)]*\\))\"/test_cmp_rev \\1 \\2/\n\ts/test \"$(git rev-parse.* \\([^)]*\\))\" != \"$(git rev-parse.* \\([^)]*\\))\"/test_cmp_rev ! \\1 \\2/\n\ts/test \\([^ ]*\\) != \"$(git rev-parse.* \\([^)]*\\))\"/test_cmp_rev ! \\1 \\2/\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 50 ++++++++++++++++++++++++-------------------------\n 1 file changed, 25 insertions(+), 25 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 18225d8430..1af6ea06ee 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -230,7 +230,7 @@ test_expect_success 'fast-forwards working tree if branch head is updated' '\n \tgit pull . second:third 2>err &&\n \ttest_i18ngrep \"fetch updated the current branch head\" err &&\n \ttest \"$(cat file)\" = modified &&\n-\ttest \"$(git rev-parse third)\" = \"$(git rev-parse second)\"\n+\ttest_cmp_rev third second\n '\n \n test_expect_success 'fast-forward fails with conflicting work tree' '\n@@ -241,7 +241,7 @@ test_expect_success 'fast-forward fails with conflicting work tree' '\n \ttest_must_fail git pull . second:third 2>err &&\n \ttest_i18ngrep \"Cannot fast-forward your working tree\" err &&\n \ttest \"$(cat file)\" = conflict &&\n-\ttest \"$(git rev-parse third)\" = \"$(git rev-parse second)\"\n+\ttest_cmp_rev third second\n '\n \n test_expect_success '--rebase' '\n@@ -254,7 +254,7 @@ test_expect_success '--rebase' '\n \tgit commit -m \"new file\" &&\n \tgit tag before-rebase &&\n \tgit pull --rebase . copy &&\n-\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\"\n '\n \n@@ -266,7 +266,7 @@ test_expect_success '--rebase fast forward' '\n \n \tgit checkout to-rebase &&\n \tgit pull --rebase . ff &&\n-\ttest \"$(git rev-parse HEAD)\" = \"$(git rev-parse ff)\" &&\n+\ttest_cmp_rev HEAD ff &&\n \n \t# The above only validates the result.  Did we actually bypass rebase?\n \tgit reflog -1 >reflog.actual &&\n@@ -290,7 +290,7 @@ test_expect_success '--rebase --autostash fast forward' '\n \tgit checkout behind &&\n \techo dirty >file &&\n \tgit pull --rebase --autostash . to-rebase-ff &&\n-\ttest \"$(git rev-parse HEAD)\" = \"$(git rev-parse to-rebase-ff)\"\n+\ttest_cmp_rev HEAD to-rebase-ff\n '\n \n test_expect_success '--rebase with conflicts shows advice' '\n@@ -328,7 +328,7 @@ test_expect_success 'failed --rebase shows advice' '\n test_expect_success '--rebase fails with multiple branches' '\n \tgit reset --hard before-rebase &&\n \ttest_must_fail git pull --rebase . copy master 2>err &&\n-\ttest \"$(git rev-parse HEAD)\" = \"$(git rev-parse before-rebase)\" &&\n+\ttest_cmp_rev HEAD before-rebase &&\n \ttest_i18ngrep \"Cannot rebase onto multiple branches\" err &&\n \ttest modified = \"$(git show HEAD:file)\"\n '\n@@ -380,7 +380,7 @@ test_expect_success 'pull.rebase' '\n \tgit reset --hard before-rebase &&\n \ttest_config pull.rebase true &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\"\n '\n \n@@ -398,7 +398,7 @@ test_expect_success 'branch.to-rebase.rebase' '\n \tgit reset --hard before-rebase &&\n \ttest_config branch.to-rebase.rebase true &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\"\n '\n \n@@ -407,14 +407,14 @@ test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n \ttest_config pull.rebase true &&\n \ttest_config branch.to-rebase.rebase false &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^)\" != \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev ! HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\"\n '\n \n test_expect_success 'pull --rebase warns on --verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --verify-signatures . copy 2>err &&\n-\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\" &&\n \ttest_i18ngrep \"ignoring --verify-signatures for rebase\" err\n '\n@@ -422,7 +422,7 @@ test_expect_success 'pull --rebase warns on --verify-signatures' '\n test_expect_success 'pull --rebase does not warn on --no-verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --no-verify-signatures . copy 2>err &&\n-\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\" &&\n \ttest_i18ngrep ! \"verify-signatures\" err\n '\n@@ -443,8 +443,8 @@ test_expect_success 'pull.rebase=false create a new merge commit' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase false &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^1)\" = \"$(git rev-parse before-preserve-rebase)\" &&\n-\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^1 before-preserve-rebase &&\n+\ttest_cmp_rev HEAD^2 copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -452,7 +452,7 @@ test_expect_success 'pull.rebase=true flattens keep-merge' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase true &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^^ copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -460,7 +460,7 @@ test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase 1 &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^^ copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -469,8 +469,8 @@ test_expect_success REBASE_P \\\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase preserve &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n-\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse keep-merge)\"\n+\ttest_cmp_rev HEAD^^ copy &&\n+\ttest_cmp_rev HEAD^2 keep-merge\n '\n \n test_expect_success 'pull.rebase=interactive' '\n@@ -505,8 +505,8 @@ test_expect_success '--rebase=false create a new merge commit' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase true &&\n \tgit pull --rebase=false . copy &&\n-\ttest \"$(git rev-parse HEAD^1)\" = \"$(git rev-parse before-preserve-rebase)\" &&\n-\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^1 before-preserve-rebase &&\n+\ttest_cmp_rev HEAD^2 copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -514,7 +514,7 @@ test_expect_success '--rebase=true rebases and flattens keep-merge' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase preserve &&\n \tgit pull --rebase=true . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^^ copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -523,8 +523,8 @@ test_expect_success REBASE_P \\\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase true &&\n \tgit pull --rebase=preserve . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n-\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse keep-merge)\"\n+\ttest_cmp_rev HEAD^^ copy &&\n+\ttest_cmp_rev HEAD^2 keep-merge\n '\n \n test_expect_success '--rebase=invalid fails' '\n@@ -536,7 +536,7 @@ test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-m\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase preserve &&\n \tgit pull --rebase . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^^ copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -597,10 +597,10 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '\n \techo dirty >>file &&\n \tgit add file &&\n \ttest_must_fail git pull &&\n-\ttest \"$COPY\" = \"$(git rev-parse --verify me/copy)\" &&\n+\ttest_cmp_rev \"$COPY\" me/copy &&\n \tgit checkout HEAD -- file &&\n \tgit pull &&\n-\ttest \"$COPY\" != \"$(git rev-parse --verify me/copy)\"\n+\ttest_cmp_rev ! \"$COPY\" me/copy\n '\n \n test_expect_success 'pull --rebase works on branch yet to be born' '\n-- \n2.23.0.897.g0a19638b1e\n\n"},{"id":"384427","messageId":"3d982230be6af86120534d1233eee98d5a152485.1571435195.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571435195.git.liu.denton@gmail.com","subject":"[PATCH v2 08/15] t5520: use test_line_count where possible","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-18T22:10:37Z","receivedAt":"2019-10-18T22:11:18Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Instead of rolling our own functionality to test the number of lines a\ncommand outputs, use test_line_count() which provides better debugging\ninformation in the case of a failure.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 7bb9031140..0ca4867e96 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -699,7 +699,8 @@ test_expect_success 'git pull --rebase does not reapply old patches' '\n \t(\n \t\tcd dst &&\n \t\ttest_must_fail git pull --rebase &&\n-\t\ttest 1 = $(find .git/rebase-apply -name \"000*\" | wc -l)\n+\t\tfind .git/rebase-apply -name \"000*\" >patches &&\n+\t\ttest_line_count = 1 patches\n \t)\n '\n \n-- \n2.23.0.897.g0a19638b1e\n\n"},{"id":"384428","messageId":"830a8212ae78e2bb3f1001dc11cf6ba2edb85561.1571435195.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571435195.git.liu.denton@gmail.com","subject":"[PATCH v2 07/15] t5520: remove spaces after redirect operator","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-18T22:10:34Z","receivedAt":"2019-10-18T22:11:27Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"The style for tests in Git is to have the redirect operator attached to\nthe filename with no spaces. Fix test cases where this is not the case.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 004d5884cd..7bb9031140 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -243,10 +243,10 @@ test_expect_success 'fast-forward fails with conflicting work tree' '\n \n test_expect_success '--rebase' '\n \tgit branch to-rebase &&\n-\techo modified again > file &&\n+\techo modified again >file &&\n \tgit commit -m file file &&\n \tgit checkout to-rebase &&\n-\techo new > file2 &&\n+\techo new >file2 &&\n \tgit add file2 &&\n \tgit commit -m \"new file\" &&\n \tgit tag before-rebase &&\n@@ -542,10 +542,10 @@ test_expect_success '--rebase with rebased upstream' '\n \tgit checkout copy &&\n \tgit tag copy-orig &&\n \tgit reset --hard HEAD^ &&\n-\techo conflicting modification > file &&\n+\techo conflicting modification >file &&\n \tgit commit -m conflict file &&\n \tgit checkout to-rebase &&\n-\techo file > file2 &&\n+\techo file >file2 &&\n \tgit commit -m to-rebase file2 &&\n \tgit tag to-rebase-orig &&\n \tgit pull --rebase me copy &&\n@@ -591,7 +591,7 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '\n \ttest_config branch.to-rebase.remote me &&\n \ttest_config branch.to-rebase.merge refs/heads/copy &&\n \ttest_config branch.to-rebase.rebase true &&\n-\techo dirty >> file &&\n+\techo dirty >>file &&\n \tgit add file &&\n \ttest_must_fail git pull &&\n \ttest \"$COPY\" = \"$(git rev-parse --verify me/copy)\" &&\n-- \n2.23.0.897.g0a19638b1e\n\n"},{"id":"384429","messageId":"9fac3dff833624c458cd0bf14d811ea49ac1ee30.1571435195.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571435195.git.liu.denton@gmail.com","subject":"[PATCH v2 05/15] t5520: let sed open its own input","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-18T22:10:29Z","receivedAt":"2019-10-18T22:11:36Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"We were using a redirection operator to feed input into sed. However,\nsince sed is capable of opening its own files, make sed open its own\nfiles instead of redirecting input into it.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex a3de2e19b6..55560ce3cd 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -5,7 +5,7 @@ test_description='pulling into void'\n . ./test-lib.sh\n \n modify () {\n-\tsed -e \"$1\" <\"$2\" >\"$2.x\" &&\n+\tsed -e \"$1\" \"$2\" >\"$2.x\" &&\n \tmv \"$2.x\" \"$2\"\n }\n \n-- \n2.23.0.897.g0a19638b1e\n\n"},{"id":"384430","messageId":"dfa89ba1cbf8c361aa438b42dcd42e4ae6b49eb6.1571435195.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571435195.git.liu.denton@gmail.com","subject":"[PATCH v2 04/15] t5520: use sq for test case names","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-18T22:10:26Z","receivedAt":"2019-10-18T22:11:54Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"The usual convention is for test case names to be written between\nsingle-quotes. Change all double-quoted test case names to single-quotes\nexcept for two test case names that use variables within.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 51d6ce8aec..a3de2e19b6 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -408,7 +408,7 @@ test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n \ttest new = \"$(git show HEAD:file2)\"\n '\n \n-test_expect_success \"pull --rebase warns on --verify-signatures\" '\n+test_expect_success 'pull --rebase warns on --verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --verify-signatures . copy 2>err &&\n \ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n@@ -416,7 +416,7 @@ test_expect_success \"pull --rebase warns on --verify-signatures\" '\n \ttest_i18ngrep \"ignoring --verify-signatures for rebase\" err\n '\n \n-test_expect_success \"pull --rebase does not warn on --no-verify-signatures\" '\n+test_expect_success 'pull --rebase does not warn on --no-verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --no-verify-signatures . copy 2>err &&\n \ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n-- \n2.23.0.897.g0a19638b1e\n\n"},{"id":"384431","messageId":"0a569808576de4edad598edcafa9fc9a35b056a6.1571435195.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571435195.git.liu.denton@gmail.com","subject":"[PATCH v2 03/15] t5520: improve test style","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-18T22:10:23Z","receivedAt":"2019-10-18T22:12:02Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Improve the test style by removing leading and trailing empty lines\nwithin test cases. Also, reformat multi-line subshells to conform to the\nexisting style.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 88 +++++++++++++++++++++++++------------------------\n 1 file changed, 45 insertions(+), 43 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex cf4cc32fd0..51d6ce8aec 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -538,7 +538,6 @@ test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-m\n '\n \n test_expect_success '--rebase with rebased upstream' '\n-\n \tgit remote add -f me . &&\n \tgit checkout copy &&\n \tgit tag copy-orig &&\n@@ -552,7 +551,6 @@ test_expect_success '--rebase with rebased upstream' '\n \tgit pull --rebase me copy &&\n \ttest \"conflicting modification\" = \"$(cat file)\" &&\n \ttest file = \"$(cat file2)\"\n-\n '\n \n test_expect_success '--rebase -f with rebased upstream' '\n@@ -564,14 +562,12 @@ test_expect_success '--rebase -f with rebased upstream' '\n '\n \n test_expect_success '--rebase with rebased default upstream' '\n-\n \tgit update-ref refs/remotes/me/copy copy-orig &&\n \tgit checkout --track -b to-rebase2 me/copy &&\n \tgit reset --hard to-rebase-orig &&\n \tgit pull --rebase &&\n \ttest \"conflicting modification\" = \"$(cat file)\" &&\n \ttest file = \"$(cat file2)\"\n-\n '\n \n test_expect_success 'rebased upstream + fetch + pull --rebase' '\n@@ -588,7 +584,6 @@ test_expect_success 'rebased upstream + fetch + pull --rebase' '\n '\n \n test_expect_success 'pull --rebase dies early with dirty working directory' '\n-\n \tgit checkout to-rebase &&\n \tgit update-ref refs/remotes/me/copy copy^ &&\n \tCOPY=\"$(git rev-parse --verify me/copy)\" &&\n@@ -603,16 +598,16 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '\n \tgit checkout HEAD -- file &&\n \tgit pull &&\n \ttest \"$COPY\" != \"$(git rev-parse --verify me/copy)\"\n-\n '\n \n test_expect_success 'pull --rebase works on branch yet to be born' '\n \tgit rev-parse master >expect &&\n \tmkdir empty_repo &&\n-\t(cd empty_repo &&\n-\t git init &&\n-\t git pull --rebase .. master &&\n-\t git rev-parse HEAD >../actual\n+\t(\n+\t\tcd empty_repo &&\n+\t\tgit init &&\n+\t\tgit pull --rebase .. master &&\n+\t\tgit rev-parse HEAD >../actual\n \t) &&\n \ttest_cmp expect actual\n '\n@@ -646,58 +641,65 @@ test_expect_success 'pull --rebase fails on corrupt HEAD' '\n \n test_expect_success 'setup for detecting upstreamed changes' '\n \tmkdir src &&\n-\t(cd src &&\n-\t git init &&\n-\t printf \"1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n10\\n\" > stuff &&\n-\t git add stuff &&\n-\t git commit -m \"Initial revision\"\n+\t(\n+\t\tcd src &&\n+\t\tgit init &&\n+\t\tprintf \"1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n10\\n\" > stuff &&\n+\t\tgit add stuff &&\n+\t\tgit commit -m \"Initial revision\"\n \t) &&\n \tgit clone src dst &&\n-\t(cd src &&\n-\t modify s/5/43/ stuff &&\n-\t git commit -a -m \"5->43\" &&\n-\t modify s/6/42/ stuff &&\n-\t git commit -a -m \"Make it bigger\"\n+\t(\n+\t\tcd src &&\n+\t\tmodify s/5/43/ stuff &&\n+\t\tgit commit -a -m \"5->43\" &&\n+\t\tmodify s/6/42/ stuff &&\n+\t\tgit commit -a -m \"Make it bigger\"\n \t) &&\n-\t(cd dst &&\n-\t modify s/5/43/ stuff &&\n-\t git commit -a -m \"Independent discovery of 5->43\"\n+\t(\n+\t\tcd dst &&\n+\t\tmodify s/5/43/ stuff &&\n+\t\tgit commit -a -m \"Independent discovery of 5->43\"\n \t)\n '\n \n test_expect_success 'git pull --rebase detects upstreamed changes' '\n-\t(cd dst &&\n-\t git pull --rebase &&\n-\t test -z \"$(git ls-files -u)\"\n+\t(\n+\t\tcd dst &&\n+\t\tgit pull --rebase &&\n+\t\ttest -z \"$(git ls-files -u)\"\n \t)\n '\n \n test_expect_success 'setup for avoiding reapplying old patches' '\n-\t(cd dst &&\n-\t test_might_fail git rebase --abort &&\n-\t git reset --hard origin/master\n+\t(\n+\t\tcd dst &&\n+\t\ttest_might_fail git rebase --abort &&\n+\t\tgit reset --hard origin/master\n \t) &&\n \tgit clone --bare src src-replace.git &&\n \trm -rf src &&\n \tmv src-replace.git src &&\n-\t(cd dst &&\n-\t modify s/2/22/ stuff &&\n-\t git commit -a -m \"Change 2\" &&\n-\t modify s/3/33/ stuff &&\n-\t git commit -a -m \"Change 3\" &&\n-\t modify s/4/44/ stuff &&\n-\t git commit -a -m \"Change 4\" &&\n-\t git push &&\n-\n-\t modify s/44/55/ stuff &&\n-\t git commit --amend -a -m \"Modified Change 4\"\n+\t(\n+\t\tcd dst &&\n+\t\tmodify s/2/22/ stuff &&\n+\t\tgit commit -a -m \"Change 2\" &&\n+\t\tmodify s/3/33/ stuff &&\n+\t\tgit commit -a -m \"Change 3\" &&\n+\t\tmodify s/4/44/ stuff &&\n+\t\tgit commit -a -m \"Change 4\" &&\n+\t\tgit push &&\n+\n+\t\tmodify s/44/55/ stuff &&\n+\t\tgit commit --amend -a -m \"Modified Change 4\"\n \t)\n '\n \n test_expect_success 'git pull --rebase does not reapply old patches' '\n-\t(cd dst &&\n-\t test_must_fail git pull --rebase &&\n-\t test 1 = $(find .git/rebase-apply -name \"000*\" | wc -l)\n+\t(\n+\t\tcd dst &&\n+\t\ttest_must_fail git pull --rebase &&\n+\t\ttest 1 = $(find .git/rebase-apply -name \"000*\" | wc -l)\n \t)\n '\n \n-- \n2.23.0.897.g0a19638b1e\n\n"},{"id":"384432","messageId":"417e808466ee3e61a1719faa319fe0e796d5d271.1571435195.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571435195.git.liu.denton@gmail.com","subject":"[PATCH v2 02/15] t: teach test_cmp_rev to accept ! for not-equals","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-18T22:10:21Z","receivedAt":"2019-10-18T22:12:13Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Currently, in the case where we are using test_cmp_rev() to report\nnot-equals, we write `! test_cmp_rev`. However, since test_cmp_rev()\ncontains\n\n\tr1=$(git rev-parse --verify \"$1\") &&\n\tr2=$(git rev-parse --verify \"$2\") &&\n\nIn the case where `git rev-parse` segfaults and dies unexpectedly, the\nfailure will be ignored.\n\nRewrite test_cmp_rev() to optionally accept \"!\" as the first argument to\ndo a not-equals comparison. Rewrite `! test_cmp_rev` to `test_cmp_rev !`\nin all tests to take advantage of this new functionality.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t2400-worktree-add.sh             |  4 ++--\n t/t3400-rebase.sh                   |  2 +-\n t/t3421-rebase-topology-linear.sh   |  6 +++---\n t/t3430-rebase-merges.sh            |  2 +-\n t/t3432-rebase-fast-forward.sh      |  2 +-\n t/t3501-revert-cherry-pick.sh       |  2 +-\n t/t3508-cherry-pick-many-commits.sh |  2 +-\n t/test-lib-functions.sh             | 13 +++++++++++--\n 8 files changed, 21 insertions(+), 12 deletions(-)\n\ndiff --git a/t/t2400-worktree-add.sh b/t/t2400-worktree-add.sh\nindex e819ba741e..52d476979b 100755\n--- a/t/t2400-worktree-add.sh\n+++ b/t/t2400-worktree-add.sh\n@@ -438,7 +438,7 @@ test_expect_success 'git worktree add does not match remote' '\n \t\tcd foo &&\n \t\ttest_must_fail git config \"branch.foo.remote\" &&\n \t\ttest_must_fail git config \"branch.foo.merge\" &&\n-\t\t! test_cmp_rev refs/remotes/repo_a/foo refs/heads/foo\n+\t\ttest_cmp_rev ! refs/remotes/repo_a/foo refs/heads/foo\n \t)\n '\n \n@@ -483,7 +483,7 @@ test_expect_success 'git worktree --no-guess-remote option overrides config' '\n \t\tcd foo &&\n \t\ttest_must_fail git config \"branch.foo.remote\" &&\n \t\ttest_must_fail git config \"branch.foo.merge\" &&\n-\t\t! test_cmp_rev refs/remotes/repo_a/foo refs/heads/foo\n+\t\ttest_cmp_rev ! refs/remotes/repo_a/foo refs/heads/foo\n \t)\n '\n \ndiff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh\nindex ab18ac5f28..f267f6cd54 100755\n--- a/t/t3400-rebase.sh\n+++ b/t/t3400-rebase.sh\n@@ -64,7 +64,7 @@ test_expect_success 'rebase sets ORIG_HEAD to pre-rebase state' '\n \tpre=\"$(git rev-parse --verify HEAD)\" &&\n \tgit rebase master &&\n \ttest_cmp_rev \"$pre\" ORIG_HEAD &&\n-\t! test_cmp_rev \"$pre\" HEAD\n+\ttest_cmp_rev ! \"$pre\" HEAD\n '\n \n test_expect_success 'rebase, with <onto> and <upstream> specified as :/quuxery' '\ndiff --git a/t/t3421-rebase-topology-linear.sh b/t/t3421-rebase-topology-linear.sh\nindex b847064f91..325072b0a3 100755\n--- a/t/t3421-rebase-topology-linear.sh\n+++ b/t/t3421-rebase-topology-linear.sh\n@@ -61,7 +61,7 @@ test_run_rebase () {\n \ttest_expect_$result \"rebase $* -f rewrites even if upstream is an ancestor\" \"\n \t\treset_rebase &&\n \t\tgit rebase $* -f b e &&\n-\t\t! test_cmp_rev e HEAD &&\n+\t\ttest_cmp_rev ! e HEAD &&\n \t\ttest_cmp_rev b HEAD~2 &&\n \t\ttest_linear_range 'd e' b..\n \t\"\n@@ -78,7 +78,7 @@ test_run_rebase () {\n \ttest_expect_$result \"rebase $* -f rewrites even if remote upstream is an ancestor\" \"\n \t\treset_rebase &&\n \t\tgit rebase $* -f branch-b branch-e &&\n-\t\t! test_cmp_rev branch-e origin/branch-e &&\n+\t\ttest_cmp_rev ! branch-e origin/branch-e &&\n \t\ttest_cmp_rev branch-b HEAD~2 &&\n \t\ttest_linear_range 'd e' branch-b..\n \t\"\n@@ -368,7 +368,7 @@ test_run_rebase () {\n \ttest_expect_$result \"rebase $* -f --root on linear history causes re-write\" \"\n \t\treset_rebase &&\n \t\tgit rebase $* -f --root c &&\n-\t\t! test_cmp_rev a HEAD~2 &&\n+\t\ttest_cmp_rev ! a HEAD~2 &&\n \t\ttest_linear_range 'a b c' HEAD\n \t\"\n }\ndiff --git a/t/t3430-rebase-merges.sh b/t/t3430-rebase-merges.sh\nindex 9efcf4808a..abbdc26b1b 100755\n--- a/t/t3430-rebase-merges.sh\n+++ b/t/t3430-rebase-merges.sh\n@@ -346,7 +346,7 @@ test_expect_success 'A root commit can be a cousin, treat it that way' '\n \tgit merge --allow-unrelated-histories khnum &&\n \ttest_tick &&\n \tgit rebase -f -r HEAD^ &&\n-\t! test_cmp_rev HEAD^2 khnum &&\n+\ttest_cmp_rev ! HEAD^2 khnum &&\n \ttest_cmp_graph HEAD^.. <<-\\EOF &&\n \t*   Merge branch '\\''khnum'\\'' into asherah\n \t|\\\ndiff --git a/t/t3432-rebase-fast-forward.sh b/t/t3432-rebase-fast-forward.sh\nindex 034ffc7e76..92f95b57da 100755\n--- a/t/t3432-rebase-fast-forward.sh\n+++ b/t/t3432-rebase-fast-forward.sh\n@@ -64,7 +64,7 @@ test_rebase_same_head_ () {\n \t\t\ttest_cmp_rev \\$oldhead \\$newhead\n \t\telif test $cmp = diff\n \t\tthen\n-\t\t\t! test_cmp_rev \\$oldhead \\$newhead\n+\t\t\ttest_cmp_rev ! \\$oldhead \\$newhead\n \t\tfi\n \t\"\n }\ndiff --git a/t/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh\nindex d1c68af8c5..1c51a9131d 100755\n--- a/t/t3501-revert-cherry-pick.sh\n+++ b/t/t3501-revert-cherry-pick.sh\n@@ -106,7 +106,7 @@ test_expect_success 'cherry-pick on unborn branch' '\n \trm -rf * &&\n \tgit cherry-pick initial &&\n \tgit diff --quiet initial &&\n-\t! test_cmp_rev initial HEAD\n+\ttest_cmp_rev ! initial HEAD\n '\n \n test_expect_success 'cherry-pick \"-\" to pick from previous branch' '\ndiff --git a/t/t3508-cherry-pick-many-commits.sh b/t/t3508-cherry-pick-many-commits.sh\nindex b457333e18..23070a7b73 100755\n--- a/t/t3508-cherry-pick-many-commits.sh\n+++ b/t/t3508-cherry-pick-many-commits.sh\n@@ -5,7 +5,7 @@ test_description='test cherry-picking many commits'\n . ./test-lib.sh\n \n check_head_differs_from() {\n-\t! test_cmp_rev HEAD \"$1\"\n+\ttest_cmp_rev ! HEAD \"$1\"\n }\n \n check_head_equals() {\ndiff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh\nindex b299ecc326..76dce5f8ee 100644\n--- a/t/test-lib-functions.sh\n+++ b/t/test-lib-functions.sh\n@@ -1012,8 +1012,17 @@ test_must_be_empty () {\n \tfi\n }\n \n-# Tests that its two parameters refer to the same revision\n+# Tests that its two parameters refer to the same revision, or if '!' is\n+# provided first, that its other two parameters refer to different\n+# revisions.\n test_cmp_rev () {\n+\tlocal inverted_op\n+\tinverted_op='!='\n+\tif test $# -ge 1 && test \"x$1\" = 'x!'\n+\tthen\n+\t    inverted_op='='\n+\t    shift\n+\tfi\n \tif test $# != 2\n \tthen\n \t\terror \"bug in the test script: test_cmp_rev requires two revisions, but got $#\"\n@@ -1021,7 +1030,7 @@ test_cmp_rev () {\n \t\tlocal r1 r2\n \t\tr1=$(git rev-parse --verify \"$1\") &&\n \t\tr2=$(git rev-parse --verify \"$2\") &&\n-\t\tif test \"$r1\" != \"$r2\"\n+\t\tif test \"$r1\" \"$inverted_op\" \"$r2\"\n \t\tthen\n \t\t\tcat >&4 <<-EOF\n \t\t\terror: two revisions point to different objects:\n-- \n2.23.0.897.g0a19638b1e\n\n"},{"id":"384433","messageId":"20191018221429.GA20245@generichostname","threadId":"52061","inReplyTo":"cover.1571435195.git.liu.denton@gmail.com","subject":"Re: [PATCH v2 00/15] t5520: various test cleanup","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-18T22:14:29Z","receivedAt":"2019-10-18T22:14:35Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Sorry for the double-send. public-inbox and MARC both showed that\nonly 3 messages got through the in the first send so I sent it again.\nSeems to have gotten through find the second time around.\n\nOn Fri, Oct 18, 2019 at 03:04:03PM -0700, Denton Liu wrote:\n> Like earlier patchsets, I want to implement a feature that involves\n> modifications to the test suite. Since that feature will probably take a\n> while to polish up, however, let's clean up the test suite in a separate\n> patchset first so it's not blocked by the feature work.\n> \n> 1/15 is a cleanup to an unrelated test that I found while addressing\n> some of Eric's comments.\n> \n> 2/15 is a general improvement to test_rev_cmp() that will be used later\n> in the series.\n> \n> Changes since v1:\n> \n> * Incorporate Eric's feedback\n> \n> Denton Liu (15):\n>   t7408: replace `test_must_fail test_path_is_file`\n>   t: teach test_cmp_rev to accept ! for not-equals\n>   t5520: improve test style\n>   t5520: use sq for test case names\n>   t5520: let sed open its own input\n>   t5520: replace test -f with test-lib functions\n>   t5520: remove spaces after redirect operator\n>   t5520: use test_line_count where possible\n>   t5520: replace test -{n,z} with test-lib functions\n>   t5520: use test_cmp_rev where possible\n>   t5520: test single-line files by git with test_cmp\n>   t5520: don't put git in upstream of pipe\n>   t5520: replace subshell cat comparison with test_cmp\n>   t5520: remove redundant lines in test cases\n>   t5520: replace `! git` with `test_must_fail git`\n> \n>  t/t2400-worktree-add.sh             |   4 +-\n>  t/t3400-rebase.sh                   |   2 +-\n>  t/t3421-rebase-topology-linear.sh   |   6 +-\n>  t/t3430-rebase-merges.sh            |   2 +-\n>  t/t3432-rebase-fast-forward.sh      |   2 +-\n>  t/t3501-revert-cherry-pick.sh       |   2 +-\n>  t/t3508-cherry-pick-many-commits.sh |   2 +-\n>  t/t5520-pull.sh                     | 343 +++++++++++++++++-----------\n>  t/t7408-submodule-reference.sh      |   2 +-\n>  t/test-lib-functions.sh             |  13 +-\n>  10 files changed, 227 insertions(+), 151 deletions(-)\n> \n> Range-diff against v1:\n>  -:  ---------- >  1:  987fee4652 t7408: replace `test_must_fail test_path_is_file`\n>  -:  ---------- >  2:  417e808466 t: teach test_cmp_rev to accept ! for not-equals\n>  1:  0bc54dd330 =  3:  0a56980857 t5520: improve test style\n>  2:  a5dee82ecc =  4:  dfa89ba1cb t5520: use sq for test case names\n>  3:  58cc2fcda3 =  5:  9fac3dff83 t5520: let sed open its own input\n>  4:  d2946208d3 !  6:  c6ca45eb17 t5520: replace test -f with test_path_is_file\n>     @@ Metadata\n>      Author: Denton Liu <liu.denton@gmail.com>\n>      \n>       ## Commit message ##\n>     -    t5520: replace test -f with test_path_is_file\n>     +    t5520: replace test -f with test-lib functions\n>      \n>          Although `test -f` has the same functionality as test_path_is_file(), in\n>          the case where test_path_is_file() fails, we get much better debugging\n>     -    information. Replace `test -f` with test_path_is_file so that future\n>     -    developers will have a better experience debugging these test cases.\n>     +    information.\n>     +\n>     +    Replace `test -f` with test_path_is_file() so that future developers\n>     +    will have a better experience debugging these test cases.\n>     +\n>     +    Also, in the case of `! test -f`, not only should that path not be a\n>     +    file, it shouldn't exist at all so replace it with\n>     +    test_path_is_missing().\n>      \n>          Signed-off-by: Denton Liu <liu.denton@gmail.com>\n>      \n>     @@ t/t5520-pull.sh: test_expect_success 'pulling into void must not create an octop\n>       \t\tcd cloned-octopus &&\n>       \t\ttest_must_fail git pull .. master master &&\n>      -\t\t! test -f file\n>     -+\t\ttest_must_fail test_path_is_file file\n>     ++\t\ttest_path_is_missing file\n>       \t)\n>       '\n>       \n>  5:  5b4c1dd291 =  7:  830a8212ae t5520: remove spaces after redirect operator\n>  6:  26fea15950 =  8:  3d982230be t5520: use test_line_count where possible\n>  7:  3fc0354c9c !  9:  2bca4f046d t5520: replace test -{n,z} with test-lib functions\n>     @@ Metadata\n>       ## Commit message ##\n>          t5520: replace test -{n,z} with test-lib functions\n>      \n>     +    When wrapping a Git command in a subshell within another command, we\n>     +    throw away the Git command's exit code. In case the Git command fails,\n>     +    we would like to know about it rather than the failure being silent.\n>     +    Extract Git commands so that their exit codes are not lost.\n>     +\n>          Instead of using `test -n` or `test -z`, replace them respectively with\n>     -    invocations of test_file_not_empty() and test_must_be_empty().\n>     +    invocations of test_file_not_empty() and test_must_be_empty() so that we\n>     +    get better debugging information in the case of a failure.\n>      \n>          Signed-off-by: Denton Liu <liu.denton@gmail.com>\n>      \n>  8:  f4eb80c9ac ! 10:  1a54db1d5c t5520: use test_cmp_rev where possible\n>     @@ Commit message\n>      \n>                  s/test \"$(git rev-parse.* \\([^)]*\\))\" = \"$(git rev-parse \\([^)]*\\))\"/test_cmp_rev \\1 \\2/\n>                  s/test \\([^ ]*\\) = \"$(git rev-parse.* \\([^)]*\\))\"/test_cmp_rev \\1 \\2/\n>     -            s/test \"$(git rev-parse.* \\([^)]*\\))\" != \"$(git rev-parse.* \\([^)]*\\))\"/test_must_fail test_cmp_rev \\1 \\2/\n>     -            s/test \\([^ ]*\\) != \"$(git rev-parse.* \\([^)]*\\))\"/test_must_fail test_cmp_rev \\1 \\2/\n>     +            s/test \"$(git rev-parse.* \\([^)]*\\))\" != \"$(git rev-parse.* \\([^)]*\\))\"/test_cmp_rev ! \\1 \\2/\n>     +            s/test \\([^ ]*\\) != \"$(git rev-parse.* \\([^)]*\\))\"/test_cmp_rev ! \\1 \\2/\n>      \n>          Signed-off-by: Denton Liu <liu.denton@gmail.com>\n>      \n>     @@ t/t5520-pull.sh: test_expect_success 'branch.to-rebase.rebase should override pu\n>       \ttest_config branch.to-rebase.rebase false &&\n>       \tgit pull . copy &&\n>      -\ttest \"$(git rev-parse HEAD^)\" != \"$(git rev-parse copy)\" &&\n>     -+\ttest_must_fail test_cmp_rev HEAD^ copy &&\n>     ++\ttest_cmp_rev ! HEAD^ copy &&\n>       \ttest new = \"$(git show HEAD:file2)\"\n>       '\n>       \n>     @@ t/t5520-pull.sh: test_expect_success 'pull --rebase dies early with dirty workin\n>       \tgit checkout HEAD -- file &&\n>       \tgit pull &&\n>      -\ttest \"$COPY\" != \"$(git rev-parse --verify me/copy)\"\n>     -+\ttest_must_fail test_cmp_rev \"$COPY\" me/copy\n>     ++\ttest_cmp_rev ! \"$COPY\" me/copy\n>       '\n>       \n>       test_expect_success 'pull --rebase works on branch yet to be born' '\n>  9:  bd3ec4239c ! 11:  52cf4f0d0f t5520: test single-line files by git with test_cmp\n>     @@ Commit message\n>                  s/\\(\\s*\\)test \\([^ ]*\\) = \"$(\\(git [^)]*\\))\"/\\1echo \\2 >expect \\&\\&\\n\\1\\3 >actual \\&\\&\\n\\1test_cmp expect actual/\n>                  s/\\(\\s*\\)test \"$(\\(git [^)]*\\))\" = \\([^ ]*\\)/\\1echo \\3 >expect \\&\\&\\n\\1\\2 >actual \\&\\&\\n\\1test_cmp expect actual/\n>      \n>     +    A future patch will clean up situations where we have multiple duplicate\n>     +    statements within a test case. This is done to keep this patch purely\n>     +    mechanical.\n>     +\n>          Signed-off-by: Denton Liu <liu.denton@gmail.com>\n>      \n>       ## t/t5520-pull.sh ##\n>     @@ t/t5520-pull.sh: test_expect_success 'branch.to-rebase.rebase' '\n>      @@ t/t5520-pull.sh: test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n>       \ttest_config branch.to-rebase.rebase false &&\n>       \tgit pull . copy &&\n>     - \ttest_must_fail test_cmp_rev HEAD^ copy &&\n>     + \ttest_cmp_rev ! HEAD^ copy &&\n>      -\ttest new = \"$(git show HEAD:file2)\"\n>      +\techo new >expect &&\n>      +\tgit show HEAD:file2 >actual &&\n> 10:  61b4df0f7c = 12:  0cfabb201c t5520: don't put git in upstream of pipe\n> 11:  f3429bbb57 ! 13:  b2d0ce21c8 t5520: replace subshell cat comparison with test_cmp\n>     @@ Commit message\n>                  s/\\(\\s*\\)test \\([^=]*\\)= \"$(cat \\([^)]*\\))\"/\\1echo \\2>expect \\&\\&\\n\\1test_cmp expect \\3/\n>                  s/\\(\\s*\\)test \"$(cat \\([^)]*\\))\" = \\([^&]*\\)\\( &&\\)\\?$/\\1echo \\3 >expect \\&\\&\\n\\1test_cmp expect \\2\\4/\n>      \n>     +    A future patch will clean up situations where we have multiple duplicate\n>     +    statements within a test case. This is done to keep this patch purely\n>     +    mechanical.\n>     +\n>          Signed-off-by: Denton Liu <liu.denton@gmail.com>\n>      \n>       ## t/t5520-pull.sh ##\n>  -:  ---------- > 14:  5aac40a029 t5520: remove redundant lines in test cases\n> 12:  3e6c591b2b = 15:  2c0d3ac416 t5520: replace `! git` with `test_must_fail git`\n> -- \n> 2.23.0.897.g0a19638b1e\n> \n"},{"id":"384435","messageId":"20191018224502.GL29845@szeder.dev","threadId":"52061","inReplyTo":"417e808466ee3e61a1719faa319fe0e796d5d271.1571435195.git.liu.denton@gmail.com","subject":"Re: [PATCH v2 02/15] t: teach test_cmp_rev to accept ! for not-equals","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2019-10-18T22:45:02Z","receivedAt":"2019-10-18T22:45:09Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"On Fri, Oct 18, 2019 at 03:10:21PM -0700, Denton Liu wrote:\n> Currently, in the case where we are using test_cmp_rev() to report\n> not-equals, we write `! test_cmp_rev`. However, since test_cmp_rev()\n> contains\n> \n> \tr1=$(git rev-parse --verify \"$1\") &&\n> \tr2=$(git rev-parse --verify \"$2\") &&\n> \n> In the case where `git rev-parse` segfaults and dies unexpectedly, the\n> failure will be ignored.\n> \n> Rewrite test_cmp_rev() to optionally accept \"!\" as the first argument to\n> do a not-equals comparison. Rewrite `! test_cmp_rev` to `test_cmp_rev !`\n> in all tests to take advantage of this new functionality.\n> \n> Signed-off-by: Denton Liu <liu.denton@gmail.com>\n\n\n> diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh\n> index b299ecc326..76dce5f8ee 100644\n> --- a/t/test-lib-functions.sh\n> +++ b/t/test-lib-functions.sh\n> @@ -1012,8 +1012,17 @@ test_must_be_empty () {\n>  \tfi\n>  }\n>  \n> -# Tests that its two parameters refer to the same revision\n> +# Tests that its two parameters refer to the same revision, or if '!' is\n> +# provided first, that its other two parameters refer to different\n> +# revisions.\n>  test_cmp_rev () {\n> +\tlocal inverted_op\n> +\tinverted_op='!='\n> +\tif test $# -ge 1 && test \"x$1\" = 'x!'\n> +\tthen\n> +\t    inverted_op='='\n> +\t    shift\n> +\tfi\n>  \tif test $# != 2\n>  \tthen\n>  \t\terror \"bug in the test script: test_cmp_rev requires two revisions, but got $#\"\n> @@ -1021,7 +1030,7 @@ test_cmp_rev () {\n>  \t\tlocal r1 r2\n>  \t\tr1=$(git rev-parse --verify \"$1\") &&\n>  \t\tr2=$(git rev-parse --verify \"$2\") &&\n> -\t\tif test \"$r1\" != \"$r2\"\n> +\t\tif test \"$r1\" \"$inverted_op\" \"$r2\"\n>  \t\tthen\n>  \t\t\tcat >&4 <<-EOF\n>  \t\t\terror: two revisions point to different objects:\n\nA semi-rhetorical question: how will the output of 'test_cmp_rev ! HEAD\nHEAD' look like? :)\n\n"},{"id":"384452","messageId":"769fabd5-9159-61c8-db88-52a4d261f88a@kdbg.org","threadId":"52061","inReplyTo":"987fee4652ae1bd8d3eb50ed51f7c9694d567dfc.1571435195.git.liu.denton@gmail.com","subject":"Re: [PATCH v2 01/15] t7408: replace `test_must_fail test_path_is_file`","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2019-10-19T11:58:24Z","receivedAt":"2019-10-19T11:58:30Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 19.10.19 um 00:04 schrieb Denton Liu:\n> diff --git a/t/t7408-submodule-reference.sh b/t/t7408-submodule-reference.sh\n> index 34ac28c056..9e62d43cac 100755\n> --- a/t/t7408-submodule-reference.sh\n> +++ b/t/t7408-submodule-reference.sh\n> @@ -123,7 +123,7 @@ test_expect_success 'missing submodule alternate fails clone and submodule updat\n>  \t\ttest_must_fail git submodule update --init &&\n>  \t\t# and we have no alternates:\n>  \t\ttest_must_fail test_alternate_is_used .git/modules/sub/objects/info/alternates sub &&\n\nHere's another incorrect use of test_must_fail (not the only instance in\nthis file). Looks like we would need a \"test_alternate_is_not_used\" helper.\n\n> -\t\ttest_must_fail test_path_is_file sub/file1\n> +\t\ttest_path_is_missing sub/file1\n>  \t)\n>  '\n\nI suggest to drop this patch; it doesn't fit the theme of this series,\nand if you attempt to do it right, you'll quickly find a deep rabbit hole.\n\n-- Hannes\n"},{"id":"384581","messageId":"cover.1571739459.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571435195.git.liu.denton@gmail.com","subject":"[PATCH v3 00/14] t5520: various test cleanup","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-22T10:19:51Z","receivedAt":"2019-10-22T10:19:56Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Like earlier patchsets, I want to implement a feature that involves\nmodifications to the test suite. Since that feature will probably take a\nwhile to polish up, however, let's clean up the test suite in a separate\npatchset first so it's not blocked by the feature work.\n\n1/15 is a general improvement to test_rev_cmp() that will be used later\nin the series.\n\nChanges since v2:\n\n* Drop 't7408: replace `test_must_fail test_path_is_file`' since it's\n  not a rabbit hole we want to go into right now\n\n* Fix the output of `test_cmp_rev !` when revs are actually equal\n\n* Rebase against the latest master since this topic hasn't been picked\n  up yet\n\nChanges since v1:\n\n* Incorporate Eric's feedback\n\nDenton Liu (14):\n  t: teach test_cmp_rev to accept ! for not-equals\n  t5520: improve test style\n  t5520: use sq for test case names\n  t5520: let sed open its own input\n  t5520: replace test -f with test-lib functions\n  t5520: remove spaces after redirect operator\n  t5520: use test_line_count where possible\n  t5520: replace test -{n,z} with test-lib functions\n  t5520: use test_cmp_rev where possible\n  t5520: test single-line files by git with test_cmp\n  t5520: don't put git in upstream of pipe\n  t5520: replace subshell cat comparison with test_cmp\n  t5520: remove redundant lines in test cases\n  t5520: replace `! git` with `test_must_fail git`\n\n t/t2400-worktree-add.sh             |   4 +-\n t/t3400-rebase.sh                   |   2 +-\n t/t3421-rebase-topology-linear.sh   |   6 +-\n t/t3430-rebase-merges.sh            |   2 +-\n t/t3432-rebase-fast-forward.sh      |   2 +-\n t/t3501-revert-cherry-pick.sh       |   2 +-\n t/t3508-cherry-pick-many-commits.sh |   2 +-\n t/t5520-pull.sh                     | 343 +++++++++++++++++-----------\n t/test-lib-functions.sh             |  22 +-\n 9 files changed, 234 insertions(+), 151 deletions(-)\n\nRange-diff against v2:\n 1:  987fee4652 <  -:  ---------- t7408: replace `test_must_fail test_path_is_file`\n 2:  417e808466 !  1:  9a96f113e7 t: teach test_cmp_rev to accept ! for not-equals\n    @@ t/test-lib-functions.sh: test_cmp_rev () {\n     -\t\tif test \"$r1\" != \"$r2\"\n     +\t\tif test \"$r1\" \"$inverted_op\" \"$r2\"\n      \t\tthen\n    ++\t\t\tlocal comp_out\n    ++\t\t\tif \"x$inverted_op\" = 'x='\n    ++\t\t\tthen\n    ++\t\t\t\tcomp_out='the same'\n    ++\t\t\telse\n    ++\t\t\t\tcomp_out='different'\n    ++\t\t\tfi\n      \t\t\tcat >&4 <<-EOF\n    - \t\t\terror: two revisions point to different objects:\n    +-\t\t\terror: two revisions point to different objects:\n    ++\t\t\terror: two revisions point to $comp_out objects:\n    + \t\t\t  '$1': $r1\n    + \t\t\t  '$2': $r2\n    + \t\t\tEOF\n 3:  0a56980857 =  2:  dfc86a8d9b t5520: improve test style\n 4:  dfa89ba1cb =  3:  a1071038f5 t5520: use sq for test case names\n 5:  9fac3dff83 =  4:  0af3f5027b t5520: let sed open its own input\n 6:  c6ca45eb17 =  5:  b696ff0a67 t5520: replace test -f with test-lib functions\n 7:  830a8212ae =  6:  d2e49fd990 t5520: remove spaces after redirect operator\n 8:  3d982230be =  7:  fcfc3226f8 t5520: use test_line_count where possible\n 9:  2bca4f046d =  8:  86dafc7b54 t5520: replace test -{n,z} with test-lib functions\n10:  1a54db1d5c =  9:  bf9b5023a3 t5520: use test_cmp_rev where possible\n11:  52cf4f0d0f = 10:  bfabf8ceff t5520: test single-line files by git with test_cmp\n12:  0cfabb201c = 11:  56bcbf3047 t5520: don't put git in upstream of pipe\n13:  b2d0ce21c8 = 12:  e9d50b8bb0 t5520: replace subshell cat comparison with test_cmp\n14:  5aac40a029 = 13:  9db0fc2156 t5520: remove redundant lines in test cases\n15:  2c0d3ac416 = 14:  a721d5f119 t5520: replace `! git` with `test_must_fail git`\n-- \n2.24.0.rc0.197.g0926ab8072\n\n"},{"id":"384582","messageId":"9a96f113e74601dda8f7f300b13dcca19ba3285e.1571739459.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571739459.git.liu.denton@gmail.com","subject":"[PATCH v3 01/14] t: teach test_cmp_rev to accept ! for not-equals","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-22T10:19:54Z","receivedAt":"2019-10-22T10:19:59Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Currently, in the case where we are using test_cmp_rev() to report\nnot-equals, we write `! test_cmp_rev`. However, since test_cmp_rev()\ncontains\n\n\tr1=$(git rev-parse --verify \"$1\") &&\n\tr2=$(git rev-parse --verify \"$2\") &&\n\nIn the case where `git rev-parse` segfaults and dies unexpectedly, the\nfailure will be ignored.\n\nRewrite test_cmp_rev() to optionally accept \"!\" as the first argument to\ndo a not-equals comparison. Rewrite `! test_cmp_rev` to `test_cmp_rev !`\nin all tests to take advantage of this new functionality.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t2400-worktree-add.sh             |  4 ++--\n t/t3400-rebase.sh                   |  2 +-\n t/t3421-rebase-topology-linear.sh   |  6 +++---\n t/t3430-rebase-merges.sh            |  2 +-\n t/t3432-rebase-fast-forward.sh      |  2 +-\n t/t3501-revert-cherry-pick.sh       |  2 +-\n t/t3508-cherry-pick-many-commits.sh |  2 +-\n t/test-lib-functions.sh             | 22 +++++++++++++++++++---\n 8 files changed, 29 insertions(+), 13 deletions(-)\n\ndiff --git a/t/t2400-worktree-add.sh b/t/t2400-worktree-add.sh\nindex e819ba741e..52d476979b 100755\n--- a/t/t2400-worktree-add.sh\n+++ b/t/t2400-worktree-add.sh\n@@ -438,7 +438,7 @@ test_expect_success 'git worktree add does not match remote' '\n \t\tcd foo &&\n \t\ttest_must_fail git config \"branch.foo.remote\" &&\n \t\ttest_must_fail git config \"branch.foo.merge\" &&\n-\t\t! test_cmp_rev refs/remotes/repo_a/foo refs/heads/foo\n+\t\ttest_cmp_rev ! refs/remotes/repo_a/foo refs/heads/foo\n \t)\n '\n \n@@ -483,7 +483,7 @@ test_expect_success 'git worktree --no-guess-remote option overrides config' '\n \t\tcd foo &&\n \t\ttest_must_fail git config \"branch.foo.remote\" &&\n \t\ttest_must_fail git config \"branch.foo.merge\" &&\n-\t\t! test_cmp_rev refs/remotes/repo_a/foo refs/heads/foo\n+\t\ttest_cmp_rev ! refs/remotes/repo_a/foo refs/heads/foo\n \t)\n '\n \ndiff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh\nindex ab18ac5f28..f267f6cd54 100755\n--- a/t/t3400-rebase.sh\n+++ b/t/t3400-rebase.sh\n@@ -64,7 +64,7 @@ test_expect_success 'rebase sets ORIG_HEAD to pre-rebase state' '\n \tpre=\"$(git rev-parse --verify HEAD)\" &&\n \tgit rebase master &&\n \ttest_cmp_rev \"$pre\" ORIG_HEAD &&\n-\t! test_cmp_rev \"$pre\" HEAD\n+\ttest_cmp_rev ! \"$pre\" HEAD\n '\n \n test_expect_success 'rebase, with <onto> and <upstream> specified as :/quuxery' '\ndiff --git a/t/t3421-rebase-topology-linear.sh b/t/t3421-rebase-topology-linear.sh\nindex b847064f91..325072b0a3 100755\n--- a/t/t3421-rebase-topology-linear.sh\n+++ b/t/t3421-rebase-topology-linear.sh\n@@ -61,7 +61,7 @@ test_run_rebase () {\n \ttest_expect_$result \"rebase $* -f rewrites even if upstream is an ancestor\" \"\n \t\treset_rebase &&\n \t\tgit rebase $* -f b e &&\n-\t\t! test_cmp_rev e HEAD &&\n+\t\ttest_cmp_rev ! e HEAD &&\n \t\ttest_cmp_rev b HEAD~2 &&\n \t\ttest_linear_range 'd e' b..\n \t\"\n@@ -78,7 +78,7 @@ test_run_rebase () {\n \ttest_expect_$result \"rebase $* -f rewrites even if remote upstream is an ancestor\" \"\n \t\treset_rebase &&\n \t\tgit rebase $* -f branch-b branch-e &&\n-\t\t! test_cmp_rev branch-e origin/branch-e &&\n+\t\ttest_cmp_rev ! branch-e origin/branch-e &&\n \t\ttest_cmp_rev branch-b HEAD~2 &&\n \t\ttest_linear_range 'd e' branch-b..\n \t\"\n@@ -368,7 +368,7 @@ test_run_rebase () {\n \ttest_expect_$result \"rebase $* -f --root on linear history causes re-write\" \"\n \t\treset_rebase &&\n \t\tgit rebase $* -f --root c &&\n-\t\t! test_cmp_rev a HEAD~2 &&\n+\t\ttest_cmp_rev ! a HEAD~2 &&\n \t\ttest_linear_range 'a b c' HEAD\n \t\"\n }\ndiff --git a/t/t3430-rebase-merges.sh b/t/t3430-rebase-merges.sh\nindex 9efcf4808a..abbdc26b1b 100755\n--- a/t/t3430-rebase-merges.sh\n+++ b/t/t3430-rebase-merges.sh\n@@ -346,7 +346,7 @@ test_expect_success 'A root commit can be a cousin, treat it that way' '\n \tgit merge --allow-unrelated-histories khnum &&\n \ttest_tick &&\n \tgit rebase -f -r HEAD^ &&\n-\t! test_cmp_rev HEAD^2 khnum &&\n+\ttest_cmp_rev ! HEAD^2 khnum &&\n \ttest_cmp_graph HEAD^.. <<-\\EOF &&\n \t*   Merge branch '\\''khnum'\\'' into asherah\n \t|\\\ndiff --git a/t/t3432-rebase-fast-forward.sh b/t/t3432-rebase-fast-forward.sh\nindex 034ffc7e76..92f95b57da 100755\n--- a/t/t3432-rebase-fast-forward.sh\n+++ b/t/t3432-rebase-fast-forward.sh\n@@ -64,7 +64,7 @@ test_rebase_same_head_ () {\n \t\t\ttest_cmp_rev \\$oldhead \\$newhead\n \t\telif test $cmp = diff\n \t\tthen\n-\t\t\t! test_cmp_rev \\$oldhead \\$newhead\n+\t\t\ttest_cmp_rev ! \\$oldhead \\$newhead\n \t\tfi\n \t\"\n }\ndiff --git a/t/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh\nindex d1c68af8c5..1c51a9131d 100755\n--- a/t/t3501-revert-cherry-pick.sh\n+++ b/t/t3501-revert-cherry-pick.sh\n@@ -106,7 +106,7 @@ test_expect_success 'cherry-pick on unborn branch' '\n \trm -rf * &&\n \tgit cherry-pick initial &&\n \tgit diff --quiet initial &&\n-\t! test_cmp_rev initial HEAD\n+\ttest_cmp_rev ! initial HEAD\n '\n \n test_expect_success 'cherry-pick \"-\" to pick from previous branch' '\ndiff --git a/t/t3508-cherry-pick-many-commits.sh b/t/t3508-cherry-pick-many-commits.sh\nindex b457333e18..23070a7b73 100755\n--- a/t/t3508-cherry-pick-many-commits.sh\n+++ b/t/t3508-cherry-pick-many-commits.sh\n@@ -5,7 +5,7 @@ test_description='test cherry-picking many commits'\n . ./test-lib.sh\n \n check_head_differs_from() {\n-\t! test_cmp_rev HEAD \"$1\"\n+\ttest_cmp_rev ! HEAD \"$1\"\n }\n \n check_head_equals() {\ndiff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh\nindex b299ecc326..064131ac39 100644\n--- a/t/test-lib-functions.sh\n+++ b/t/test-lib-functions.sh\n@@ -1012,8 +1012,17 @@ test_must_be_empty () {\n \tfi\n }\n \n-# Tests that its two parameters refer to the same revision\n+# Tests that its two parameters refer to the same revision, or if '!' is\n+# provided first, that its other two parameters refer to different\n+# revisions.\n test_cmp_rev () {\n+\tlocal inverted_op\n+\tinverted_op='!='\n+\tif test $# -ge 1 && test \"x$1\" = 'x!'\n+\tthen\n+\t    inverted_op='='\n+\t    shift\n+\tfi\n \tif test $# != 2\n \tthen\n \t\terror \"bug in the test script: test_cmp_rev requires two revisions, but got $#\"\n@@ -1021,10 +1030,17 @@ test_cmp_rev () {\n \t\tlocal r1 r2\n \t\tr1=$(git rev-parse --verify \"$1\") &&\n \t\tr2=$(git rev-parse --verify \"$2\") &&\n-\t\tif test \"$r1\" != \"$r2\"\n+\t\tif test \"$r1\" \"$inverted_op\" \"$r2\"\n \t\tthen\n+\t\t\tlocal comp_out\n+\t\t\tif \"x$inverted_op\" = 'x='\n+\t\t\tthen\n+\t\t\t\tcomp_out='the same'\n+\t\t\telse\n+\t\t\t\tcomp_out='different'\n+\t\t\tfi\n \t\t\tcat >&4 <<-EOF\n-\t\t\terror: two revisions point to different objects:\n+\t\t\terror: two revisions point to $comp_out objects:\n \t\t\t  '$1': $r1\n \t\t\t  '$2': $r2\n \t\t\tEOF\n-- \n2.24.0.rc0.197.g0926ab8072\n\n"},{"id":"384583","messageId":"dfc86a8d9bd40ac2bf7e98852a4dad53716d3fb6.1571739459.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571739459.git.liu.denton@gmail.com","subject":"[PATCH v3 02/14] t5520: improve test style","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-22T10:19:57Z","receivedAt":"2019-10-22T10:20:02Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Improve the test style by removing leading and trailing empty lines\nwithin test cases. Also, reformat multi-line subshells to conform to the\nexisting style.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 88 +++++++++++++++++++++++++------------------------\n 1 file changed, 45 insertions(+), 43 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex cf4cc32fd0..51d6ce8aec 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -538,7 +538,6 @@ test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-m\n '\n \n test_expect_success '--rebase with rebased upstream' '\n-\n \tgit remote add -f me . &&\n \tgit checkout copy &&\n \tgit tag copy-orig &&\n@@ -552,7 +551,6 @@ test_expect_success '--rebase with rebased upstream' '\n \tgit pull --rebase me copy &&\n \ttest \"conflicting modification\" = \"$(cat file)\" &&\n \ttest file = \"$(cat file2)\"\n-\n '\n \n test_expect_success '--rebase -f with rebased upstream' '\n@@ -564,14 +562,12 @@ test_expect_success '--rebase -f with rebased upstream' '\n '\n \n test_expect_success '--rebase with rebased default upstream' '\n-\n \tgit update-ref refs/remotes/me/copy copy-orig &&\n \tgit checkout --track -b to-rebase2 me/copy &&\n \tgit reset --hard to-rebase-orig &&\n \tgit pull --rebase &&\n \ttest \"conflicting modification\" = \"$(cat file)\" &&\n \ttest file = \"$(cat file2)\"\n-\n '\n \n test_expect_success 'rebased upstream + fetch + pull --rebase' '\n@@ -588,7 +584,6 @@ test_expect_success 'rebased upstream + fetch + pull --rebase' '\n '\n \n test_expect_success 'pull --rebase dies early with dirty working directory' '\n-\n \tgit checkout to-rebase &&\n \tgit update-ref refs/remotes/me/copy copy^ &&\n \tCOPY=\"$(git rev-parse --verify me/copy)\" &&\n@@ -603,16 +598,16 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '\n \tgit checkout HEAD -- file &&\n \tgit pull &&\n \ttest \"$COPY\" != \"$(git rev-parse --verify me/copy)\"\n-\n '\n \n test_expect_success 'pull --rebase works on branch yet to be born' '\n \tgit rev-parse master >expect &&\n \tmkdir empty_repo &&\n-\t(cd empty_repo &&\n-\t git init &&\n-\t git pull --rebase .. master &&\n-\t git rev-parse HEAD >../actual\n+\t(\n+\t\tcd empty_repo &&\n+\t\tgit init &&\n+\t\tgit pull --rebase .. master &&\n+\t\tgit rev-parse HEAD >../actual\n \t) &&\n \ttest_cmp expect actual\n '\n@@ -646,58 +641,65 @@ test_expect_success 'pull --rebase fails on corrupt HEAD' '\n \n test_expect_success 'setup for detecting upstreamed changes' '\n \tmkdir src &&\n-\t(cd src &&\n-\t git init &&\n-\t printf \"1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n10\\n\" > stuff &&\n-\t git add stuff &&\n-\t git commit -m \"Initial revision\"\n+\t(\n+\t\tcd src &&\n+\t\tgit init &&\n+\t\tprintf \"1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n10\\n\" > stuff &&\n+\t\tgit add stuff &&\n+\t\tgit commit -m \"Initial revision\"\n \t) &&\n \tgit clone src dst &&\n-\t(cd src &&\n-\t modify s/5/43/ stuff &&\n-\t git commit -a -m \"5->43\" &&\n-\t modify s/6/42/ stuff &&\n-\t git commit -a -m \"Make it bigger\"\n+\t(\n+\t\tcd src &&\n+\t\tmodify s/5/43/ stuff &&\n+\t\tgit commit -a -m \"5->43\" &&\n+\t\tmodify s/6/42/ stuff &&\n+\t\tgit commit -a -m \"Make it bigger\"\n \t) &&\n-\t(cd dst &&\n-\t modify s/5/43/ stuff &&\n-\t git commit -a -m \"Independent discovery of 5->43\"\n+\t(\n+\t\tcd dst &&\n+\t\tmodify s/5/43/ stuff &&\n+\t\tgit commit -a -m \"Independent discovery of 5->43\"\n \t)\n '\n \n test_expect_success 'git pull --rebase detects upstreamed changes' '\n-\t(cd dst &&\n-\t git pull --rebase &&\n-\t test -z \"$(git ls-files -u)\"\n+\t(\n+\t\tcd dst &&\n+\t\tgit pull --rebase &&\n+\t\ttest -z \"$(git ls-files -u)\"\n \t)\n '\n \n test_expect_success 'setup for avoiding reapplying old patches' '\n-\t(cd dst &&\n-\t test_might_fail git rebase --abort &&\n-\t git reset --hard origin/master\n+\t(\n+\t\tcd dst &&\n+\t\ttest_might_fail git rebase --abort &&\n+\t\tgit reset --hard origin/master\n \t) &&\n \tgit clone --bare src src-replace.git &&\n \trm -rf src &&\n \tmv src-replace.git src &&\n-\t(cd dst &&\n-\t modify s/2/22/ stuff &&\n-\t git commit -a -m \"Change 2\" &&\n-\t modify s/3/33/ stuff &&\n-\t git commit -a -m \"Change 3\" &&\n-\t modify s/4/44/ stuff &&\n-\t git commit -a -m \"Change 4\" &&\n-\t git push &&\n-\n-\t modify s/44/55/ stuff &&\n-\t git commit --amend -a -m \"Modified Change 4\"\n+\t(\n+\t\tcd dst &&\n+\t\tmodify s/2/22/ stuff &&\n+\t\tgit commit -a -m \"Change 2\" &&\n+\t\tmodify s/3/33/ stuff &&\n+\t\tgit commit -a -m \"Change 3\" &&\n+\t\tmodify s/4/44/ stuff &&\n+\t\tgit commit -a -m \"Change 4\" &&\n+\t\tgit push &&\n+\n+\t\tmodify s/44/55/ stuff &&\n+\t\tgit commit --amend -a -m \"Modified Change 4\"\n \t)\n '\n \n test_expect_success 'git pull --rebase does not reapply old patches' '\n-\t(cd dst &&\n-\t test_must_fail git pull --rebase &&\n-\t test 1 = $(find .git/rebase-apply -name \"000*\" | wc -l)\n+\t(\n+\t\tcd dst &&\n+\t\ttest_must_fail git pull --rebase &&\n+\t\ttest 1 = $(find .git/rebase-apply -name \"000*\" | wc -l)\n \t)\n '\n \n-- \n2.24.0.rc0.197.g0926ab8072\n\n"},{"id":"384584","messageId":"a1071038f5c68d3b51a9d71d44bfeed369c5b610.1571739459.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571739459.git.liu.denton@gmail.com","subject":"[PATCH v3 03/14] t5520: use sq for test case names","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-22T10:19:59Z","receivedAt":"2019-10-22T10:20:06Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"The usual convention is for test case names to be written between\nsingle-quotes. Change all double-quoted test case names to single-quotes\nexcept for two test case names that use variables within.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 51d6ce8aec..a3de2e19b6 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -408,7 +408,7 @@ test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n \ttest new = \"$(git show HEAD:file2)\"\n '\n \n-test_expect_success \"pull --rebase warns on --verify-signatures\" '\n+test_expect_success 'pull --rebase warns on --verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --verify-signatures . copy 2>err &&\n \ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n@@ -416,7 +416,7 @@ test_expect_success \"pull --rebase warns on --verify-signatures\" '\n \ttest_i18ngrep \"ignoring --verify-signatures for rebase\" err\n '\n \n-test_expect_success \"pull --rebase does not warn on --no-verify-signatures\" '\n+test_expect_success 'pull --rebase does not warn on --no-verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --no-verify-signatures . copy 2>err &&\n \ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n-- \n2.24.0.rc0.197.g0926ab8072\n\n"},{"id":"384585","messageId":"0af3f5027ba9aa68da631afd21b32b534cc80cfa.1571739459.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571739459.git.liu.denton@gmail.com","subject":"[PATCH v3 04/14] t5520: let sed open its own input","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-22T10:20:02Z","receivedAt":"2019-10-22T10:20:06Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"We were using a redirection operator to feed input into sed. However,\nsince sed is capable of opening its own files, make sed open its own\nfiles instead of redirecting input into it.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex a3de2e19b6..55560ce3cd 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -5,7 +5,7 @@ test_description='pulling into void'\n . ./test-lib.sh\n \n modify () {\n-\tsed -e \"$1\" <\"$2\" >\"$2.x\" &&\n+\tsed -e \"$1\" \"$2\" >\"$2.x\" &&\n \tmv \"$2.x\" \"$2\"\n }\n \n-- \n2.24.0.rc0.197.g0926ab8072\n\n"},{"id":"384586","messageId":"b696ff0a67024749b458902ed15f44cfaa4a68bf.1571739459.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571739459.git.liu.denton@gmail.com","subject":"[PATCH v3 05/14] t5520: replace test -f with test-lib functions","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-22T10:20:05Z","receivedAt":"2019-10-22T10:20:10Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Although `test -f` has the same functionality as test_path_is_file(), in\nthe case where test_path_is_file() fails, we get much better debugging\ninformation.\n\nReplace `test -f` with test_path_is_file() so that future developers\nwill have a better experience debugging these test cases.\n\nAlso, in the case of `! test -f`, not only should that path not be a\nfile, it shouldn't exist at all so replace it with\ntest_path_is_missing().\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 55560ce3cd..004d5884cd 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -39,8 +39,8 @@ test_expect_success 'pulling into void' '\n \t\tcd cloned &&\n \t\tgit pull ..\n \t) &&\n-\ttest -f file &&\n-\ttest -f cloned/file &&\n+\ttest_path_is_file file &&\n+\ttest_path_is_file cloned/file &&\n \ttest_cmp file cloned/file\n '\n \n@@ -50,8 +50,8 @@ test_expect_success 'pulling into void using master:master' '\n \t\tcd cloned-uho &&\n \t\tgit pull .. master:master\n \t) &&\n-\ttest -f file &&\n-\ttest -f cloned-uho/file &&\n+\ttest_path_is_file file &&\n+\ttest_path_is_file cloned-uho/file &&\n \ttest_cmp file cloned-uho/file\n '\n \n@@ -99,7 +99,7 @@ test_expect_success 'pulling into void must not create an octopus' '\n \t(\n \t\tcd cloned-octopus &&\n \t\ttest_must_fail git pull .. master master &&\n-\t\t! test -f file\n+\t\ttest_path_is_missing file\n \t)\n '\n \n-- \n2.24.0.rc0.197.g0926ab8072\n\n"},{"id":"384587","messageId":"d2e49fd990dbed171737786fb345a93dc99be094.1571739459.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571739459.git.liu.denton@gmail.com","subject":"[PATCH v3 06/14] t5520: remove spaces after redirect operator","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-22T10:20:07Z","receivedAt":"2019-10-22T10:20:13Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"The style for tests in Git is to have the redirect operator attached to\nthe filename with no spaces. Fix test cases where this is not the case.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 004d5884cd..7bb9031140 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -243,10 +243,10 @@ test_expect_success 'fast-forward fails with conflicting work tree' '\n \n test_expect_success '--rebase' '\n \tgit branch to-rebase &&\n-\techo modified again > file &&\n+\techo modified again >file &&\n \tgit commit -m file file &&\n \tgit checkout to-rebase &&\n-\techo new > file2 &&\n+\techo new >file2 &&\n \tgit add file2 &&\n \tgit commit -m \"new file\" &&\n \tgit tag before-rebase &&\n@@ -542,10 +542,10 @@ test_expect_success '--rebase with rebased upstream' '\n \tgit checkout copy &&\n \tgit tag copy-orig &&\n \tgit reset --hard HEAD^ &&\n-\techo conflicting modification > file &&\n+\techo conflicting modification >file &&\n \tgit commit -m conflict file &&\n \tgit checkout to-rebase &&\n-\techo file > file2 &&\n+\techo file >file2 &&\n \tgit commit -m to-rebase file2 &&\n \tgit tag to-rebase-orig &&\n \tgit pull --rebase me copy &&\n@@ -591,7 +591,7 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '\n \ttest_config branch.to-rebase.remote me &&\n \ttest_config branch.to-rebase.merge refs/heads/copy &&\n \ttest_config branch.to-rebase.rebase true &&\n-\techo dirty >> file &&\n+\techo dirty >>file &&\n \tgit add file &&\n \ttest_must_fail git pull &&\n \ttest \"$COPY\" = \"$(git rev-parse --verify me/copy)\" &&\n-- \n2.24.0.rc0.197.g0926ab8072\n\n"},{"id":"384588","messageId":"fcfc3226f8015e07ce539645b7f2f72b201b58d3.1571739459.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571739459.git.liu.denton@gmail.com","subject":"[PATCH v3 07/14] t5520: use test_line_count where possible","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-22T10:20:10Z","receivedAt":"2019-10-22T10:20:15Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Instead of rolling our own functionality to test the number of lines a\ncommand outputs, use test_line_count() which provides better debugging\ninformation in the case of a failure.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 7bb9031140..0ca4867e96 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -699,7 +699,8 @@ test_expect_success 'git pull --rebase does not reapply old patches' '\n \t(\n \t\tcd dst &&\n \t\ttest_must_fail git pull --rebase &&\n-\t\ttest 1 = $(find .git/rebase-apply -name \"000*\" | wc -l)\n+\t\tfind .git/rebase-apply -name \"000*\" >patches &&\n+\t\ttest_line_count = 1 patches\n \t)\n '\n \n-- \n2.24.0.rc0.197.g0926ab8072\n\n"},{"id":"384589","messageId":"86dafc7b54ddc9f3323d9f8d29edc89cb33c5dac.1571739459.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571739459.git.liu.denton@gmail.com","subject":"[PATCH v3 08/14] t5520: replace test -{n,z} with test-lib functions","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-22T10:20:13Z","receivedAt":"2019-10-22T10:20:18Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"When wrapping a Git command in a subshell within another command, we\nthrow away the Git command's exit code. In case the Git command fails,\nwe would like to know about it rather than the failure being silent.\nExtract Git commands so that their exit codes are not lost.\n\nInstead of using `test -n` or `test -z`, replace them respectively with\ninvocations of test_file_not_empty() and test_must_be_empty() so that we\nget better debugging information in the case of a failure.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 12 ++++++++----\n 1 file changed, 8 insertions(+), 4 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 0ca4867e96..18225d8430 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -206,15 +206,18 @@ test_expect_success 'fail if the index has unresolved entries' '\n \ttest_when_finished \"git checkout -f copy && git branch -D third\" &&\n \ttest \"$(cat file)\" = file &&\n \ttest_commit modified2 file &&\n-\ttest -z \"$(git ls-files -u)\" &&\n+\tgit ls-files -u >unmerged &&\n+\ttest_must_be_empty unmerged &&\n \ttest_must_fail git pull . second &&\n-\ttest -n \"$(git ls-files -u)\" &&\n+\tgit ls-files -u >unmerged &&\n+\ttest_file_not_empty unmerged &&\n \tcp file expected &&\n \ttest_must_fail git pull . second 2>err &&\n \ttest_i18ngrep \"Pulling is not possible because you have unmerged files.\" err &&\n \ttest_cmp expected file &&\n \tgit add file &&\n-\ttest -z \"$(git ls-files -u)\" &&\n+\tgit ls-files -u >unmerged &&\n+\ttest_must_be_empty unmerged &&\n \ttest_must_fail git pull . second 2>err &&\n \ttest_i18ngrep \"You have not concluded your merge\" err &&\n \ttest_cmp expected file\n@@ -667,7 +670,8 @@ test_expect_success 'git pull --rebase detects upstreamed changes' '\n \t(\n \t\tcd dst &&\n \t\tgit pull --rebase &&\n-\t\ttest -z \"$(git ls-files -u)\"\n+\t\tgit ls-files -u >untracked &&\n+\t\ttest_must_be_empty untracked\n \t)\n '\n \n-- \n2.24.0.rc0.197.g0926ab8072\n\n"},{"id":"384590","messageId":"bf9b5023a35a2054fc77174415a1a2240058bf5c.1571739459.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571739459.git.liu.denton@gmail.com","subject":"[PATCH v3 09/14] t5520: use test_cmp_rev where possible","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-22T10:20:16Z","receivedAt":"2019-10-22T10:20:21Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"In case an invocation of `git rev-list` fails within the subshell, the\nfailure will be masked. Remove the subshell and use test_cmp_rev() so\nthat failures can be discovered.\n\nThis change was done with the following sed expressions:\n\n\ts/test \"$(git rev-parse.* \\([^)]*\\))\" = \"$(git rev-parse \\([^)]*\\))\"/test_cmp_rev \\1 \\2/\n\ts/test \\([^ ]*\\) = \"$(git rev-parse.* \\([^)]*\\))\"/test_cmp_rev \\1 \\2/\n\ts/test \"$(git rev-parse.* \\([^)]*\\))\" != \"$(git rev-parse.* \\([^)]*\\))\"/test_cmp_rev ! \\1 \\2/\n\ts/test \\([^ ]*\\) != \"$(git rev-parse.* \\([^)]*\\))\"/test_cmp_rev ! \\1 \\2/\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 50 ++++++++++++++++++++++++-------------------------\n 1 file changed, 25 insertions(+), 25 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 18225d8430..1af6ea06ee 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -230,7 +230,7 @@ test_expect_success 'fast-forwards working tree if branch head is updated' '\n \tgit pull . second:third 2>err &&\n \ttest_i18ngrep \"fetch updated the current branch head\" err &&\n \ttest \"$(cat file)\" = modified &&\n-\ttest \"$(git rev-parse third)\" = \"$(git rev-parse second)\"\n+\ttest_cmp_rev third second\n '\n \n test_expect_success 'fast-forward fails with conflicting work tree' '\n@@ -241,7 +241,7 @@ test_expect_success 'fast-forward fails with conflicting work tree' '\n \ttest_must_fail git pull . second:third 2>err &&\n \ttest_i18ngrep \"Cannot fast-forward your working tree\" err &&\n \ttest \"$(cat file)\" = conflict &&\n-\ttest \"$(git rev-parse third)\" = \"$(git rev-parse second)\"\n+\ttest_cmp_rev third second\n '\n \n test_expect_success '--rebase' '\n@@ -254,7 +254,7 @@ test_expect_success '--rebase' '\n \tgit commit -m \"new file\" &&\n \tgit tag before-rebase &&\n \tgit pull --rebase . copy &&\n-\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\"\n '\n \n@@ -266,7 +266,7 @@ test_expect_success '--rebase fast forward' '\n \n \tgit checkout to-rebase &&\n \tgit pull --rebase . ff &&\n-\ttest \"$(git rev-parse HEAD)\" = \"$(git rev-parse ff)\" &&\n+\ttest_cmp_rev HEAD ff &&\n \n \t# The above only validates the result.  Did we actually bypass rebase?\n \tgit reflog -1 >reflog.actual &&\n@@ -290,7 +290,7 @@ test_expect_success '--rebase --autostash fast forward' '\n \tgit checkout behind &&\n \techo dirty >file &&\n \tgit pull --rebase --autostash . to-rebase-ff &&\n-\ttest \"$(git rev-parse HEAD)\" = \"$(git rev-parse to-rebase-ff)\"\n+\ttest_cmp_rev HEAD to-rebase-ff\n '\n \n test_expect_success '--rebase with conflicts shows advice' '\n@@ -328,7 +328,7 @@ test_expect_success 'failed --rebase shows advice' '\n test_expect_success '--rebase fails with multiple branches' '\n \tgit reset --hard before-rebase &&\n \ttest_must_fail git pull --rebase . copy master 2>err &&\n-\ttest \"$(git rev-parse HEAD)\" = \"$(git rev-parse before-rebase)\" &&\n+\ttest_cmp_rev HEAD before-rebase &&\n \ttest_i18ngrep \"Cannot rebase onto multiple branches\" err &&\n \ttest modified = \"$(git show HEAD:file)\"\n '\n@@ -380,7 +380,7 @@ test_expect_success 'pull.rebase' '\n \tgit reset --hard before-rebase &&\n \ttest_config pull.rebase true &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\"\n '\n \n@@ -398,7 +398,7 @@ test_expect_success 'branch.to-rebase.rebase' '\n \tgit reset --hard before-rebase &&\n \ttest_config branch.to-rebase.rebase true &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\"\n '\n \n@@ -407,14 +407,14 @@ test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n \ttest_config pull.rebase true &&\n \ttest_config branch.to-rebase.rebase false &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^)\" != \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev ! HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\"\n '\n \n test_expect_success 'pull --rebase warns on --verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --verify-signatures . copy 2>err &&\n-\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\" &&\n \ttest_i18ngrep \"ignoring --verify-signatures for rebase\" err\n '\n@@ -422,7 +422,7 @@ test_expect_success 'pull --rebase warns on --verify-signatures' '\n test_expect_success 'pull --rebase does not warn on --no-verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --no-verify-signatures . copy 2>err &&\n-\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\" &&\n \ttest_i18ngrep ! \"verify-signatures\" err\n '\n@@ -443,8 +443,8 @@ test_expect_success 'pull.rebase=false create a new merge commit' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase false &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^1)\" = \"$(git rev-parse before-preserve-rebase)\" &&\n-\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^1 before-preserve-rebase &&\n+\ttest_cmp_rev HEAD^2 copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -452,7 +452,7 @@ test_expect_success 'pull.rebase=true flattens keep-merge' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase true &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^^ copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -460,7 +460,7 @@ test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase 1 &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^^ copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -469,8 +469,8 @@ test_expect_success REBASE_P \\\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase preserve &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n-\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse keep-merge)\"\n+\ttest_cmp_rev HEAD^^ copy &&\n+\ttest_cmp_rev HEAD^2 keep-merge\n '\n \n test_expect_success 'pull.rebase=interactive' '\n@@ -505,8 +505,8 @@ test_expect_success '--rebase=false create a new merge commit' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase true &&\n \tgit pull --rebase=false . copy &&\n-\ttest \"$(git rev-parse HEAD^1)\" = \"$(git rev-parse before-preserve-rebase)\" &&\n-\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^1 before-preserve-rebase &&\n+\ttest_cmp_rev HEAD^2 copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -514,7 +514,7 @@ test_expect_success '--rebase=true rebases and flattens keep-merge' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase preserve &&\n \tgit pull --rebase=true . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^^ copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -523,8 +523,8 @@ test_expect_success REBASE_P \\\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase true &&\n \tgit pull --rebase=preserve . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n-\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse keep-merge)\"\n+\ttest_cmp_rev HEAD^^ copy &&\n+\ttest_cmp_rev HEAD^2 keep-merge\n '\n \n test_expect_success '--rebase=invalid fails' '\n@@ -536,7 +536,7 @@ test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-m\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase preserve &&\n \tgit pull --rebase . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^^ copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -597,10 +597,10 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '\n \techo dirty >>file &&\n \tgit add file &&\n \ttest_must_fail git pull &&\n-\ttest \"$COPY\" = \"$(git rev-parse --verify me/copy)\" &&\n+\ttest_cmp_rev \"$COPY\" me/copy &&\n \tgit checkout HEAD -- file &&\n \tgit pull &&\n-\ttest \"$COPY\" != \"$(git rev-parse --verify me/copy)\"\n+\ttest_cmp_rev ! \"$COPY\" me/copy\n '\n \n test_expect_success 'pull --rebase works on branch yet to be born' '\n-- \n2.24.0.rc0.197.g0926ab8072\n\n"},{"id":"384591","messageId":"bfabf8ceffd7f6a7f804d3a2d90ca2118bcd8478.1571739459.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571739459.git.liu.denton@gmail.com","subject":"[PATCH v3 10/14] t5520: test single-line files by git with test_cmp","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-22T10:20:18Z","receivedAt":"2019-10-22T10:20:25Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"In case an invocation of a Git command fails within the subshell, the\nfailure will be masked. Replace the subshell with a file-redirection and\na call to test_cmp.\n\nThis change was done with the following GNU sed expressions:\n\n\ts/\\(\\s*\\)test \\([^ ]*\\) = \"$(\\(git [^)]*\\))\"/\\1echo \\2 >expect \\&\\&\\n\\1\\3 >actual \\&\\&\\n\\1test_cmp expect actual/\n\ts/\\(\\s*\\)test \"$(\\(git [^)]*\\))\" = \\([^ ]*\\)/\\1echo \\3 >expect \\&\\&\\n\\1\\2 >actual \\&\\&\\n\\1test_cmp expect actual/\n\nA future patch will clean up situations where we have multiple duplicate\nstatements within a test case. This is done to keep this patch purely\nmechanical.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 64 ++++++++++++++++++++++++++++++++++++-------------\n 1 file changed, 48 insertions(+), 16 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 1af6ea06ee..8b7e7ae55d 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -255,7 +255,9 @@ test_expect_success '--rebase' '\n \tgit tag before-rebase &&\n \tgit pull --rebase . copy &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\"\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success '--rebase fast forward' '\n@@ -330,7 +332,9 @@ test_expect_success '--rebase fails with multiple branches' '\n \ttest_must_fail git pull --rebase . copy master 2>err &&\n \ttest_cmp_rev HEAD before-rebase &&\n \ttest_i18ngrep \"Cannot rebase onto multiple branches\" err &&\n-\ttest modified = \"$(git show HEAD:file)\"\n+\techo modified >expect &&\n+\tgit show HEAD:file >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'pull --rebase succeeds with dirty working directory and rebase.autostash set' '\n@@ -381,7 +385,9 @@ test_expect_success 'pull.rebase' '\n \ttest_config pull.rebase true &&\n \tgit pull . copy &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\"\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'pull --autostash & pull.rebase=true' '\n@@ -399,7 +405,9 @@ test_expect_success 'branch.to-rebase.rebase' '\n \ttest_config branch.to-rebase.rebase true &&\n \tgit pull . copy &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\"\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n@@ -408,14 +416,18 @@ test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n \ttest_config branch.to-rebase.rebase false &&\n \tgit pull . copy &&\n \ttest_cmp_rev ! HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\"\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'pull --rebase warns on --verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --verify-signatures . copy 2>err &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\" &&\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual &&\n \ttest_i18ngrep \"ignoring --verify-signatures for rebase\" err\n '\n \n@@ -423,7 +435,9 @@ test_expect_success 'pull --rebase does not warn on --no-verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --no-verify-signatures . copy 2>err &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\" &&\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual &&\n \ttest_i18ngrep ! \"verify-signatures\" err\n '\n \n@@ -445,7 +459,9 @@ test_expect_success 'pull.rebase=false create a new merge commit' '\n \tgit pull . copy &&\n \ttest_cmp_rev HEAD^1 before-preserve-rebase &&\n \ttest_cmp_rev HEAD^2 copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'pull.rebase=true flattens keep-merge' '\n@@ -453,7 +469,9 @@ test_expect_success 'pull.rebase=true flattens keep-merge' '\n \ttest_config pull.rebase true &&\n \tgit pull . copy &&\n \ttest_cmp_rev HEAD^^ copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' '\n@@ -461,7 +479,9 @@ test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' '\n \ttest_config pull.rebase 1 &&\n \tgit pull . copy &&\n \ttest_cmp_rev HEAD^^ copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success REBASE_P \\\n@@ -507,7 +527,9 @@ test_expect_success '--rebase=false create a new merge commit' '\n \tgit pull --rebase=false . copy &&\n \ttest_cmp_rev HEAD^1 before-preserve-rebase &&\n \ttest_cmp_rev HEAD^2 copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success '--rebase=true rebases and flattens keep-merge' '\n@@ -515,7 +537,9 @@ test_expect_success '--rebase=true rebases and flattens keep-merge' '\n \ttest_config pull.rebase preserve &&\n \tgit pull --rebase=true . copy &&\n \ttest_cmp_rev HEAD^^ copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success REBASE_P \\\n@@ -537,7 +561,9 @@ test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-m\n \ttest_config pull.rebase preserve &&\n \tgit pull --rebase . copy &&\n \ttest_cmp_rev HEAD^^ copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success '--rebase with rebased upstream' '\n@@ -622,10 +648,16 @@ test_expect_success 'pull --rebase fails on unborn branch with staged changes' '\n \t\tcd empty_repo2 &&\n \t\techo staged-file >staged-file &&\n \t\tgit add staged-file &&\n-\t\ttest \"$(git ls-files)\" = staged-file &&\n+\t\techo staged-file >expect &&\n+\t\tgit ls-files >actual &&\n+\t\ttest_cmp expect actual &&\n \t\ttest_must_fail git pull --rebase .. master 2>err &&\n-\t\ttest \"$(git ls-files)\" = staged-file &&\n-\t\ttest \"$(git show :staged-file)\" = staged-file &&\n+\t\techo staged-file >expect &&\n+\t\tgit ls-files >actual &&\n+\t\ttest_cmp expect actual &&\n+\t\techo staged-file >expect &&\n+\t\tgit show :staged-file >actual &&\n+\t\ttest_cmp expect actual &&\n \t\ttest_i18ngrep \"unborn branch with changes added to the index\" err\n \t)\n '\n-- \n2.24.0.rc0.197.g0926ab8072\n\n"},{"id":"384592","messageId":"56bcbf304792676aa4f61b37122467eda0f2a184.1571739459.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571739459.git.liu.denton@gmail.com","subject":"[PATCH v3 11/14] t5520: don't put git in upstream of pipe","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-22T10:20:22Z","receivedAt":"2019-10-22T10:20:27Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Before, if the invocation of git failed, it would be masked by the pipe\nsince only the return code of the last element of a pipe is used.\nRewrite the test to put the Git command on its own line so its return\ncode is not masked.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 8b7e7ae55d..8ddf89e550 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -668,7 +668,8 @@ test_expect_success 'pull --rebase fails on corrupt HEAD' '\n \t(\n \t\tcd corrupt &&\n \t\ttest_commit one &&\n-\t\tobj=$(git rev-parse --verify HEAD | sed \"s#^..#&/#\") &&\n+\t\tgit rev-parse --verify HEAD >head &&\n+\t\tobj=$(sed \"s#^..#&/#\" head) &&\n \t\trm -f .git/objects/$obj &&\n \t\ttest_must_fail git pull --rebase\n \t)\n-- \n2.24.0.rc0.197.g0926ab8072\n\n"},{"id":"384593","messageId":"e9d50b8bb07ad3522e1b84e77d149785a6a5fa92.1571739459.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571739459.git.liu.denton@gmail.com","subject":"[PATCH v3 12/14] t5520: replace subshell cat comparison with test_cmp","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-22T10:20:24Z","receivedAt":"2019-10-22T10:20:29Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"We currently have many instances of `test <line> = $(cat <file>)` and\n`test $(cat <file>) = <line>`.  In the case where this fails, it will be\ndifficult for a developer to debug since the output will be masked.\nReplace these instances with invocations of test_cmp().\n\nThis change was done with the following GNU sed expressions:\n\n\ts/\\(\\s*\\)test \\([^=]*\\)= \"$(cat \\([^)]*\\))\"/\\1echo \\2>expect \\&\\&\\n\\1test_cmp expect \\3/\n\ts/\\(\\s*\\)test \"$(cat \\([^)]*\\))\" = \\([^&]*\\)\\( &&\\)\\?$/\\1echo \\3 >expect \\&\\&\\n\\1test_cmp expect \\2\\4/\n\nA future patch will clean up situations where we have multiple duplicate\nstatements within a test case. This is done to keep this patch purely\nmechanical.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 105 ++++++++++++++++++++++++++++++++----------------\n 1 file changed, 70 insertions(+), 35 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 8ddf89e550..c9e4eec004 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -15,8 +15,10 @@ test_pull_autostash () {\n \tgit add new_file &&\n \tgit pull \"$@\" . copy &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest \"$(cat new_file)\" = dirty &&\n-\ttest \"$(cat file)\" = \"modified again\"\n+\techo dirty >expect &&\n+\ttest_cmp expect new_file &&\n+\techo \"modified again\" >expect &&\n+\ttest_cmp expect file\n }\n \n test_pull_autostash_fail () {\n@@ -110,9 +112,11 @@ test_expect_success 'test . as a remote' '\n \techo updated >file &&\n \tgit commit -a -m updated &&\n \tgit checkout copy &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \tgit pull &&\n-\ttest \"$(cat file)\" = updated &&\n+\techo updated >expect &&\n+\ttest_cmp expect file &&\n \tgit reflog -1 >reflog.actual &&\n \tsed \"s/^[0-9a-f][0-9a-f]*/OBJID/\" reflog.actual >reflog.fuzzy &&\n \techo \"OBJID HEAD@{0}: pull: Fast-forward\" >reflog.expected &&\n@@ -125,9 +129,11 @@ test_expect_success 'the default remote . should not break explicit pull' '\n \tgit commit -a -m modified &&\n \tgit checkout copy &&\n \tgit reset --hard HEAD^ &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \tgit pull . second &&\n-\ttest \"$(cat file)\" = modified &&\n+\techo modified >expect &&\n+\ttest_cmp expect file &&\n \tgit reflog -1 >reflog.actual &&\n \tsed \"s/^[0-9a-f][0-9a-f]*/OBJID/\" reflog.actual >reflog.fuzzy &&\n \techo \"OBJID HEAD@{0}: pull . second: Fast-forward\" >reflog.expected &&\n@@ -137,10 +143,12 @@ test_expect_success 'the default remote . should not break explicit pull' '\n test_expect_success 'fail if wildcard spec does not match any refs' '\n \tgit checkout -b test copy^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_must_fail git pull . \"refs/nonexisting1/*:refs/nonexisting2/*\" 2>err &&\n \ttest_i18ngrep \"no candidates for merging\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'fail if no branches specified with non-default remote' '\n@@ -148,11 +156,13 @@ test_expect_success 'fail if no branches specified with non-default remote' '\n \ttest_when_finished \"git remote remove test_remote\" &&\n \tgit checkout -b test copy^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_config branch.test.remote origin &&\n \ttest_must_fail git pull test_remote 2>err &&\n \ttest_i18ngrep \"specify a branch on the command line\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'fail if not on a branch' '\n@@ -160,10 +170,12 @@ test_expect_success 'fail if not on a branch' '\n \ttest_when_finished \"git remote remove origin\" &&\n \tgit checkout HEAD^ &&\n \ttest_when_finished \"git checkout -f copy\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"not currently on a branch\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'fail if no configuration for current branch' '\n@@ -172,10 +184,12 @@ test_expect_success 'fail if no configuration for current branch' '\n \tgit checkout -b test copy^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n \ttest_config branch.test.remote test_remote &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"no tracking information\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'pull --all: fail if no configuration for current branch' '\n@@ -184,10 +198,12 @@ test_expect_success 'pull --all: fail if no configuration for current branch' '\n \tgit checkout -b test copy^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n \ttest_config branch.test.remote test_remote &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_must_fail git pull --all 2>err &&\n \ttest_i18ngrep \"There is no tracking information\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'fail if upstream branch does not exist' '\n@@ -195,16 +211,19 @@ test_expect_success 'fail if upstream branch does not exist' '\n \ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n \ttest_config branch.test.remote . &&\n \ttest_config branch.test.merge refs/heads/nonexisting &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"no such ref was fetched\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'fail if the index has unresolved entries' '\n \tgit checkout -b third second^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D third\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_commit modified2 file &&\n \tgit ls-files -u >unmerged &&\n \ttest_must_be_empty unmerged &&\n@@ -226,21 +245,25 @@ test_expect_success 'fail if the index has unresolved entries' '\n test_expect_success 'fast-forwards working tree if branch head is updated' '\n \tgit checkout -b third second^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D third\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \tgit pull . second:third 2>err &&\n \ttest_i18ngrep \"fetch updated the current branch head\" err &&\n-\ttest \"$(cat file)\" = modified &&\n+\techo modified >expect &&\n+\ttest_cmp expect file &&\n \ttest_cmp_rev third second\n '\n \n test_expect_success 'fast-forward fails with conflicting work tree' '\n \tgit checkout -b third second^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D third\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \techo conflict >file &&\n \ttest_must_fail git pull . second:third 2>err &&\n \ttest_i18ngrep \"Cannot fast-forward your working tree\" err &&\n-\ttest \"$(cat file)\" = conflict &&\n+\techo conflict >expect &&\n+\ttest_cmp expect file &&\n \ttest_cmp_rev third second\n '\n \n@@ -501,7 +524,8 @@ test_expect_success 'pull.rebase=interactive' '\n \ttest_set_editor \"$TRASH_DIRECTORY/fake-editor\" &&\n \ttest_when_finished \"test_might_fail git rebase --abort\" &&\n \ttest_must_fail git pull --rebase=interactive . copy &&\n-\ttest \"I was here\" = \"$(cat fake.out)\"\n+\techo \"I was here\" >expect &&\n+\ttest_cmp expect fake.out\n '\n \n test_expect_success 'pull --rebase=i' '\n@@ -512,7 +536,8 @@ test_expect_success 'pull --rebase=i' '\n \ttest_set_editor \"$TRASH_DIRECTORY/fake-editor\" &&\n \ttest_when_finished \"test_might_fail git rebase --abort\" &&\n \ttest_must_fail git pull --rebase=i . copy &&\n-\ttest \"I was here, too\" = \"$(cat fake.out)\"\n+\techo \"I was here, too\" >expect &&\n+\ttest_cmp expect fake.out\n '\n \n test_expect_success 'pull.rebase=invalid fails' '\n@@ -578,16 +603,20 @@ test_expect_success '--rebase with rebased upstream' '\n \tgit commit -m to-rebase file2 &&\n \tgit tag to-rebase-orig &&\n \tgit pull --rebase me copy &&\n-\ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = \"$(cat file2)\"\n+\techo \"conflicting modification\" >expect &&\n+\ttest_cmp expect file &&\n+\techo file >expect &&\n+\ttest_cmp expect file2\n '\n \n test_expect_success '--rebase -f with rebased upstream' '\n \ttest_when_finished \"test_might_fail git rebase --abort\" &&\n \tgit reset --hard to-rebase-orig &&\n \tgit pull --rebase -f me copy &&\n-\ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = \"$(cat file2)\"\n+\techo \"conflicting modification\" >expect &&\n+\ttest_cmp expect file &&\n+\techo file >expect &&\n+\ttest_cmp expect file2\n '\n \n test_expect_success '--rebase with rebased default upstream' '\n@@ -595,8 +624,10 @@ test_expect_success '--rebase with rebased default upstream' '\n \tgit checkout --track -b to-rebase2 me/copy &&\n \tgit reset --hard to-rebase-orig &&\n \tgit pull --rebase &&\n-\ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = \"$(cat file2)\"\n+\techo \"conflicting modification\" >expect &&\n+\ttest_cmp expect file &&\n+\techo file >expect &&\n+\ttest_cmp expect file2\n '\n \n test_expect_success 'rebased upstream + fetch + pull --rebase' '\n@@ -607,8 +638,10 @@ test_expect_success 'rebased upstream + fetch + pull --rebase' '\n \tgit reset --hard to-rebase-orig &&\n \tgit fetch &&\n \tgit pull --rebase &&\n-\ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = \"$(cat file2)\"\n+\techo \"conflicting modification\" >expect &&\n+\ttest_cmp expect file &&\n+\techo file >expect &&\n+\ttest_cmp expect file2\n \n '\n \n@@ -744,8 +777,10 @@ test_expect_success 'git pull --rebase does not reapply old patches' '\n test_expect_success 'git pull --rebase against local branch' '\n \tgit checkout -b copy2 to-rebase-orig &&\n \tgit pull --rebase . to-rebase &&\n-\ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = \"$(cat file2)\"\n+\techo \"conflicting modification\" >expect &&\n+\ttest_cmp expect file &&\n+\techo file >expect &&\n+\ttest_cmp expect file2\n '\n \n test_done\n-- \n2.24.0.rc0.197.g0926ab8072\n\n"},{"id":"384594","messageId":"9db0fc2156ea8fcdf060932967a6ea989922c989.1571739459.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571739459.git.liu.denton@gmail.com","subject":"[PATCH v3 13/14] t5520: remove redundant lines in test cases","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-22T10:20:27Z","receivedAt":"2019-10-22T10:20:31Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"In the previous patches, the mechanical application of changes left some\nduplicate statements in the test case which were not strictly incorrect\nbut were redundant and possibly misleading. Remove these duplicate\nstatements so that it is clear that the intent behind the tests are that\nthe content of the file stays the same throughout the whole test case.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 8 --------\n 1 file changed, 8 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex c9e4eec004..ef3dbc201a 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -147,7 +147,6 @@ test_expect_success 'fail if wildcard spec does not match any refs' '\n \ttest_cmp expect file &&\n \ttest_must_fail git pull . \"refs/nonexisting1/*:refs/nonexisting2/*\" 2>err &&\n \ttest_i18ngrep \"no candidates for merging\" err &&\n-\techo file >expect &&\n \ttest_cmp expect file\n '\n \n@@ -161,7 +160,6 @@ test_expect_success 'fail if no branches specified with non-default remote' '\n \ttest_config branch.test.remote origin &&\n \ttest_must_fail git pull test_remote 2>err &&\n \ttest_i18ngrep \"specify a branch on the command line\" err &&\n-\techo file >expect &&\n \ttest_cmp expect file\n '\n \n@@ -174,7 +172,6 @@ test_expect_success 'fail if not on a branch' '\n \ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"not currently on a branch\" err &&\n-\techo file >expect &&\n \ttest_cmp expect file\n '\n \n@@ -188,7 +185,6 @@ test_expect_success 'fail if no configuration for current branch' '\n \ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"no tracking information\" err &&\n-\techo file >expect &&\n \ttest_cmp expect file\n '\n \n@@ -202,7 +198,6 @@ test_expect_success 'pull --all: fail if no configuration for current branch' '\n \ttest_cmp expect file &&\n \ttest_must_fail git pull --all 2>err &&\n \ttest_i18ngrep \"There is no tracking information\" err &&\n-\techo file >expect &&\n \ttest_cmp expect file\n '\n \n@@ -215,7 +210,6 @@ test_expect_success 'fail if upstream branch does not exist' '\n \ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"no such ref was fetched\" err &&\n-\techo file >expect &&\n \ttest_cmp expect file\n '\n \n@@ -685,10 +679,8 @@ test_expect_success 'pull --rebase fails on unborn branch with staged changes' '\n \t\tgit ls-files >actual &&\n \t\ttest_cmp expect actual &&\n \t\ttest_must_fail git pull --rebase .. master 2>err &&\n-\t\techo staged-file >expect &&\n \t\tgit ls-files >actual &&\n \t\ttest_cmp expect actual &&\n-\t\techo staged-file >expect &&\n \t\tgit show :staged-file >actual &&\n \t\ttest_cmp expect actual &&\n \t\ttest_i18ngrep \"unborn branch with changes added to the index\" err\n-- \n2.24.0.rc0.197.g0926ab8072\n\n"},{"id":"384595","messageId":"a721d5f119c18c13584f648cabfbffecf9b0db21.1571739459.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571739459.git.liu.denton@gmail.com","subject":"[PATCH v3 14/14] t5520: replace `! git` with `test_must_fail git`","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-22T10:20:29Z","receivedAt":"2019-10-22T10:20:34Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Currently, if a Git command fails in an unexpected way, such as a\nsegfault, it will be masked and ignored. Replace the ! with\ntest_must_fail so that only expected failures pass.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex ef3dbc201a..602d996a33 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -537,7 +537,7 @@ test_expect_success 'pull --rebase=i' '\n test_expect_success 'pull.rebase=invalid fails' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase invalid &&\n-\t! git pull . copy\n+\ttest_must_fail git pull . copy\n '\n \n test_expect_success '--rebase=false create a new merge commit' '\n@@ -572,7 +572,7 @@ test_expect_success REBASE_P \\\n \n test_expect_success '--rebase=invalid fails' '\n \tgit reset --hard before-preserve-rebase &&\n-\t! git pull --rebase=invalid . copy\n+\ttest_must_fail git pull --rebase=invalid . copy\n '\n \n test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-merge' '\n-- \n2.24.0.rc0.197.g0926ab8072\n\n"},{"id":"384704","messageId":"CAPig+cQgE=7Ac+NRaxGRjDwFv4PR1sP8FLHNJfKXJC4QmR4Dhg@mail.gmail.com","threadId":"52061","inReplyTo":"20191018185227.GA74877@generichostname","subject":"Re: [PATCH 08/12] t5520: use test_cmp_rev where possible","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2019-10-23T13:53:57Z","receivedAt":"2019-10-23T13:54:13Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Fri, Oct 18, 2019 at 2:52 PM Denton Liu <liu.denton@gmail.com> wrote:\n> On Thu, Oct 17, 2019 at 07:41:44PM -0400, Eric Sunshine wrote:\n> > On Thu, Oct 17, 2019 at 7:17 PM Denton Liu <liu.denton@gmail.com> wrote:\n> > > -       test \"$COPY\" = \"$(git rev-parse --verify me/copy)\" &&\n> > > +       test_cmp_rev \"$COPY\" me/copy &&\n> >\n> > This transformation doesn't look correct. COPY already holds the\n> > result of a git-rev-parse invocation:\n> >\n> >     COPY=\"$(git rev-parse --verify me/copy)\" &&\n> >\n> > so passing it to test_cmp_rev() -- which applies its own git-rev-parse\n> > invocation -- doesn't make sense.\n>\n> So after grokking the test case, it seems like the the transformation is\n> indeed correct. Maybe we can replace the last line with\n>\n>         test_cmp_rev copy me/copy\n>\n> but I think I'll leave it unless you have any strong opinions.\n\nFor some reason, I had it in my mind that test_cmp_rev() was primarily\nmeant for comparing _named_ revisions, but of course there is nothing\nabout the function which even suggests that that is its intended\nuse-case. In retrospect, using it to compare an OID against a named\nrevision is a sensible use-case too, so I withdraw the objection.\n"},{"id":"384807","messageId":"20191024232139.GA76771@generichostname","threadId":"52061","inReplyTo":"cover.1571739459.git.liu.denton@gmail.com","subject":"Re: [PATCH v3 00/14] t5520: various test cleanup","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-24T23:21:39Z","receivedAt":"2019-10-24T23:21:44Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Hi Junio,\n\nThere haven't been any comments in a couple days so I think this\npatchset is ready for inclusion.\n\nThanks,\n\nDenton\n\nOn Tue, Oct 22, 2019 at 03:19:51AM -0700, Denton Liu wrote:\n> Like earlier patchsets, I want to implement a feature that involves\n> modifications to the test suite. Since that feature will probably take a\n> while to polish up, however, let's clean up the test suite in a separate\n> patchset first so it's not blocked by the feature work.\n> \n> 1/15 is a general improvement to test_rev_cmp() that will be used later\n> in the series.\n> \n> Changes since v2:\n> \n> * Drop 't7408: replace `test_must_fail test_path_is_file`' since it's\n>   not a rabbit hole we want to go into right now\n> \n> * Fix the output of `test_cmp_rev !` when revs are actually equal\n> \n> * Rebase against the latest master since this topic hasn't been picked\n>   up yet\n> \n> Changes since v1:\n> \n> * Incorporate Eric's feedback\n> \n> Denton Liu (14):\n>   t: teach test_cmp_rev to accept ! for not-equals\n>   t5520: improve test style\n>   t5520: use sq for test case names\n>   t5520: let sed open its own input\n>   t5520: replace test -f with test-lib functions\n>   t5520: remove spaces after redirect operator\n>   t5520: use test_line_count where possible\n>   t5520: replace test -{n,z} with test-lib functions\n>   t5520: use test_cmp_rev where possible\n>   t5520: test single-line files by git with test_cmp\n>   t5520: don't put git in upstream of pipe\n>   t5520: replace subshell cat comparison with test_cmp\n>   t5520: remove redundant lines in test cases\n>   t5520: replace `! git` with `test_must_fail git`\n> \n>  t/t2400-worktree-add.sh             |   4 +-\n>  t/t3400-rebase.sh                   |   2 +-\n>  t/t3421-rebase-topology-linear.sh   |   6 +-\n>  t/t3430-rebase-merges.sh            |   2 +-\n>  t/t3432-rebase-fast-forward.sh      |   2 +-\n>  t/t3501-revert-cherry-pick.sh       |   2 +-\n>  t/t3508-cherry-pick-many-commits.sh |   2 +-\n>  t/t5520-pull.sh                     | 343 +++++++++++++++++-----------\n>  t/test-lib-functions.sh             |  22 +-\n>  9 files changed, 234 insertions(+), 151 deletions(-)\n> \n> Range-diff against v2:\n>  1:  987fee4652 <  -:  ---------- t7408: replace `test_must_fail test_path_is_file`\n>  2:  417e808466 !  1:  9a96f113e7 t: teach test_cmp_rev to accept ! for not-equals\n>     @@ t/test-lib-functions.sh: test_cmp_rev () {\n>      -\t\tif test \"$r1\" != \"$r2\"\n>      +\t\tif test \"$r1\" \"$inverted_op\" \"$r2\"\n>       \t\tthen\n>     ++\t\t\tlocal comp_out\n>     ++\t\t\tif \"x$inverted_op\" = 'x='\n>     ++\t\t\tthen\n>     ++\t\t\t\tcomp_out='the same'\n>     ++\t\t\telse\n>     ++\t\t\t\tcomp_out='different'\n>     ++\t\t\tfi\n>       \t\t\tcat >&4 <<-EOF\n>     - \t\t\terror: two revisions point to different objects:\n>     +-\t\t\terror: two revisions point to different objects:\n>     ++\t\t\terror: two revisions point to $comp_out objects:\n>     + \t\t\t  '$1': $r1\n>     + \t\t\t  '$2': $r2\n>     + \t\t\tEOF\n>  3:  0a56980857 =  2:  dfc86a8d9b t5520: improve test style\n>  4:  dfa89ba1cb =  3:  a1071038f5 t5520: use sq for test case names\n>  5:  9fac3dff83 =  4:  0af3f5027b t5520: let sed open its own input\n>  6:  c6ca45eb17 =  5:  b696ff0a67 t5520: replace test -f with test-lib functions\n>  7:  830a8212ae =  6:  d2e49fd990 t5520: remove spaces after redirect operator\n>  8:  3d982230be =  7:  fcfc3226f8 t5520: use test_line_count where possible\n>  9:  2bca4f046d =  8:  86dafc7b54 t5520: replace test -{n,z} with test-lib functions\n> 10:  1a54db1d5c =  9:  bf9b5023a3 t5520: use test_cmp_rev where possible\n> 11:  52cf4f0d0f = 10:  bfabf8ceff t5520: test single-line files by git with test_cmp\n> 12:  0cfabb201c = 11:  56bcbf3047 t5520: don't put git in upstream of pipe\n> 13:  b2d0ce21c8 = 12:  e9d50b8bb0 t5520: replace subshell cat comparison with test_cmp\n> 14:  5aac40a029 = 13:  9db0fc2156 t5520: remove redundant lines in test cases\n> 15:  2c0d3ac416 = 14:  a721d5f119 t5520: replace `! git` with `test_must_fail git`\n> -- \n> 2.24.0.rc0.197.g0926ab8072\n> \n"},{"id":"384840","messageId":"xmqq5zkdebez.fsf@gitster-ct.c.googlers.com","threadId":"52061","inReplyTo":"20191024232139.GA76771@generichostname","subject":"Re: [PATCH v3 00/14] t5520: various test cleanup","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-10-25T03:44:52Z","receivedAt":"2019-10-25T03:45:01Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Denton Liu <liu.denton@gmail.com> writes:\n\n> There haven't been any comments in a couple days so I think this\n> patchset is ready for inclusion.\n\nIt's not like we are in a hurry that we need to fast-forward a topic\nlike this one (i.e. general improvement and clean-up, rather than\nfixing regressions introduced in the cycle), so \"a couple of days\"\nis probably being too impatient.\n\nWe'd prefer a positive ack or two.  \n\nThanks.\n"},{"id":"385408","messageId":"20191104191739.GA61441@generichostname","threadId":"52061","inReplyTo":"xmqq5zkdebez.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH v3 00/14] t5520: various test cleanup","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-04T19:17:39Z","receivedAt":"2019-11-04T19:17:48Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Hi Junio,\n\nOn Fri, Oct 25, 2019 at 12:44:52PM +0900, Junio C Hamano wrote:\n> Denton Liu <liu.denton@gmail.com> writes:\n> \n> > There haven't been any comments in a couple days so I think this\n> > patchset is ready for inclusion.\n> \n> It's not like we are in a hurry that we need to fast-forward a topic\n> like this one (i.e. general improvement and clean-up, rather than\n> fixing regressions introduced in the cycle), so \"a couple of days\"\n> is probably being too impatient.\n\nSince v2.24.0 has been released, would now be a good time to queue this\npatchset?\n\nThanks,\n\nDenton\n\n> \n> We'd prefer a positive ack or two.  \n> \n> Thanks.\n"},{"id":"385518","messageId":"xmqqy2wtvifk.fsf@gitster-ct.c.googlers.com","threadId":"52061","inReplyTo":"20191104191739.GA61441@generichostname","subject":"Re: [PATCH v3 00/14] t5520: various test cleanup","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-11-06T02:37:35Z","receivedAt":"2019-11-06T02:37:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Denton Liu <liu.denton@gmail.com> writes:\n\n> On Fri, Oct 25, 2019 at 12:44:52PM +0900, Junio C Hamano wrote:\n>> Denton Liu <liu.denton@gmail.com> writes:\n>> \n>> > There haven't been any comments in a couple days so I think this\n>> > patchset is ready for inclusion.\n>> \n>> It's not like we are in a hurry that we need to fast-forward a topic\n>> like this one (i.e. general improvement and clean-up, rather than\n>> fixing regressions introduced in the cycle), so \"a couple of days\"\n>> is probably being too impatient.\n>\n> Since v2.24.0 has been released, would now be a good time to queue this\n> patchset?\n\nWe'd prefer a positive ack or two.\n\nSince they are rather ancient messages in Git timescale, perhaps\nsend a new version that is rebased (and retested) on top of 2.24\nto ask for reviews?\n\nThanks.\n\n"},{"id":"385715","messageId":"cover.1573152598.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1571739459.git.liu.denton@gmail.com","subject":"[PATCH v4 00/14] t5520: various test cleanup","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-07T18:51:15Z","receivedAt":"2019-11-07T18:51:21Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Hi all, since this is general cleanup that shouldn't be too\ncontroversial, I'm looking for some positive acks for this changeset.\n\n\nLike earlier patchsets, I want to implement a feature that involves\nmodifications to the test suite. Since that feature will probably take a\nwhile to polish up, however, let's clean up the test suite in a separate\npatchset first so it's not blocked by the feature work.\n\n1/15 is a general improvement to test_rev_cmp() that will be used later\nin the series.\n\nChanges since v3:\n\n* Rebased and tested on top of v2.24.0\n\nChanges since v2:\n\n* Drop 't7408: replace `test_must_fail test_path_is_file`' since it's\n  not a rabbit hole we want to go into right now\n\n* Fix the output of `test_cmp_rev !` when revs are actually equal\n\n* Rebase against the latest master since this topic hasn't been picked\n  up yet\n\nChanges since v1:\n\n* Incorporate Eric's feedback\n\nDenton Liu (14):\n  t: teach test_cmp_rev to accept ! for not-equals\n  t5520: improve test style\n  t5520: use sq for test case names\n  t5520: let sed open its own input\n  t5520: replace test -f with test-lib functions\n  t5520: remove spaces after redirect operator\n  t5520: use test_line_count where possible\n  t5520: replace test -{n,z} with test-lib functions\n  t5520: use test_cmp_rev where possible\n  t5520: test single-line files by git with test_cmp\n  t5520: don't put git in upstream of pipe\n  t5520: replace subshell cat comparison with test_cmp\n  t5520: remove redundant lines in test cases\n  t5520: replace `! git` with `test_must_fail git`\n\n t/t2400-worktree-add.sh             |   4 +-\n t/t3400-rebase.sh                   |   2 +-\n t/t3421-rebase-topology-linear.sh   |   6 +-\n t/t3430-rebase-merges.sh            |   2 +-\n t/t3432-rebase-fast-forward.sh      |   2 +-\n t/t3501-revert-cherry-pick.sh       |   2 +-\n t/t3508-cherry-pick-many-commits.sh |   2 +-\n t/t5520-pull.sh                     | 343 +++++++++++++++++-----------\n t/test-lib-functions.sh             |  22 +-\n 9 files changed, 234 insertions(+), 151 deletions(-)\n\nRange-diff against v3:\n 1:  9a96f113e7 =  1:  0d0696f310 t: teach test_cmp_rev to accept ! for not-equals\n 2:  dfc86a8d9b =  2:  b1dbe78f5d t5520: improve test style\n 3:  a1071038f5 =  3:  ea06a1db3d t5520: use sq for test case names\n 4:  0af3f5027b =  4:  d09b591250 t5520: let sed open its own input\n 5:  b696ff0a67 =  5:  2af85e3913 t5520: replace test -f with test-lib functions\n 6:  d2e49fd990 =  6:  280cfa0adc t5520: remove spaces after redirect operator\n 7:  fcfc3226f8 =  7:  1e8ecb80a4 t5520: use test_line_count where possible\n 8:  86dafc7b54 =  8:  f31142c683 t5520: replace test -{n,z} with test-lib functions\n 9:  bf9b5023a3 =  9:  fdde875363 t5520: use test_cmp_rev where possible\n10:  bfabf8ceff = 10:  6cb78bce40 t5520: test single-line files by git with test_cmp\n11:  56bcbf3047 = 11:  acbfc39cb0 t5520: don't put git in upstream of pipe\n12:  e9d50b8bb0 = 12:  bb529ad84a t5520: replace subshell cat comparison with test_cmp\n13:  9db0fc2156 = 13:  d08e34b021 t5520: remove redundant lines in test cases\n14:  a721d5f119 = 14:  70698bd902 t5520: replace `! git` with `test_must_fail git`\n-- \n2.24.0.rc2.262.g2d07a97ef5\n\n"},{"id":"385716","messageId":"0d0696f310a6f8e13ed480b1a1e91cdc2debaa20.1573152599.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573152598.git.liu.denton@gmail.com","subject":"[PATCH v4 01/14] t: teach test_cmp_rev to accept ! for not-equals","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-07T18:51:19Z","receivedAt":"2019-11-07T18:51:25Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Currently, in the case where we are using test_cmp_rev() to report\nnot-equals, we write `! test_cmp_rev`. However, since test_cmp_rev()\ncontains\n\n\tr1=$(git rev-parse --verify \"$1\") &&\n\tr2=$(git rev-parse --verify \"$2\") &&\n\nIn the case where `git rev-parse` segfaults and dies unexpectedly, the\nfailure will be ignored.\n\nRewrite test_cmp_rev() to optionally accept \"!\" as the first argument to\ndo a not-equals comparison. Rewrite `! test_cmp_rev` to `test_cmp_rev !`\nin all tests to take advantage of this new functionality.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t2400-worktree-add.sh             |  4 ++--\n t/t3400-rebase.sh                   |  2 +-\n t/t3421-rebase-topology-linear.sh   |  6 +++---\n t/t3430-rebase-merges.sh            |  2 +-\n t/t3432-rebase-fast-forward.sh      |  2 +-\n t/t3501-revert-cherry-pick.sh       |  2 +-\n t/t3508-cherry-pick-many-commits.sh |  2 +-\n t/test-lib-functions.sh             | 22 +++++++++++++++++++---\n 8 files changed, 29 insertions(+), 13 deletions(-)\n\ndiff --git a/t/t2400-worktree-add.sh b/t/t2400-worktree-add.sh\nindex e819ba741e..52d476979b 100755\n--- a/t/t2400-worktree-add.sh\n+++ b/t/t2400-worktree-add.sh\n@@ -438,7 +438,7 @@ test_expect_success 'git worktree add does not match remote' '\n \t\tcd foo &&\n \t\ttest_must_fail git config \"branch.foo.remote\" &&\n \t\ttest_must_fail git config \"branch.foo.merge\" &&\n-\t\t! test_cmp_rev refs/remotes/repo_a/foo refs/heads/foo\n+\t\ttest_cmp_rev ! refs/remotes/repo_a/foo refs/heads/foo\n \t)\n '\n \n@@ -483,7 +483,7 @@ test_expect_success 'git worktree --no-guess-remote option overrides config' '\n \t\tcd foo &&\n \t\ttest_must_fail git config \"branch.foo.remote\" &&\n \t\ttest_must_fail git config \"branch.foo.merge\" &&\n-\t\t! test_cmp_rev refs/remotes/repo_a/foo refs/heads/foo\n+\t\ttest_cmp_rev ! refs/remotes/repo_a/foo refs/heads/foo\n \t)\n '\n \ndiff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh\nindex ab18ac5f28..f267f6cd54 100755\n--- a/t/t3400-rebase.sh\n+++ b/t/t3400-rebase.sh\n@@ -64,7 +64,7 @@ test_expect_success 'rebase sets ORIG_HEAD to pre-rebase state' '\n \tpre=\"$(git rev-parse --verify HEAD)\" &&\n \tgit rebase master &&\n \ttest_cmp_rev \"$pre\" ORIG_HEAD &&\n-\t! test_cmp_rev \"$pre\" HEAD\n+\ttest_cmp_rev ! \"$pre\" HEAD\n '\n \n test_expect_success 'rebase, with <onto> and <upstream> specified as :/quuxery' '\ndiff --git a/t/t3421-rebase-topology-linear.sh b/t/t3421-rebase-topology-linear.sh\nindex b847064f91..325072b0a3 100755\n--- a/t/t3421-rebase-topology-linear.sh\n+++ b/t/t3421-rebase-topology-linear.sh\n@@ -61,7 +61,7 @@ test_run_rebase () {\n \ttest_expect_$result \"rebase $* -f rewrites even if upstream is an ancestor\" \"\n \t\treset_rebase &&\n \t\tgit rebase $* -f b e &&\n-\t\t! test_cmp_rev e HEAD &&\n+\t\ttest_cmp_rev ! e HEAD &&\n \t\ttest_cmp_rev b HEAD~2 &&\n \t\ttest_linear_range 'd e' b..\n \t\"\n@@ -78,7 +78,7 @@ test_run_rebase () {\n \ttest_expect_$result \"rebase $* -f rewrites even if remote upstream is an ancestor\" \"\n \t\treset_rebase &&\n \t\tgit rebase $* -f branch-b branch-e &&\n-\t\t! test_cmp_rev branch-e origin/branch-e &&\n+\t\ttest_cmp_rev ! branch-e origin/branch-e &&\n \t\ttest_cmp_rev branch-b HEAD~2 &&\n \t\ttest_linear_range 'd e' branch-b..\n \t\"\n@@ -368,7 +368,7 @@ test_run_rebase () {\n \ttest_expect_$result \"rebase $* -f --root on linear history causes re-write\" \"\n \t\treset_rebase &&\n \t\tgit rebase $* -f --root c &&\n-\t\t! test_cmp_rev a HEAD~2 &&\n+\t\ttest_cmp_rev ! a HEAD~2 &&\n \t\ttest_linear_range 'a b c' HEAD\n \t\"\n }\ndiff --git a/t/t3430-rebase-merges.sh b/t/t3430-rebase-merges.sh\nindex 9efcf4808a..abbdc26b1b 100755\n--- a/t/t3430-rebase-merges.sh\n+++ b/t/t3430-rebase-merges.sh\n@@ -346,7 +346,7 @@ test_expect_success 'A root commit can be a cousin, treat it that way' '\n \tgit merge --allow-unrelated-histories khnum &&\n \ttest_tick &&\n \tgit rebase -f -r HEAD^ &&\n-\t! test_cmp_rev HEAD^2 khnum &&\n+\ttest_cmp_rev ! HEAD^2 khnum &&\n \ttest_cmp_graph HEAD^.. <<-\\EOF &&\n \t*   Merge branch '\\''khnum'\\'' into asherah\n \t|\\\ndiff --git a/t/t3432-rebase-fast-forward.sh b/t/t3432-rebase-fast-forward.sh\nindex 034ffc7e76..92f95b57da 100755\n--- a/t/t3432-rebase-fast-forward.sh\n+++ b/t/t3432-rebase-fast-forward.sh\n@@ -64,7 +64,7 @@ test_rebase_same_head_ () {\n \t\t\ttest_cmp_rev \\$oldhead \\$newhead\n \t\telif test $cmp = diff\n \t\tthen\n-\t\t\t! test_cmp_rev \\$oldhead \\$newhead\n+\t\t\ttest_cmp_rev ! \\$oldhead \\$newhead\n \t\tfi\n \t\"\n }\ndiff --git a/t/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh\nindex d1c68af8c5..1c51a9131d 100755\n--- a/t/t3501-revert-cherry-pick.sh\n+++ b/t/t3501-revert-cherry-pick.sh\n@@ -106,7 +106,7 @@ test_expect_success 'cherry-pick on unborn branch' '\n \trm -rf * &&\n \tgit cherry-pick initial &&\n \tgit diff --quiet initial &&\n-\t! test_cmp_rev initial HEAD\n+\ttest_cmp_rev ! initial HEAD\n '\n \n test_expect_success 'cherry-pick \"-\" to pick from previous branch' '\ndiff --git a/t/t3508-cherry-pick-many-commits.sh b/t/t3508-cherry-pick-many-commits.sh\nindex b457333e18..23070a7b73 100755\n--- a/t/t3508-cherry-pick-many-commits.sh\n+++ b/t/t3508-cherry-pick-many-commits.sh\n@@ -5,7 +5,7 @@ test_description='test cherry-picking many commits'\n . ./test-lib.sh\n \n check_head_differs_from() {\n-\t! test_cmp_rev HEAD \"$1\"\n+\ttest_cmp_rev ! HEAD \"$1\"\n }\n \n check_head_equals() {\ndiff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh\nindex b299ecc326..064131ac39 100644\n--- a/t/test-lib-functions.sh\n+++ b/t/test-lib-functions.sh\n@@ -1012,8 +1012,17 @@ test_must_be_empty () {\n \tfi\n }\n \n-# Tests that its two parameters refer to the same revision\n+# Tests that its two parameters refer to the same revision, or if '!' is\n+# provided first, that its other two parameters refer to different\n+# revisions.\n test_cmp_rev () {\n+\tlocal inverted_op\n+\tinverted_op='!='\n+\tif test $# -ge 1 && test \"x$1\" = 'x!'\n+\tthen\n+\t    inverted_op='='\n+\t    shift\n+\tfi\n \tif test $# != 2\n \tthen\n \t\terror \"bug in the test script: test_cmp_rev requires two revisions, but got $#\"\n@@ -1021,10 +1030,17 @@ test_cmp_rev () {\n \t\tlocal r1 r2\n \t\tr1=$(git rev-parse --verify \"$1\") &&\n \t\tr2=$(git rev-parse --verify \"$2\") &&\n-\t\tif test \"$r1\" != \"$r2\"\n+\t\tif test \"$r1\" \"$inverted_op\" \"$r2\"\n \t\tthen\n+\t\t\tlocal comp_out\n+\t\t\tif \"x$inverted_op\" = 'x='\n+\t\t\tthen\n+\t\t\t\tcomp_out='the same'\n+\t\t\telse\n+\t\t\t\tcomp_out='different'\n+\t\t\tfi\n \t\t\tcat >&4 <<-EOF\n-\t\t\terror: two revisions point to different objects:\n+\t\t\terror: two revisions point to $comp_out objects:\n \t\t\t  '$1': $r1\n \t\t\t  '$2': $r2\n \t\t\tEOF\n-- \n2.24.0.rc2.262.g2d07a97ef5\n\n"},{"id":"385717","messageId":"b1dbe78f5d13785c436abddf50ea513f3050fe89.1573152599.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573152598.git.liu.denton@gmail.com","subject":"[PATCH v4 02/14] t5520: improve test style","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-07T18:51:21Z","receivedAt":"2019-11-07T18:51:28Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Improve the test style by removing leading and trailing empty lines\nwithin test cases. Also, reformat multi-line subshells to conform to the\nexisting style.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 88 +++++++++++++++++++++++++------------------------\n 1 file changed, 45 insertions(+), 43 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex cf4cc32fd0..51d6ce8aec 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -538,7 +538,6 @@ test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-m\n '\n \n test_expect_success '--rebase with rebased upstream' '\n-\n \tgit remote add -f me . &&\n \tgit checkout copy &&\n \tgit tag copy-orig &&\n@@ -552,7 +551,6 @@ test_expect_success '--rebase with rebased upstream' '\n \tgit pull --rebase me copy &&\n \ttest \"conflicting modification\" = \"$(cat file)\" &&\n \ttest file = \"$(cat file2)\"\n-\n '\n \n test_expect_success '--rebase -f with rebased upstream' '\n@@ -564,14 +562,12 @@ test_expect_success '--rebase -f with rebased upstream' '\n '\n \n test_expect_success '--rebase with rebased default upstream' '\n-\n \tgit update-ref refs/remotes/me/copy copy-orig &&\n \tgit checkout --track -b to-rebase2 me/copy &&\n \tgit reset --hard to-rebase-orig &&\n \tgit pull --rebase &&\n \ttest \"conflicting modification\" = \"$(cat file)\" &&\n \ttest file = \"$(cat file2)\"\n-\n '\n \n test_expect_success 'rebased upstream + fetch + pull --rebase' '\n@@ -588,7 +584,6 @@ test_expect_success 'rebased upstream + fetch + pull --rebase' '\n '\n \n test_expect_success 'pull --rebase dies early with dirty working directory' '\n-\n \tgit checkout to-rebase &&\n \tgit update-ref refs/remotes/me/copy copy^ &&\n \tCOPY=\"$(git rev-parse --verify me/copy)\" &&\n@@ -603,16 +598,16 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '\n \tgit checkout HEAD -- file &&\n \tgit pull &&\n \ttest \"$COPY\" != \"$(git rev-parse --verify me/copy)\"\n-\n '\n \n test_expect_success 'pull --rebase works on branch yet to be born' '\n \tgit rev-parse master >expect &&\n \tmkdir empty_repo &&\n-\t(cd empty_repo &&\n-\t git init &&\n-\t git pull --rebase .. master &&\n-\t git rev-parse HEAD >../actual\n+\t(\n+\t\tcd empty_repo &&\n+\t\tgit init &&\n+\t\tgit pull --rebase .. master &&\n+\t\tgit rev-parse HEAD >../actual\n \t) &&\n \ttest_cmp expect actual\n '\n@@ -646,58 +641,65 @@ test_expect_success 'pull --rebase fails on corrupt HEAD' '\n \n test_expect_success 'setup for detecting upstreamed changes' '\n \tmkdir src &&\n-\t(cd src &&\n-\t git init &&\n-\t printf \"1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n10\\n\" > stuff &&\n-\t git add stuff &&\n-\t git commit -m \"Initial revision\"\n+\t(\n+\t\tcd src &&\n+\t\tgit init &&\n+\t\tprintf \"1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n10\\n\" > stuff &&\n+\t\tgit add stuff &&\n+\t\tgit commit -m \"Initial revision\"\n \t) &&\n \tgit clone src dst &&\n-\t(cd src &&\n-\t modify s/5/43/ stuff &&\n-\t git commit -a -m \"5->43\" &&\n-\t modify s/6/42/ stuff &&\n-\t git commit -a -m \"Make it bigger\"\n+\t(\n+\t\tcd src &&\n+\t\tmodify s/5/43/ stuff &&\n+\t\tgit commit -a -m \"5->43\" &&\n+\t\tmodify s/6/42/ stuff &&\n+\t\tgit commit -a -m \"Make it bigger\"\n \t) &&\n-\t(cd dst &&\n-\t modify s/5/43/ stuff &&\n-\t git commit -a -m \"Independent discovery of 5->43\"\n+\t(\n+\t\tcd dst &&\n+\t\tmodify s/5/43/ stuff &&\n+\t\tgit commit -a -m \"Independent discovery of 5->43\"\n \t)\n '\n \n test_expect_success 'git pull --rebase detects upstreamed changes' '\n-\t(cd dst &&\n-\t git pull --rebase &&\n-\t test -z \"$(git ls-files -u)\"\n+\t(\n+\t\tcd dst &&\n+\t\tgit pull --rebase &&\n+\t\ttest -z \"$(git ls-files -u)\"\n \t)\n '\n \n test_expect_success 'setup for avoiding reapplying old patches' '\n-\t(cd dst &&\n-\t test_might_fail git rebase --abort &&\n-\t git reset --hard origin/master\n+\t(\n+\t\tcd dst &&\n+\t\ttest_might_fail git rebase --abort &&\n+\t\tgit reset --hard origin/master\n \t) &&\n \tgit clone --bare src src-replace.git &&\n \trm -rf src &&\n \tmv src-replace.git src &&\n-\t(cd dst &&\n-\t modify s/2/22/ stuff &&\n-\t git commit -a -m \"Change 2\" &&\n-\t modify s/3/33/ stuff &&\n-\t git commit -a -m \"Change 3\" &&\n-\t modify s/4/44/ stuff &&\n-\t git commit -a -m \"Change 4\" &&\n-\t git push &&\n-\n-\t modify s/44/55/ stuff &&\n-\t git commit --amend -a -m \"Modified Change 4\"\n+\t(\n+\t\tcd dst &&\n+\t\tmodify s/2/22/ stuff &&\n+\t\tgit commit -a -m \"Change 2\" &&\n+\t\tmodify s/3/33/ stuff &&\n+\t\tgit commit -a -m \"Change 3\" &&\n+\t\tmodify s/4/44/ stuff &&\n+\t\tgit commit -a -m \"Change 4\" &&\n+\t\tgit push &&\n+\n+\t\tmodify s/44/55/ stuff &&\n+\t\tgit commit --amend -a -m \"Modified Change 4\"\n \t)\n '\n \n test_expect_success 'git pull --rebase does not reapply old patches' '\n-\t(cd dst &&\n-\t test_must_fail git pull --rebase &&\n-\t test 1 = $(find .git/rebase-apply -name \"000*\" | wc -l)\n+\t(\n+\t\tcd dst &&\n+\t\ttest_must_fail git pull --rebase &&\n+\t\ttest 1 = $(find .git/rebase-apply -name \"000*\" | wc -l)\n \t)\n '\n \n-- \n2.24.0.rc2.262.g2d07a97ef5\n\n"},{"id":"385718","messageId":"ea06a1db3d4674880adb76515967d7052f3941e0.1573152599.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573152598.git.liu.denton@gmail.com","subject":"[PATCH v4 03/14] t5520: use sq for test case names","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-07T18:51:24Z","receivedAt":"2019-11-07T18:51:28Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"The usual convention is for test case names to be written between\nsingle-quotes. Change all double-quoted test case names to single-quotes\nexcept for two test case names that use variables within.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 51d6ce8aec..a3de2e19b6 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -408,7 +408,7 @@ test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n \ttest new = \"$(git show HEAD:file2)\"\n '\n \n-test_expect_success \"pull --rebase warns on --verify-signatures\" '\n+test_expect_success 'pull --rebase warns on --verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --verify-signatures . copy 2>err &&\n \ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n@@ -416,7 +416,7 @@ test_expect_success \"pull --rebase warns on --verify-signatures\" '\n \ttest_i18ngrep \"ignoring --verify-signatures for rebase\" err\n '\n \n-test_expect_success \"pull --rebase does not warn on --no-verify-signatures\" '\n+test_expect_success 'pull --rebase does not warn on --no-verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --no-verify-signatures . copy 2>err &&\n \ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n-- \n2.24.0.rc2.262.g2d07a97ef5\n\n"},{"id":"385719","messageId":"d09b59125069eaa9e012e996ed19326606163a1c.1573152599.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573152598.git.liu.denton@gmail.com","subject":"[PATCH v4 04/14] t5520: let sed open its own input","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-07T18:51:26Z","receivedAt":"2019-11-07T18:51:30Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"We were using a redirection operator to feed input into sed. However,\nsince sed is capable of opening its own files, make sed open its own\nfiles instead of redirecting input into it.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex a3de2e19b6..55560ce3cd 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -5,7 +5,7 @@ test_description='pulling into void'\n . ./test-lib.sh\n \n modify () {\n-\tsed -e \"$1\" <\"$2\" >\"$2.x\" &&\n+\tsed -e \"$1\" \"$2\" >\"$2.x\" &&\n \tmv \"$2.x\" \"$2\"\n }\n \n-- \n2.24.0.rc2.262.g2d07a97ef5\n\n"},{"id":"385720","messageId":"2af85e39133cde036fe1ccd1ed417cdeb3113a64.1573152599.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573152598.git.liu.denton@gmail.com","subject":"[PATCH v4 05/14] t5520: replace test -f with test-lib functions","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-07T18:51:28Z","receivedAt":"2019-11-07T18:51:33Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Although `test -f` has the same functionality as test_path_is_file(), in\nthe case where test_path_is_file() fails, we get much better debugging\ninformation.\n\nReplace `test -f` with test_path_is_file() so that future developers\nwill have a better experience debugging these test cases.\n\nAlso, in the case of `! test -f`, not only should that path not be a\nfile, it shouldn't exist at all so replace it with\ntest_path_is_missing().\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 55560ce3cd..004d5884cd 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -39,8 +39,8 @@ test_expect_success 'pulling into void' '\n \t\tcd cloned &&\n \t\tgit pull ..\n \t) &&\n-\ttest -f file &&\n-\ttest -f cloned/file &&\n+\ttest_path_is_file file &&\n+\ttest_path_is_file cloned/file &&\n \ttest_cmp file cloned/file\n '\n \n@@ -50,8 +50,8 @@ test_expect_success 'pulling into void using master:master' '\n \t\tcd cloned-uho &&\n \t\tgit pull .. master:master\n \t) &&\n-\ttest -f file &&\n-\ttest -f cloned-uho/file &&\n+\ttest_path_is_file file &&\n+\ttest_path_is_file cloned-uho/file &&\n \ttest_cmp file cloned-uho/file\n '\n \n@@ -99,7 +99,7 @@ test_expect_success 'pulling into void must not create an octopus' '\n \t(\n \t\tcd cloned-octopus &&\n \t\ttest_must_fail git pull .. master master &&\n-\t\t! test -f file\n+\t\ttest_path_is_missing file\n \t)\n '\n \n-- \n2.24.0.rc2.262.g2d07a97ef5\n\n"},{"id":"385721","messageId":"280cfa0adc516810a3e642b5a3425589bc1ad398.1573152599.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573152598.git.liu.denton@gmail.com","subject":"[PATCH v4 06/14] t5520: remove spaces after redirect operator","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-07T18:51:31Z","receivedAt":"2019-11-07T18:51:37Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"The style for tests in Git is to have the redirect operator attached to\nthe filename with no spaces. Fix test cases where this is not the case.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 004d5884cd..7bb9031140 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -243,10 +243,10 @@ test_expect_success 'fast-forward fails with conflicting work tree' '\n \n test_expect_success '--rebase' '\n \tgit branch to-rebase &&\n-\techo modified again > file &&\n+\techo modified again >file &&\n \tgit commit -m file file &&\n \tgit checkout to-rebase &&\n-\techo new > file2 &&\n+\techo new >file2 &&\n \tgit add file2 &&\n \tgit commit -m \"new file\" &&\n \tgit tag before-rebase &&\n@@ -542,10 +542,10 @@ test_expect_success '--rebase with rebased upstream' '\n \tgit checkout copy &&\n \tgit tag copy-orig &&\n \tgit reset --hard HEAD^ &&\n-\techo conflicting modification > file &&\n+\techo conflicting modification >file &&\n \tgit commit -m conflict file &&\n \tgit checkout to-rebase &&\n-\techo file > file2 &&\n+\techo file >file2 &&\n \tgit commit -m to-rebase file2 &&\n \tgit tag to-rebase-orig &&\n \tgit pull --rebase me copy &&\n@@ -591,7 +591,7 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '\n \ttest_config branch.to-rebase.remote me &&\n \ttest_config branch.to-rebase.merge refs/heads/copy &&\n \ttest_config branch.to-rebase.rebase true &&\n-\techo dirty >> file &&\n+\techo dirty >>file &&\n \tgit add file &&\n \ttest_must_fail git pull &&\n \ttest \"$COPY\" = \"$(git rev-parse --verify me/copy)\" &&\n-- \n2.24.0.rc2.262.g2d07a97ef5\n\n"},{"id":"385722","messageId":"1e8ecb80a4c7bc614f39dbf099fc5fe417e48a7c.1573152599.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573152598.git.liu.denton@gmail.com","subject":"[PATCH v4 07/14] t5520: use test_line_count where possible","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-07T18:51:34Z","receivedAt":"2019-11-07T18:51:38Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Instead of rolling our own functionality to test the number of lines a\ncommand outputs, use test_line_count() which provides better debugging\ninformation in the case of a failure.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 7bb9031140..0ca4867e96 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -699,7 +699,8 @@ test_expect_success 'git pull --rebase does not reapply old patches' '\n \t(\n \t\tcd dst &&\n \t\ttest_must_fail git pull --rebase &&\n-\t\ttest 1 = $(find .git/rebase-apply -name \"000*\" | wc -l)\n+\t\tfind .git/rebase-apply -name \"000*\" >patches &&\n+\t\ttest_line_count = 1 patches\n \t)\n '\n \n-- \n2.24.0.rc2.262.g2d07a97ef5\n\n"},{"id":"385723","messageId":"f31142c6834c74931dfe0e353f696c354584938c.1573152599.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573152598.git.liu.denton@gmail.com","subject":"[PATCH v4 08/14] t5520: replace test -{n,z} with test-lib functions","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-07T18:51:36Z","receivedAt":"2019-11-07T18:51:42Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"When wrapping a Git command in a subshell within another command, we\nthrow away the Git command's exit code. In case the Git command fails,\nwe would like to know about it rather than the failure being silent.\nExtract Git commands so that their exit codes are not lost.\n\nInstead of using `test -n` or `test -z`, replace them respectively with\ninvocations of test_file_not_empty() and test_must_be_empty() so that we\nget better debugging information in the case of a failure.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 12 ++++++++----\n 1 file changed, 8 insertions(+), 4 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 0ca4867e96..18225d8430 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -206,15 +206,18 @@ test_expect_success 'fail if the index has unresolved entries' '\n \ttest_when_finished \"git checkout -f copy && git branch -D third\" &&\n \ttest \"$(cat file)\" = file &&\n \ttest_commit modified2 file &&\n-\ttest -z \"$(git ls-files -u)\" &&\n+\tgit ls-files -u >unmerged &&\n+\ttest_must_be_empty unmerged &&\n \ttest_must_fail git pull . second &&\n-\ttest -n \"$(git ls-files -u)\" &&\n+\tgit ls-files -u >unmerged &&\n+\ttest_file_not_empty unmerged &&\n \tcp file expected &&\n \ttest_must_fail git pull . second 2>err &&\n \ttest_i18ngrep \"Pulling is not possible because you have unmerged files.\" err &&\n \ttest_cmp expected file &&\n \tgit add file &&\n-\ttest -z \"$(git ls-files -u)\" &&\n+\tgit ls-files -u >unmerged &&\n+\ttest_must_be_empty unmerged &&\n \ttest_must_fail git pull . second 2>err &&\n \ttest_i18ngrep \"You have not concluded your merge\" err &&\n \ttest_cmp expected file\n@@ -667,7 +670,8 @@ test_expect_success 'git pull --rebase detects upstreamed changes' '\n \t(\n \t\tcd dst &&\n \t\tgit pull --rebase &&\n-\t\ttest -z \"$(git ls-files -u)\"\n+\t\tgit ls-files -u >untracked &&\n+\t\ttest_must_be_empty untracked\n \t)\n '\n \n-- \n2.24.0.rc2.262.g2d07a97ef5\n\n"},{"id":"385724","messageId":"fdde875363ed67c208d15cbc8bd96d5f9f476152.1573152599.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573152598.git.liu.denton@gmail.com","subject":"[PATCH v4 09/14] t5520: use test_cmp_rev where possible","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-07T18:51:39Z","receivedAt":"2019-11-07T18:51:46Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"In case an invocation of `git rev-list` fails within the subshell, the\nfailure will be masked. Remove the subshell and use test_cmp_rev() so\nthat failures can be discovered.\n\nThis change was done with the following sed expressions:\n\n\ts/test \"$(git rev-parse.* \\([^)]*\\))\" = \"$(git rev-parse \\([^)]*\\))\"/test_cmp_rev \\1 \\2/\n\ts/test \\([^ ]*\\) = \"$(git rev-parse.* \\([^)]*\\))\"/test_cmp_rev \\1 \\2/\n\ts/test \"$(git rev-parse.* \\([^)]*\\))\" != \"$(git rev-parse.* \\([^)]*\\))\"/test_cmp_rev ! \\1 \\2/\n\ts/test \\([^ ]*\\) != \"$(git rev-parse.* \\([^)]*\\))\"/test_cmp_rev ! \\1 \\2/\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 50 ++++++++++++++++++++++++-------------------------\n 1 file changed, 25 insertions(+), 25 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 18225d8430..1af6ea06ee 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -230,7 +230,7 @@ test_expect_success 'fast-forwards working tree if branch head is updated' '\n \tgit pull . second:third 2>err &&\n \ttest_i18ngrep \"fetch updated the current branch head\" err &&\n \ttest \"$(cat file)\" = modified &&\n-\ttest \"$(git rev-parse third)\" = \"$(git rev-parse second)\"\n+\ttest_cmp_rev third second\n '\n \n test_expect_success 'fast-forward fails with conflicting work tree' '\n@@ -241,7 +241,7 @@ test_expect_success 'fast-forward fails with conflicting work tree' '\n \ttest_must_fail git pull . second:third 2>err &&\n \ttest_i18ngrep \"Cannot fast-forward your working tree\" err &&\n \ttest \"$(cat file)\" = conflict &&\n-\ttest \"$(git rev-parse third)\" = \"$(git rev-parse second)\"\n+\ttest_cmp_rev third second\n '\n \n test_expect_success '--rebase' '\n@@ -254,7 +254,7 @@ test_expect_success '--rebase' '\n \tgit commit -m \"new file\" &&\n \tgit tag before-rebase &&\n \tgit pull --rebase . copy &&\n-\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\"\n '\n \n@@ -266,7 +266,7 @@ test_expect_success '--rebase fast forward' '\n \n \tgit checkout to-rebase &&\n \tgit pull --rebase . ff &&\n-\ttest \"$(git rev-parse HEAD)\" = \"$(git rev-parse ff)\" &&\n+\ttest_cmp_rev HEAD ff &&\n \n \t# The above only validates the result.  Did we actually bypass rebase?\n \tgit reflog -1 >reflog.actual &&\n@@ -290,7 +290,7 @@ test_expect_success '--rebase --autostash fast forward' '\n \tgit checkout behind &&\n \techo dirty >file &&\n \tgit pull --rebase --autostash . to-rebase-ff &&\n-\ttest \"$(git rev-parse HEAD)\" = \"$(git rev-parse to-rebase-ff)\"\n+\ttest_cmp_rev HEAD to-rebase-ff\n '\n \n test_expect_success '--rebase with conflicts shows advice' '\n@@ -328,7 +328,7 @@ test_expect_success 'failed --rebase shows advice' '\n test_expect_success '--rebase fails with multiple branches' '\n \tgit reset --hard before-rebase &&\n \ttest_must_fail git pull --rebase . copy master 2>err &&\n-\ttest \"$(git rev-parse HEAD)\" = \"$(git rev-parse before-rebase)\" &&\n+\ttest_cmp_rev HEAD before-rebase &&\n \ttest_i18ngrep \"Cannot rebase onto multiple branches\" err &&\n \ttest modified = \"$(git show HEAD:file)\"\n '\n@@ -380,7 +380,7 @@ test_expect_success 'pull.rebase' '\n \tgit reset --hard before-rebase &&\n \ttest_config pull.rebase true &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\"\n '\n \n@@ -398,7 +398,7 @@ test_expect_success 'branch.to-rebase.rebase' '\n \tgit reset --hard before-rebase &&\n \ttest_config branch.to-rebase.rebase true &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\"\n '\n \n@@ -407,14 +407,14 @@ test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n \ttest_config pull.rebase true &&\n \ttest_config branch.to-rebase.rebase false &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^)\" != \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev ! HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\"\n '\n \n test_expect_success 'pull --rebase warns on --verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --verify-signatures . copy 2>err &&\n-\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\" &&\n \ttest_i18ngrep \"ignoring --verify-signatures for rebase\" err\n '\n@@ -422,7 +422,7 @@ test_expect_success 'pull --rebase warns on --verify-signatures' '\n test_expect_success 'pull --rebase does not warn on --no-verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --no-verify-signatures . copy 2>err &&\n-\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\" &&\n \ttest_i18ngrep ! \"verify-signatures\" err\n '\n@@ -443,8 +443,8 @@ test_expect_success 'pull.rebase=false create a new merge commit' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase false &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^1)\" = \"$(git rev-parse before-preserve-rebase)\" &&\n-\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^1 before-preserve-rebase &&\n+\ttest_cmp_rev HEAD^2 copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -452,7 +452,7 @@ test_expect_success 'pull.rebase=true flattens keep-merge' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase true &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^^ copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -460,7 +460,7 @@ test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase 1 &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^^ copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -469,8 +469,8 @@ test_expect_success REBASE_P \\\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase preserve &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n-\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse keep-merge)\"\n+\ttest_cmp_rev HEAD^^ copy &&\n+\ttest_cmp_rev HEAD^2 keep-merge\n '\n \n test_expect_success 'pull.rebase=interactive' '\n@@ -505,8 +505,8 @@ test_expect_success '--rebase=false create a new merge commit' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase true &&\n \tgit pull --rebase=false . copy &&\n-\ttest \"$(git rev-parse HEAD^1)\" = \"$(git rev-parse before-preserve-rebase)\" &&\n-\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^1 before-preserve-rebase &&\n+\ttest_cmp_rev HEAD^2 copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -514,7 +514,7 @@ test_expect_success '--rebase=true rebases and flattens keep-merge' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase preserve &&\n \tgit pull --rebase=true . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^^ copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -523,8 +523,8 @@ test_expect_success REBASE_P \\\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase true &&\n \tgit pull --rebase=preserve . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n-\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse keep-merge)\"\n+\ttest_cmp_rev HEAD^^ copy &&\n+\ttest_cmp_rev HEAD^2 keep-merge\n '\n \n test_expect_success '--rebase=invalid fails' '\n@@ -536,7 +536,7 @@ test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-m\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase preserve &&\n \tgit pull --rebase . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^^ copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -597,10 +597,10 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '\n \techo dirty >>file &&\n \tgit add file &&\n \ttest_must_fail git pull &&\n-\ttest \"$COPY\" = \"$(git rev-parse --verify me/copy)\" &&\n+\ttest_cmp_rev \"$COPY\" me/copy &&\n \tgit checkout HEAD -- file &&\n \tgit pull &&\n-\ttest \"$COPY\" != \"$(git rev-parse --verify me/copy)\"\n+\ttest_cmp_rev ! \"$COPY\" me/copy\n '\n \n test_expect_success 'pull --rebase works on branch yet to be born' '\n-- \n2.24.0.rc2.262.g2d07a97ef5\n\n"},{"id":"385725","messageId":"6cb78bce4061455cdbf2cad7672c4e9c2bb188ac.1573152599.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573152598.git.liu.denton@gmail.com","subject":"[PATCH v4 10/14] t5520: test single-line files by git with test_cmp","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-07T18:51:41Z","receivedAt":"2019-11-07T18:51:48Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"In case an invocation of a Git command fails within the subshell, the\nfailure will be masked. Replace the subshell with a file-redirection and\na call to test_cmp.\n\nThis change was done with the following GNU sed expressions:\n\n\ts/\\(\\s*\\)test \\([^ ]*\\) = \"$(\\(git [^)]*\\))\"/\\1echo \\2 >expect \\&\\&\\n\\1\\3 >actual \\&\\&\\n\\1test_cmp expect actual/\n\ts/\\(\\s*\\)test \"$(\\(git [^)]*\\))\" = \\([^ ]*\\)/\\1echo \\3 >expect \\&\\&\\n\\1\\2 >actual \\&\\&\\n\\1test_cmp expect actual/\n\nA future patch will clean up situations where we have multiple duplicate\nstatements within a test case. This is done to keep this patch purely\nmechanical.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 64 ++++++++++++++++++++++++++++++++++++-------------\n 1 file changed, 48 insertions(+), 16 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 1af6ea06ee..8b7e7ae55d 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -255,7 +255,9 @@ test_expect_success '--rebase' '\n \tgit tag before-rebase &&\n \tgit pull --rebase . copy &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\"\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success '--rebase fast forward' '\n@@ -330,7 +332,9 @@ test_expect_success '--rebase fails with multiple branches' '\n \ttest_must_fail git pull --rebase . copy master 2>err &&\n \ttest_cmp_rev HEAD before-rebase &&\n \ttest_i18ngrep \"Cannot rebase onto multiple branches\" err &&\n-\ttest modified = \"$(git show HEAD:file)\"\n+\techo modified >expect &&\n+\tgit show HEAD:file >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'pull --rebase succeeds with dirty working directory and rebase.autostash set' '\n@@ -381,7 +385,9 @@ test_expect_success 'pull.rebase' '\n \ttest_config pull.rebase true &&\n \tgit pull . copy &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\"\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'pull --autostash & pull.rebase=true' '\n@@ -399,7 +405,9 @@ test_expect_success 'branch.to-rebase.rebase' '\n \ttest_config branch.to-rebase.rebase true &&\n \tgit pull . copy &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\"\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n@@ -408,14 +416,18 @@ test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n \ttest_config branch.to-rebase.rebase false &&\n \tgit pull . copy &&\n \ttest_cmp_rev ! HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\"\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'pull --rebase warns on --verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --verify-signatures . copy 2>err &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\" &&\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual &&\n \ttest_i18ngrep \"ignoring --verify-signatures for rebase\" err\n '\n \n@@ -423,7 +435,9 @@ test_expect_success 'pull --rebase does not warn on --no-verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --no-verify-signatures . copy 2>err &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\" &&\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual &&\n \ttest_i18ngrep ! \"verify-signatures\" err\n '\n \n@@ -445,7 +459,9 @@ test_expect_success 'pull.rebase=false create a new merge commit' '\n \tgit pull . copy &&\n \ttest_cmp_rev HEAD^1 before-preserve-rebase &&\n \ttest_cmp_rev HEAD^2 copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'pull.rebase=true flattens keep-merge' '\n@@ -453,7 +469,9 @@ test_expect_success 'pull.rebase=true flattens keep-merge' '\n \ttest_config pull.rebase true &&\n \tgit pull . copy &&\n \ttest_cmp_rev HEAD^^ copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' '\n@@ -461,7 +479,9 @@ test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' '\n \ttest_config pull.rebase 1 &&\n \tgit pull . copy &&\n \ttest_cmp_rev HEAD^^ copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success REBASE_P \\\n@@ -507,7 +527,9 @@ test_expect_success '--rebase=false create a new merge commit' '\n \tgit pull --rebase=false . copy &&\n \ttest_cmp_rev HEAD^1 before-preserve-rebase &&\n \ttest_cmp_rev HEAD^2 copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success '--rebase=true rebases and flattens keep-merge' '\n@@ -515,7 +537,9 @@ test_expect_success '--rebase=true rebases and flattens keep-merge' '\n \ttest_config pull.rebase preserve &&\n \tgit pull --rebase=true . copy &&\n \ttest_cmp_rev HEAD^^ copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success REBASE_P \\\n@@ -537,7 +561,9 @@ test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-m\n \ttest_config pull.rebase preserve &&\n \tgit pull --rebase . copy &&\n \ttest_cmp_rev HEAD^^ copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success '--rebase with rebased upstream' '\n@@ -622,10 +648,16 @@ test_expect_success 'pull --rebase fails on unborn branch with staged changes' '\n \t\tcd empty_repo2 &&\n \t\techo staged-file >staged-file &&\n \t\tgit add staged-file &&\n-\t\ttest \"$(git ls-files)\" = staged-file &&\n+\t\techo staged-file >expect &&\n+\t\tgit ls-files >actual &&\n+\t\ttest_cmp expect actual &&\n \t\ttest_must_fail git pull --rebase .. master 2>err &&\n-\t\ttest \"$(git ls-files)\" = staged-file &&\n-\t\ttest \"$(git show :staged-file)\" = staged-file &&\n+\t\techo staged-file >expect &&\n+\t\tgit ls-files >actual &&\n+\t\ttest_cmp expect actual &&\n+\t\techo staged-file >expect &&\n+\t\tgit show :staged-file >actual &&\n+\t\ttest_cmp expect actual &&\n \t\ttest_i18ngrep \"unborn branch with changes added to the index\" err\n \t)\n '\n-- \n2.24.0.rc2.262.g2d07a97ef5\n\n"},{"id":"385726","messageId":"acbfc39cb0c99a979e198cdfc35259bbf13ae06d.1573152599.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573152598.git.liu.denton@gmail.com","subject":"[PATCH v4 11/14] t5520: don't put git in upstream of pipe","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-07T18:51:43Z","receivedAt":"2019-11-07T18:51:49Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Before, if the invocation of git failed, it would be masked by the pipe\nsince only the return code of the last element of a pipe is used.\nRewrite the test to put the Git command on its own line so its return\ncode is not masked.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 8b7e7ae55d..8ddf89e550 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -668,7 +668,8 @@ test_expect_success 'pull --rebase fails on corrupt HEAD' '\n \t(\n \t\tcd corrupt &&\n \t\ttest_commit one &&\n-\t\tobj=$(git rev-parse --verify HEAD | sed \"s#^..#&/#\") &&\n+\t\tgit rev-parse --verify HEAD >head &&\n+\t\tobj=$(sed \"s#^..#&/#\" head) &&\n \t\trm -f .git/objects/$obj &&\n \t\ttest_must_fail git pull --rebase\n \t)\n-- \n2.24.0.rc2.262.g2d07a97ef5\n\n"},{"id":"385727","messageId":"bb529ad84ac23ca9015d1b6b18b8804c83f6b93f.1573152599.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573152598.git.liu.denton@gmail.com","subject":"[PATCH v4 12/14] t5520: replace subshell cat comparison with test_cmp","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-07T18:51:46Z","receivedAt":"2019-11-07T18:51:51Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"We currently have many instances of `test <line> = $(cat <file>)` and\n`test $(cat <file>) = <line>`.  In the case where this fails, it will be\ndifficult for a developer to debug since the output will be masked.\nReplace these instances with invocations of test_cmp().\n\nThis change was done with the following GNU sed expressions:\n\n\ts/\\(\\s*\\)test \\([^=]*\\)= \"$(cat \\([^)]*\\))\"/\\1echo \\2>expect \\&\\&\\n\\1test_cmp expect \\3/\n\ts/\\(\\s*\\)test \"$(cat \\([^)]*\\))\" = \\([^&]*\\)\\( &&\\)\\?$/\\1echo \\3 >expect \\&\\&\\n\\1test_cmp expect \\2\\4/\n\nA future patch will clean up situations where we have multiple duplicate\nstatements within a test case. This is done to keep this patch purely\nmechanical.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 105 ++++++++++++++++++++++++++++++++----------------\n 1 file changed, 70 insertions(+), 35 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 8ddf89e550..c9e4eec004 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -15,8 +15,10 @@ test_pull_autostash () {\n \tgit add new_file &&\n \tgit pull \"$@\" . copy &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest \"$(cat new_file)\" = dirty &&\n-\ttest \"$(cat file)\" = \"modified again\"\n+\techo dirty >expect &&\n+\ttest_cmp expect new_file &&\n+\techo \"modified again\" >expect &&\n+\ttest_cmp expect file\n }\n \n test_pull_autostash_fail () {\n@@ -110,9 +112,11 @@ test_expect_success 'test . as a remote' '\n \techo updated >file &&\n \tgit commit -a -m updated &&\n \tgit checkout copy &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \tgit pull &&\n-\ttest \"$(cat file)\" = updated &&\n+\techo updated >expect &&\n+\ttest_cmp expect file &&\n \tgit reflog -1 >reflog.actual &&\n \tsed \"s/^[0-9a-f][0-9a-f]*/OBJID/\" reflog.actual >reflog.fuzzy &&\n \techo \"OBJID HEAD@{0}: pull: Fast-forward\" >reflog.expected &&\n@@ -125,9 +129,11 @@ test_expect_success 'the default remote . should not break explicit pull' '\n \tgit commit -a -m modified &&\n \tgit checkout copy &&\n \tgit reset --hard HEAD^ &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \tgit pull . second &&\n-\ttest \"$(cat file)\" = modified &&\n+\techo modified >expect &&\n+\ttest_cmp expect file &&\n \tgit reflog -1 >reflog.actual &&\n \tsed \"s/^[0-9a-f][0-9a-f]*/OBJID/\" reflog.actual >reflog.fuzzy &&\n \techo \"OBJID HEAD@{0}: pull . second: Fast-forward\" >reflog.expected &&\n@@ -137,10 +143,12 @@ test_expect_success 'the default remote . should not break explicit pull' '\n test_expect_success 'fail if wildcard spec does not match any refs' '\n \tgit checkout -b test copy^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_must_fail git pull . \"refs/nonexisting1/*:refs/nonexisting2/*\" 2>err &&\n \ttest_i18ngrep \"no candidates for merging\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'fail if no branches specified with non-default remote' '\n@@ -148,11 +156,13 @@ test_expect_success 'fail if no branches specified with non-default remote' '\n \ttest_when_finished \"git remote remove test_remote\" &&\n \tgit checkout -b test copy^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_config branch.test.remote origin &&\n \ttest_must_fail git pull test_remote 2>err &&\n \ttest_i18ngrep \"specify a branch on the command line\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'fail if not on a branch' '\n@@ -160,10 +170,12 @@ test_expect_success 'fail if not on a branch' '\n \ttest_when_finished \"git remote remove origin\" &&\n \tgit checkout HEAD^ &&\n \ttest_when_finished \"git checkout -f copy\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"not currently on a branch\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'fail if no configuration for current branch' '\n@@ -172,10 +184,12 @@ test_expect_success 'fail if no configuration for current branch' '\n \tgit checkout -b test copy^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n \ttest_config branch.test.remote test_remote &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"no tracking information\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'pull --all: fail if no configuration for current branch' '\n@@ -184,10 +198,12 @@ test_expect_success 'pull --all: fail if no configuration for current branch' '\n \tgit checkout -b test copy^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n \ttest_config branch.test.remote test_remote &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_must_fail git pull --all 2>err &&\n \ttest_i18ngrep \"There is no tracking information\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'fail if upstream branch does not exist' '\n@@ -195,16 +211,19 @@ test_expect_success 'fail if upstream branch does not exist' '\n \ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n \ttest_config branch.test.remote . &&\n \ttest_config branch.test.merge refs/heads/nonexisting &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"no such ref was fetched\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'fail if the index has unresolved entries' '\n \tgit checkout -b third second^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D third\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_commit modified2 file &&\n \tgit ls-files -u >unmerged &&\n \ttest_must_be_empty unmerged &&\n@@ -226,21 +245,25 @@ test_expect_success 'fail if the index has unresolved entries' '\n test_expect_success 'fast-forwards working tree if branch head is updated' '\n \tgit checkout -b third second^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D third\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \tgit pull . second:third 2>err &&\n \ttest_i18ngrep \"fetch updated the current branch head\" err &&\n-\ttest \"$(cat file)\" = modified &&\n+\techo modified >expect &&\n+\ttest_cmp expect file &&\n \ttest_cmp_rev third second\n '\n \n test_expect_success 'fast-forward fails with conflicting work tree' '\n \tgit checkout -b third second^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D third\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \techo conflict >file &&\n \ttest_must_fail git pull . second:third 2>err &&\n \ttest_i18ngrep \"Cannot fast-forward your working tree\" err &&\n-\ttest \"$(cat file)\" = conflict &&\n+\techo conflict >expect &&\n+\ttest_cmp expect file &&\n \ttest_cmp_rev third second\n '\n \n@@ -501,7 +524,8 @@ test_expect_success 'pull.rebase=interactive' '\n \ttest_set_editor \"$TRASH_DIRECTORY/fake-editor\" &&\n \ttest_when_finished \"test_might_fail git rebase --abort\" &&\n \ttest_must_fail git pull --rebase=interactive . copy &&\n-\ttest \"I was here\" = \"$(cat fake.out)\"\n+\techo \"I was here\" >expect &&\n+\ttest_cmp expect fake.out\n '\n \n test_expect_success 'pull --rebase=i' '\n@@ -512,7 +536,8 @@ test_expect_success 'pull --rebase=i' '\n \ttest_set_editor \"$TRASH_DIRECTORY/fake-editor\" &&\n \ttest_when_finished \"test_might_fail git rebase --abort\" &&\n \ttest_must_fail git pull --rebase=i . copy &&\n-\ttest \"I was here, too\" = \"$(cat fake.out)\"\n+\techo \"I was here, too\" >expect &&\n+\ttest_cmp expect fake.out\n '\n \n test_expect_success 'pull.rebase=invalid fails' '\n@@ -578,16 +603,20 @@ test_expect_success '--rebase with rebased upstream' '\n \tgit commit -m to-rebase file2 &&\n \tgit tag to-rebase-orig &&\n \tgit pull --rebase me copy &&\n-\ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = \"$(cat file2)\"\n+\techo \"conflicting modification\" >expect &&\n+\ttest_cmp expect file &&\n+\techo file >expect &&\n+\ttest_cmp expect file2\n '\n \n test_expect_success '--rebase -f with rebased upstream' '\n \ttest_when_finished \"test_might_fail git rebase --abort\" &&\n \tgit reset --hard to-rebase-orig &&\n \tgit pull --rebase -f me copy &&\n-\ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = \"$(cat file2)\"\n+\techo \"conflicting modification\" >expect &&\n+\ttest_cmp expect file &&\n+\techo file >expect &&\n+\ttest_cmp expect file2\n '\n \n test_expect_success '--rebase with rebased default upstream' '\n@@ -595,8 +624,10 @@ test_expect_success '--rebase with rebased default upstream' '\n \tgit checkout --track -b to-rebase2 me/copy &&\n \tgit reset --hard to-rebase-orig &&\n \tgit pull --rebase &&\n-\ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = \"$(cat file2)\"\n+\techo \"conflicting modification\" >expect &&\n+\ttest_cmp expect file &&\n+\techo file >expect &&\n+\ttest_cmp expect file2\n '\n \n test_expect_success 'rebased upstream + fetch + pull --rebase' '\n@@ -607,8 +638,10 @@ test_expect_success 'rebased upstream + fetch + pull --rebase' '\n \tgit reset --hard to-rebase-orig &&\n \tgit fetch &&\n \tgit pull --rebase &&\n-\ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = \"$(cat file2)\"\n+\techo \"conflicting modification\" >expect &&\n+\ttest_cmp expect file &&\n+\techo file >expect &&\n+\ttest_cmp expect file2\n \n '\n \n@@ -744,8 +777,10 @@ test_expect_success 'git pull --rebase does not reapply old patches' '\n test_expect_success 'git pull --rebase against local branch' '\n \tgit checkout -b copy2 to-rebase-orig &&\n \tgit pull --rebase . to-rebase &&\n-\ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = \"$(cat file2)\"\n+\techo \"conflicting modification\" >expect &&\n+\ttest_cmp expect file &&\n+\techo file >expect &&\n+\ttest_cmp expect file2\n '\n \n test_done\n-- \n2.24.0.rc2.262.g2d07a97ef5\n\n"},{"id":"385728","messageId":"d08e34b02119564dbcffc43d3d7cc7561973acfd.1573152599.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573152598.git.liu.denton@gmail.com","subject":"[PATCH v4 13/14] t5520: remove redundant lines in test cases","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-07T18:51:48Z","receivedAt":"2019-11-07T18:51:54Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"In the previous patches, the mechanical application of changes left some\nduplicate statements in the test case which were not strictly incorrect\nbut were redundant and possibly misleading. Remove these duplicate\nstatements so that it is clear that the intent behind the tests are that\nthe content of the file stays the same throughout the whole test case.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 8 --------\n 1 file changed, 8 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex c9e4eec004..ef3dbc201a 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -147,7 +147,6 @@ test_expect_success 'fail if wildcard spec does not match any refs' '\n \ttest_cmp expect file &&\n \ttest_must_fail git pull . \"refs/nonexisting1/*:refs/nonexisting2/*\" 2>err &&\n \ttest_i18ngrep \"no candidates for merging\" err &&\n-\techo file >expect &&\n \ttest_cmp expect file\n '\n \n@@ -161,7 +160,6 @@ test_expect_success 'fail if no branches specified with non-default remote' '\n \ttest_config branch.test.remote origin &&\n \ttest_must_fail git pull test_remote 2>err &&\n \ttest_i18ngrep \"specify a branch on the command line\" err &&\n-\techo file >expect &&\n \ttest_cmp expect file\n '\n \n@@ -174,7 +172,6 @@ test_expect_success 'fail if not on a branch' '\n \ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"not currently on a branch\" err &&\n-\techo file >expect &&\n \ttest_cmp expect file\n '\n \n@@ -188,7 +185,6 @@ test_expect_success 'fail if no configuration for current branch' '\n \ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"no tracking information\" err &&\n-\techo file >expect &&\n \ttest_cmp expect file\n '\n \n@@ -202,7 +198,6 @@ test_expect_success 'pull --all: fail if no configuration for current branch' '\n \ttest_cmp expect file &&\n \ttest_must_fail git pull --all 2>err &&\n \ttest_i18ngrep \"There is no tracking information\" err &&\n-\techo file >expect &&\n \ttest_cmp expect file\n '\n \n@@ -215,7 +210,6 @@ test_expect_success 'fail if upstream branch does not exist' '\n \ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"no such ref was fetched\" err &&\n-\techo file >expect &&\n \ttest_cmp expect file\n '\n \n@@ -685,10 +679,8 @@ test_expect_success 'pull --rebase fails on unborn branch with staged changes' '\n \t\tgit ls-files >actual &&\n \t\ttest_cmp expect actual &&\n \t\ttest_must_fail git pull --rebase .. master 2>err &&\n-\t\techo staged-file >expect &&\n \t\tgit ls-files >actual &&\n \t\ttest_cmp expect actual &&\n-\t\techo staged-file >expect &&\n \t\tgit show :staged-file >actual &&\n \t\ttest_cmp expect actual &&\n \t\ttest_i18ngrep \"unborn branch with changes added to the index\" err\n-- \n2.24.0.rc2.262.g2d07a97ef5\n\n"},{"id":"385729","messageId":"70698bd9020ee896def07c36981767e331d2047a.1573152599.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573152598.git.liu.denton@gmail.com","subject":"[PATCH v4 14/14] t5520: replace `! git` with `test_must_fail git`","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-07T18:51:52Z","receivedAt":"2019-11-07T18:51:56Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Currently, if a Git command fails in an unexpected way, such as a\nsegfault, it will be masked and ignored. Replace the ! with\ntest_must_fail so that only expected failures pass.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex ef3dbc201a..602d996a33 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -537,7 +537,7 @@ test_expect_success 'pull --rebase=i' '\n test_expect_success 'pull.rebase=invalid fails' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase invalid &&\n-\t! git pull . copy\n+\ttest_must_fail git pull . copy\n '\n \n test_expect_success '--rebase=false create a new merge commit' '\n@@ -572,7 +572,7 @@ test_expect_success REBASE_P \\\n \n test_expect_success '--rebase=invalid fails' '\n \tgit reset --hard before-preserve-rebase &&\n-\t! git pull --rebase=invalid . copy\n+\ttest_must_fail git pull --rebase=invalid . copy\n '\n \n test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-merge' '\n-- \n2.24.0.rc2.262.g2d07a97ef5\n\n"},{"id":"385751","messageId":"xmqqpni3nj8j.fsf@gitster-ct.c.googlers.com","threadId":"52061","inReplyTo":"0d0696f310a6f8e13ed480b1a1e91cdc2debaa20.1573152599.git.liu.denton@gmail.com","subject":"Re: [PATCH v4 01/14] t: teach test_cmp_rev to accept ! for not-equals","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-11-08T03:24:12Z","receivedAt":"2019-11-08T03:24:21Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Denton Liu <liu.denton@gmail.com> writes:\n\n> Currently, in the case where we are using test_cmp_rev() to report\n> not-equals, we write `! test_cmp_rev`. However, since test_cmp_rev()\n> contains\n>\n> \tr1=$(git rev-parse --verify \"$1\") &&\n> \tr2=$(git rev-parse --verify \"$2\") &&\n>\n> In the case where `git rev-parse` segfaults and dies unexpectedly, the\n> failure will be ignored.\n\nGood justification.  The last two lines are continuation of the\nsentence that begins the proposed log message, so downcase \"In\" at\nthe beginning of the line.  Also, when we present the problem to be\nsolved at the beginning, it is customary to describe the status quo,\nand \"Currently, \" is a noiseword that does not add much information,\nso drop it.\n\n> Rewrite test_cmp_rev() to optionally accept \"!\" as the first argument to\n> do a not-equals comparison. Rewrite `! test_cmp_rev` to `test_cmp_rev !`\n> in all tests to take advantage of this new functionality.\n\nGood.\n\n> -# Tests that its two parameters refer to the same revision\n> +# Tests that its two parameters refer to the same revision, or if '!' is\n> +# provided first, that its other two parameters refer to different\n> +# revisions.\n\nOK.\n\n>  test_cmp_rev () {\n> +\tlocal inverted_op\n> +\tinverted_op='!='\n> +\tif test $# -ge 1 && test \"x$1\" = 'x!'\n> +\tthen\n> +\t    inverted_op='='\n> +\t    shift\n> +\tfi\n\nI'd rather avoid having to keep track of negation to reduce mental\nburden.  How about using = by default and != when '!' was given\n(which would be more natural to readers) and call it $op, and say\n\"if ! test $r1 $op $r2\" where it is used?\n\n\n>  \tif test $# != 2\n>  \tthen\n>  \t\terror \"bug in the test script: test_cmp_rev requires two revisions, but got $#\"\n>  \telse\n>  \t\tlocal r1 r2\n>  \t\tr1=$(git rev-parse --verify \"$1\") &&\n>  \t\tr2=$(git rev-parse --verify \"$2\") &&\n\nIf either of the calls fail, the assignment itself would fail, and\nthe &&-cascade would stop without executing the if statment below.\n\nI see the \"!\" feature, but where is the promised \"fix\" for\nsegfaulting rev-parse?\n\nPuzzled.\n\n\n> -\t\tif test \"$r1\" != \"$r2\"\n> +\t\tif test \"$r1\" \"$inverted_op\" \"$r2\"\n>  \t\tthen\n> +\t\t\tlocal comp_out\n> +\t\t\tif \"x$inverted_op\" = 'x='\n> +\t\t\tthen\n> +\t\t\t\tcomp_out='the same'\n> +\t\t\telse\n> +\t\t\t\tcomp_out='different'\n> +\t\t\tfi\n>  \t\t\tcat >&4 <<-EOF\n> -\t\t\terror: two revisions point to different objects:\n> +\t\t\terror: two revisions point to $comp_out objects:\n>  \t\t\t  '$1': $r1\n>  \t\t\t  '$2': $r2\n>  \t\t\tEOF\n>  \t\t\treturn 1\n>  \t\tfi\n>  \tfi\n>  }\n"},{"id":"385763","messageId":"20191108082310.GA2497@generichostname","threadId":"52061","inReplyTo":"xmqqpni3nj8j.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH v4 01/14] t: teach test_cmp_rev to accept ! for not-equals","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-08T08:23:10Z","receivedAt":"2019-11-08T08:23:16Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"On Fri, Nov 08, 2019 at 12:24:12PM +0900, Junio C Hamano wrote:\n> Denton Liu <liu.denton@gmail.com> writes:\n> \n> > Currently, in the case where we are using test_cmp_rev() to report\n> > not-equals, we write `! test_cmp_rev`. However, since test_cmp_rev()\n> > contains\n> >\n> > \tr1=$(git rev-parse --verify \"$1\") &&\n> > \tr2=$(git rev-parse --verify \"$2\") &&\n> >\n> > In the case where `git rev-parse` segfaults and dies unexpectedly, the\n> > failure will be ignored.\n\nI'll probably reword this to\n\n\tIn the case where we are using test_cmp_rev() to report\n\tnot-equals, we write `! test_cmp_rev`. However, since\n\ttest_cmp_rev() contains\n\n\t\tr1=$(git rev-parse --verify \"$1\") &&\n\t\tr2=$(git rev-parse --verify \"$2\") &&\n\n\t`! test_cmp_rev` will succeed if any of the rev-parses fail.\n\tThis behavior is not desired. We want the rev-parses to _always_\n\tbe successful.\n\nbecause of your puzzlement below.\n\n> \n> Good justification.  The last two lines are continuation of the\n> sentence that begins the proposed log message, so downcase \"In\" at\n> the beginning of the line.  Also, when we present the problem to be\n> solved at the beginning, it is customary to describe the status quo,\n> and \"Currently, \" is a noiseword that does not add much information,\n> so drop it.\n\nThanks, I'll make a note to stop doing this in future patches as well.\n\n[...]\n\n> \n> >  test_cmp_rev () {\n> > +\tlocal inverted_op\n> > +\tinverted_op='!='\n> > +\tif test $# -ge 1 && test \"x$1\" = 'x!'\n> > +\tthen\n> > +\t    inverted_op='='\n> > +\t    shift\n> > +\tfi\n> \n> I'd rather avoid having to keep track of negation to reduce mental\n> burden.  How about using = by default and != when '!' was given\n> (which would be more natural to readers) and call it $op, and say\n> \"if ! test $r1 $op $r2\" where it is used?\n\nGood idea, I felt a little uneasy doing the inverted thing but it never\noccurred to me to just negate the return code of `test`.\n\n> \n> \n> >  \tif test $# != 2\n> >  \tthen\n> >  \t\terror \"bug in the test script: test_cmp_rev requires two revisions, but got $#\"\n> >  \telse\n> >  \t\tlocal r1 r2\n> >  \t\tr1=$(git rev-parse --verify \"$1\") &&\n> >  \t\tr2=$(git rev-parse --verify \"$2\") &&\n> \n> If either of the calls fail, the assignment itself would fail, and\n> the &&-cascade would stop without executing the if statment below.\n> \n> I see the \"!\" feature, but where is the promised \"fix\" for\n> segfaulting rev-parse?\n> \n> Puzzled.\n\nI suppose your puzzlement comes from my badly worded commit message\nabove. I meant to say that in the _hypothetical_ case that \n`git rev-parse` segfaults, it wouldn't be caught because we're\nblanket-ignoring failures if we do `! test_cmp_rev`.\n\nBut I suppose I focused too much on segfaults. I guess I didn't realise\nthat the problem is more general than that; any failure of \n`git rev-parse` should be reported.\n\nThanks for the review,\n\nDenton\n"},{"id":"385782","messageId":"xmqqa796mt35.fsf@gitster-ct.c.googlers.com","threadId":"52061","inReplyTo":"20191108082310.GA2497@generichostname","subject":"Re: [PATCH v4 01/14] t: teach test_cmp_rev to accept ! for not-equals","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-11-08T12:49:02Z","receivedAt":"2019-11-08T12:49:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Denton Liu <liu.denton@gmail.com> writes:\n\n>> >  \t\tlocal r1 r2\n>> >  \t\tr1=$(git rev-parse --verify \"$1\") &&\n>> >  \t\tr2=$(git rev-parse --verify \"$2\") &&\n>> \n>> If either of the calls fail, the assignment itself would fail, and\n>> the &&-cascade would stop without executing the if statment below.\n>> \n>> I see the \"!\" feature, but where is the promised \"fix\" for\n>> segfaulting rev-parse?\n>> \n>> Puzzled.\n>\n> I suppose your puzzlement comes from my badly worded commit message\n> above. I meant to say that in the _hypothetical_ case that \n> `git rev-parse` segfaults, it wouldn't be caught because we're\n> blanket-ignoring failures if we do `! test_cmp_rev`.\n>\n> But I suppose I focused too much on segfaults. I guess I didn't realise\n> that the problem is more general than that; any failure of \n> `git rev-parse` should be reported.\n\nBut if that is the case, shouldn't the part that runs two rev-parse\nread more like this?\n\n\tr1=$(git rev-parse --verify \"$1\") ||\n\t\terror \"'$1' does not name a valid object\"\n\tr2=$(git rev-parse --verify \"$2\") ||\n\t\terror \"'$2' does not name a valid object\"\n\tif ! test \"$r1\" $op \"$r2\"\n\tthen\n\t\t... they do not compare the same ...\n\tfi\n\nOffhand I do not know if the current callers depend on being able to\npass a string that is not an object name in either $1 or $2 and a\nvalid object name in the other one, and relying on the helper\nfunction to say \"$1 and $2 are different!\"  If such callers exist, a\ndefensive change like the above that requires the caller to always\npass valid object names would need to be accompanied with changes to\nthese callers, too.  Overall, I think that would give us a better\nend result, but it might be a bit more work.\n\nThanks.\n"},{"id":"385812","messageId":"20191108211909.GA80210@generichostname","threadId":"52061","inReplyTo":"xmqqa796mt35.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH v4 01/14] t: teach test_cmp_rev to accept ! for not-equals","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-08T21:19:09Z","receivedAt":"2019-11-08T21:19:14Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Hi Junio,\n\nOn Fri, Nov 08, 2019 at 09:49:02PM +0900, Junio C Hamano wrote:\n> Denton Liu <liu.denton@gmail.com> writes:\n>\n> >> >  \t\tlocal r1 r2\n> >> >  \t\tr1=$(git rev-parse --verify \"$1\") &&\n> >> >  \t\tr2=$(git rev-parse --verify \"$2\") &&\n> >>\n> >> If either of the calls fail, the assignment itself would fail, and\n> >> the &&-cascade would stop without executing the if statment below.\n> >>\n> >> I see the \"!\" feature, but where is the promised \"fix\" for\n> >> segfaulting rev-parse?\n> >>\n> >> Puzzled.\n> >\n> > I suppose your puzzlement comes from my badly worded commit message\n> > above. I meant to say that in the _hypothetical_ case that\n> > `git rev-parse` segfaults, it wouldn't be caught because we're\n> > blanket-ignoring failures if we do `! test_cmp_rev`.\n> >\n> > But I suppose I focused too much on segfaults. I guess I didn't realise\n> > that the problem is more general than that; any failure of\n> > `git rev-parse` should be reported.\n>\n> But if that is the case, shouldn't the part that runs two rev-parse\n> read more like this?\n>\n> \tr1=$(git rev-parse --verify \"$1\") ||\n> \t\terror \"'$1' does not name a valid object\"\n> \tr2=$(git rev-parse --verify \"$2\") ||\n> \t\terror \"'$2' does not name a valid object\"\n> \tif ! test \"$r1\" $op \"$r2\"\n> \tthen\n> \t\t... they do not compare the same ...\n> \tfi\n\nWith your suggestion, we actually introduce subtle undesired behaviour.\nThe `error` calls don't actually exit the function early. To make it\nwork, we need to add && to the end of the `error` calls.\n\nI'm wondering why we want to do this, though. rev-parse should already\noutput an error message on stderr in the case where the rev-parse fails.\nI guess the error message of \"fatal: Needed a single revision\" could\nprobably be improved but that feels like an improvement that should be\ntargeted to rev-parse.\n\n>\n> Offhand I do not know if the current callers depend on being able to\n> pass a string that is not an object name in either $1 or $2 and a\n> valid object name in the other one, and relying on the helper\n> function to say \"$1 and $2 are different!\"  If such callers exist, a\n> defensive change like the above that requires the caller to always\n> pass valid object names would need to be accompanied with changes to\n> these callers, too.  Overall, I think that would give us a better\n> end result, but it might be a bit more work.\n\nThis patch changes all instances of `! test_cmp_rev` to\n`test_cmp_rev !`. Since nothing failed after applying the patch, I\nbelieve that all callers already pass in valid object names.\n\nThanks,\n\nDenton\n\n>\n> Thanks.\n"},{"id":"385841","messageId":"xmqq8sookyj7.fsf@gitster-ct.c.googlers.com","threadId":"52061","inReplyTo":"20191108211909.GA80210@generichostname","subject":"Re: [PATCH v4 01/14] t: teach test_cmp_rev to accept ! for not-equals","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-11-10T06:58:52Z","receivedAt":"2019-11-10T06:59:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Denton Liu <liu.denton@gmail.com> writes:\n\n> Hi Junio,\n>\n> On Fri, Nov 08, 2019 at 09:49:02PM +0900, Junio C Hamano wrote:\n>> Denton Liu <liu.denton@gmail.com> writes:\n>>\n>> >> >  \t\tlocal r1 r2\n>> >> >  \t\tr1=$(git rev-parse --verify \"$1\") &&\n>> >> >  \t\tr2=$(git rev-parse --verify \"$2\") &&\n>> >>\n>> >> If either of the calls fail, the assignment itself would fail, and\n>> >> the &&-cascade would stop without executing the if statment below.\n>> >>\n>> \tr1=$(git rev-parse --verify \"$1\") ||\n>> \t\terror \"'$1' does not name a valid object\"\n>> \tr2=$(git rev-parse --verify \"$2\") ||\n>> \t\terror \"'$2' does not name a valid object\"\n>> \tif ! test \"$r1\" $op \"$r2\"\n>> \tthen\n>> \t\t... they do not compare the same ...\n>> \tfi\n>\n> With your suggestion, we actually introduce subtle undesired behaviour.\n> The `error` calls don't actually exit the function early. To make it\n> work, we need to add && to the end of the `error` calls.\n\nNot &&-at-the-end, but yes, we'd need some early return after\nnoticing a bad input from the caller.\n\nYou said earlier that one of the issues that motivated you to update\nthe helper was that this obvious typo\n\n\tr1=... r2= ... &&\n\t! test_rev_cmp \"$r1\" \"$rr2\"\n\nwould not be noticed.  For such a fix, I do not think it is\nsufficient to tweak the return value from the test_rev_cmp\nhelper function if we allow callers to expect failure like so.\n\nAnd for that reason, your \"allow 'test_rev_cmp ! R1 R2' syntax\" part\nof the change makes quite a lot of sense.  That again allows the\ncallers to rely on failure return from test_rev_cmp as an error.\n\n> I'm wondering why we want to do this, though. rev-parse should already\n> output an error message on stderr in the case where the rev-parse fails.\n>\n> I guess the error message of \"fatal: Needed a single revision\" could\n> probably be improved but that feels like an improvement that should be\n> targeted to rev-parse.\n\nNot really.  The callers of rev-parse plumbing should expect that\nexact string, if they want to differenciate different errors from\nthe program.\n\n\n\tr1=$(git rev-parse --verify \"$1\") &&\n\tr2=$(git rev-parse --verify \"$2\") || return 1\n\nbefore we start the comparison between $r1 and $r2 may be a good way\nto clarify the intent of the code.  Using \"&&\" instead of \"|| return\"\nand letting the whole function fail would not be incorrect, though.\n\nThanks.\n\n\n"},{"id":"385956","messageId":"cover.1573517561.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573152598.git.liu.denton@gmail.com","subject":"[PATCH v5 00/14] t5520: various test cleanup","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T00:13:38Z","receivedAt":"2019-11-12T00:13:43Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Like earlier patchsets, I want to implement a feature that involves\nmodifications to the test suite. Since that feature will probably take a\nwhile to polish up, however, let's clean up the test suite in a separate\npatchset first so it's not blocked by the feature work.\n\n1/15 is a general improvement to test_rev_cmp() that will be used later\nin the series.\n\nChanges since v4:\n\n* Cleaned up test_cmp_rev() logic with suggestions from Junio\n\nChanges since v3:\n\n* Rebased and tested on top of v2.24.0\n\nChanges since v2:\n\n* Drop 't7408: replace `test_must_fail test_path_is_file`' since it's\n  not a rabbit hole we want to go into right now\n\n* Fix the output of `test_cmp_rev !` when revs are actually equal\n\n* Rebase against the latest master since this topic hasn't been picked\n  up yet\n\nChanges since v1:\n\n* Incorporate Eric's feedback\n\nDenton Liu (14):\n  t: teach test_cmp_rev to accept ! for not-equals\n  t5520: improve test style\n  t5520: use sq for test case names\n  t5520: let sed open its own input\n  t5520: replace test -f with test-lib functions\n  t5520: remove spaces after redirect operator\n  t5520: use test_line_count where possible\n  t5520: replace test -{n,z} with test-lib functions\n  t5520: use test_cmp_rev where possible\n  t5520: test single-line files by git with test_cmp\n  t5520: don't put git in upstream of pipe\n  t5520: replace subshell cat comparison with test_cmp\n  t5520: remove redundant lines in test cases\n  t5520: replace `! git` with `test_must_fail git`\n\n t/t2400-worktree-add.sh             |   4 +-\n t/t3400-rebase.sh                   |   2 +-\n t/t3421-rebase-topology-linear.sh   |   6 +-\n t/t3430-rebase-merges.sh            |   2 +-\n t/t3432-rebase-fast-forward.sh      |   2 +-\n t/t3501-revert-cherry-pick.sh       |   2 +-\n t/t3508-cherry-pick-many-commits.sh |   2 +-\n t/t5520-pull.sh                     | 343 +++++++++++++++++-----------\n t/test-lib-functions.sh             |  25 +-\n 9 files changed, 236 insertions(+), 152 deletions(-)\n\nRange-diff against v4:\n 1:  06f89b85f3 !  1:  3c58df27c4 t: teach test_cmp_rev to accept ! for not-equals\n    @@ Metadata\n      ## Commit message ##\n         t: teach test_cmp_rev to accept ! for not-equals\n     \n    -    Currently, in the case where we are using test_cmp_rev() to report\n    -    not-equals, we write `! test_cmp_rev`. However, since test_cmp_rev()\n    -    contains\n    +    In the case where we are using test_cmp_rev() to report not-equals, we\n    +    write `! test_cmp_rev`. However, since test_cmp_rev() contains\n     \n                 r1=$(git rev-parse --verify \"$1\") &&\n                 r2=$(git rev-parse --verify \"$2\") &&\n     \n    -    In the case where `git rev-parse` segfaults and dies unexpectedly, the\n    -    failure will be ignored.\n    +    `! test_cmp_rev` will succeed if any of the rev-parses fail. This\n    +    behavior is not desired. We want the rev-parses to _always_ be\n    +    successful.\n     \n         Rewrite test_cmp_rev() to optionally accept \"!\" as the first argument to\n         do a not-equals comparison. Rewrite `! test_cmp_rev` to `test_cmp_rev !`\n         in all tests to take advantage of this new functionality.\n     \n    +    Also, rewrite the rev-parse logic to end with a `|| return 1` instead of\n    +    &&-chaining into the rev-comparison logic. This makes it obvious to\n    +    future readers that we explicitly intend on returning early if either of\n    +    the rev-parses fail.\n    +\n         Signed-off-by: Denton Liu <liu.denton@gmail.com>\n     \n      ## t/t2400-worktree-add.sh ##\n    @@ t/test-lib-functions.sh: test_must_be_empty () {\n     +# provided first, that its other two parameters refer to different\n     +# revisions.\n      test_cmp_rev () {\n    -+\tlocal inverted_op\n    -+\tinverted_op='!='\n    ++\tlocal op\n    ++\top='='\n     +\tif test $# -ge 1 && test \"x$1\" = 'x!'\n     +\tthen\n    -+\t    inverted_op='='\n    ++\t    op='!='\n     +\t    shift\n     +\tfi\n      \tif test $# != 2\n      \tthen\n      \t\terror \"bug in the test script: test_cmp_rev requires two revisions, but got $#\"\n    -@@ t/test-lib-functions.sh: test_cmp_rev () {\n    + \telse\n      \t\tlocal r1 r2\n      \t\tr1=$(git rev-parse --verify \"$1\") &&\n    - \t\tr2=$(git rev-parse --verify \"$2\") &&\n    +-\t\tr2=$(git rev-parse --verify \"$2\") &&\n     -\t\tif test \"$r1\" != \"$r2\"\n    -+\t\tif test \"$r1\" \"$inverted_op\" \"$r2\"\n    ++\t\tr2=$(git rev-parse --verify \"$2\") || return 1\n    ++\n    ++\t\tif ! test \"$r1\" \"$op\" \"$r2\"\n      \t\tthen\n     +\t\t\tlocal comp_out\n    -+\t\t\tif \"x$inverted_op\" = 'x='\n    ++\t\t\tif \"x$op\" = 'x='\n     +\t\t\tthen\n    -+\t\t\t\tcomp_out='the same'\n    -+\t\t\telse\n     +\t\t\t\tcomp_out='different'\n    ++\t\t\telse\n    ++\t\t\t\tcomp_out='the same'\n     +\t\t\tfi\n      \t\t\tcat >&4 <<-EOF\n     -\t\t\terror: two revisions point to different objects:\n 2:  11714ca897 =  2:  023e0ccc11 t5520: improve test style\n 3:  2c27c8d60a =  3:  1bb65a59da t5520: use sq for test case names\n 4:  5a196cf136 =  4:  d2fbae6ade t5520: let sed open its own input\n 5:  0c8baddc7d =  5:  1d73546eb6 t5520: replace test -f with test-lib functions\n 6:  2775817d02 =  6:  f1141f244f t5520: remove spaces after redirect operator\n 7:  d71fe3d097 =  7:  5106004e95 t5520: use test_line_count where possible\n 8:  dd16809b68 =  8:  85b444e8a6 t5520: replace test -{n,z} with test-lib functions\n 9:  abfa6539aa =  9:  3d43784391 t5520: use test_cmp_rev where possible\n10:  06cb5c1302 = 10:  2f9052fd94 t5520: test single-line files by git with test_cmp\n11:  f47f11ccfa = 11:  3fd10a58c6 t5520: don't put git in upstream of pipe\n12:  3dfc417670 = 12:  ed78ed75bd t5520: replace subshell cat comparison with test_cmp\n13:  575bd0f0cd = 13:  7888757bd0 t5520: remove redundant lines in test cases\n14:  bd92e3821e = 14:  1bc7ad364f t5520: replace `! git` with `test_must_fail git`\n-- \n2.24.0.300.g722ba42680\n\n"},{"id":"385957","messageId":"3c58df27c4b9f405bfc5c163e36a928a75ce8239.1573517561.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573517561.git.liu.denton@gmail.com","subject":"[PATCH v5 01/14] t: teach test_cmp_rev to accept ! for not-equals","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T00:13:41Z","receivedAt":"2019-11-12T00:13:46Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"In the case where we are using test_cmp_rev() to report not-equals, we\nwrite `! test_cmp_rev`. However, since test_cmp_rev() contains\n\n\tr1=$(git rev-parse --verify \"$1\") &&\n\tr2=$(git rev-parse --verify \"$2\") &&\n\n`! test_cmp_rev` will succeed if any of the rev-parses fail. This\nbehavior is not desired. We want the rev-parses to _always_ be\nsuccessful.\n\nRewrite test_cmp_rev() to optionally accept \"!\" as the first argument to\ndo a not-equals comparison. Rewrite `! test_cmp_rev` to `test_cmp_rev !`\nin all tests to take advantage of this new functionality.\n\nAlso, rewrite the rev-parse logic to end with a `|| return 1` instead of\n&&-chaining into the rev-comparison logic. This makes it obvious to\nfuture readers that we explicitly intend on returning early if either of\nthe rev-parses fail.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t2400-worktree-add.sh             |  4 ++--\n t/t3400-rebase.sh                   |  2 +-\n t/t3421-rebase-topology-linear.sh   |  6 +++---\n t/t3430-rebase-merges.sh            |  2 +-\n t/t3432-rebase-fast-forward.sh      |  2 +-\n t/t3501-revert-cherry-pick.sh       |  2 +-\n t/t3508-cherry-pick-many-commits.sh |  2 +-\n t/test-lib-functions.sh             | 25 +++++++++++++++++++++----\n 8 files changed, 31 insertions(+), 14 deletions(-)\n\ndiff --git a/t/t2400-worktree-add.sh b/t/t2400-worktree-add.sh\nindex e819ba741e..52d476979b 100755\n--- a/t/t2400-worktree-add.sh\n+++ b/t/t2400-worktree-add.sh\n@@ -438,7 +438,7 @@ test_expect_success 'git worktree add does not match remote' '\n \t\tcd foo &&\n \t\ttest_must_fail git config \"branch.foo.remote\" &&\n \t\ttest_must_fail git config \"branch.foo.merge\" &&\n-\t\t! test_cmp_rev refs/remotes/repo_a/foo refs/heads/foo\n+\t\ttest_cmp_rev ! refs/remotes/repo_a/foo refs/heads/foo\n \t)\n '\n \n@@ -483,7 +483,7 @@ test_expect_success 'git worktree --no-guess-remote option overrides config' '\n \t\tcd foo &&\n \t\ttest_must_fail git config \"branch.foo.remote\" &&\n \t\ttest_must_fail git config \"branch.foo.merge\" &&\n-\t\t! test_cmp_rev refs/remotes/repo_a/foo refs/heads/foo\n+\t\ttest_cmp_rev ! refs/remotes/repo_a/foo refs/heads/foo\n \t)\n '\n \ndiff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh\nindex ab18ac5f28..f267f6cd54 100755\n--- a/t/t3400-rebase.sh\n+++ b/t/t3400-rebase.sh\n@@ -64,7 +64,7 @@ test_expect_success 'rebase sets ORIG_HEAD to pre-rebase state' '\n \tpre=\"$(git rev-parse --verify HEAD)\" &&\n \tgit rebase master &&\n \ttest_cmp_rev \"$pre\" ORIG_HEAD &&\n-\t! test_cmp_rev \"$pre\" HEAD\n+\ttest_cmp_rev ! \"$pre\" HEAD\n '\n \n test_expect_success 'rebase, with <onto> and <upstream> specified as :/quuxery' '\ndiff --git a/t/t3421-rebase-topology-linear.sh b/t/t3421-rebase-topology-linear.sh\nindex b847064f91..325072b0a3 100755\n--- a/t/t3421-rebase-topology-linear.sh\n+++ b/t/t3421-rebase-topology-linear.sh\n@@ -61,7 +61,7 @@ test_run_rebase () {\n \ttest_expect_$result \"rebase $* -f rewrites even if upstream is an ancestor\" \"\n \t\treset_rebase &&\n \t\tgit rebase $* -f b e &&\n-\t\t! test_cmp_rev e HEAD &&\n+\t\ttest_cmp_rev ! e HEAD &&\n \t\ttest_cmp_rev b HEAD~2 &&\n \t\ttest_linear_range 'd e' b..\n \t\"\n@@ -78,7 +78,7 @@ test_run_rebase () {\n \ttest_expect_$result \"rebase $* -f rewrites even if remote upstream is an ancestor\" \"\n \t\treset_rebase &&\n \t\tgit rebase $* -f branch-b branch-e &&\n-\t\t! test_cmp_rev branch-e origin/branch-e &&\n+\t\ttest_cmp_rev ! branch-e origin/branch-e &&\n \t\ttest_cmp_rev branch-b HEAD~2 &&\n \t\ttest_linear_range 'd e' branch-b..\n \t\"\n@@ -368,7 +368,7 @@ test_run_rebase () {\n \ttest_expect_$result \"rebase $* -f --root on linear history causes re-write\" \"\n \t\treset_rebase &&\n \t\tgit rebase $* -f --root c &&\n-\t\t! test_cmp_rev a HEAD~2 &&\n+\t\ttest_cmp_rev ! a HEAD~2 &&\n \t\ttest_linear_range 'a b c' HEAD\n \t\"\n }\ndiff --git a/t/t3430-rebase-merges.sh b/t/t3430-rebase-merges.sh\nindex 9efcf4808a..abbdc26b1b 100755\n--- a/t/t3430-rebase-merges.sh\n+++ b/t/t3430-rebase-merges.sh\n@@ -346,7 +346,7 @@ test_expect_success 'A root commit can be a cousin, treat it that way' '\n \tgit merge --allow-unrelated-histories khnum &&\n \ttest_tick &&\n \tgit rebase -f -r HEAD^ &&\n-\t! test_cmp_rev HEAD^2 khnum &&\n+\ttest_cmp_rev ! HEAD^2 khnum &&\n \ttest_cmp_graph HEAD^.. <<-\\EOF &&\n \t*   Merge branch '\\''khnum'\\'' into asherah\n \t|\\\ndiff --git a/t/t3432-rebase-fast-forward.sh b/t/t3432-rebase-fast-forward.sh\nindex 034ffc7e76..92f95b57da 100755\n--- a/t/t3432-rebase-fast-forward.sh\n+++ b/t/t3432-rebase-fast-forward.sh\n@@ -64,7 +64,7 @@ test_rebase_same_head_ () {\n \t\t\ttest_cmp_rev \\$oldhead \\$newhead\n \t\telif test $cmp = diff\n \t\tthen\n-\t\t\t! test_cmp_rev \\$oldhead \\$newhead\n+\t\t\ttest_cmp_rev ! \\$oldhead \\$newhead\n \t\tfi\n \t\"\n }\ndiff --git a/t/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh\nindex d1c68af8c5..1c51a9131d 100755\n--- a/t/t3501-revert-cherry-pick.sh\n+++ b/t/t3501-revert-cherry-pick.sh\n@@ -106,7 +106,7 @@ test_expect_success 'cherry-pick on unborn branch' '\n \trm -rf * &&\n \tgit cherry-pick initial &&\n \tgit diff --quiet initial &&\n-\t! test_cmp_rev initial HEAD\n+\ttest_cmp_rev ! initial HEAD\n '\n \n test_expect_success 'cherry-pick \"-\" to pick from previous branch' '\ndiff --git a/t/t3508-cherry-pick-many-commits.sh b/t/t3508-cherry-pick-many-commits.sh\nindex b457333e18..23070a7b73 100755\n--- a/t/t3508-cherry-pick-many-commits.sh\n+++ b/t/t3508-cherry-pick-many-commits.sh\n@@ -5,7 +5,7 @@ test_description='test cherry-picking many commits'\n . ./test-lib.sh\n \n check_head_differs_from() {\n-\t! test_cmp_rev HEAD \"$1\"\n+\ttest_cmp_rev ! HEAD \"$1\"\n }\n \n check_head_equals() {\ndiff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh\nindex b299ecc326..01cdbb0478 100644\n--- a/t/test-lib-functions.sh\n+++ b/t/test-lib-functions.sh\n@@ -1012,19 +1012,36 @@ test_must_be_empty () {\n \tfi\n }\n \n-# Tests that its two parameters refer to the same revision\n+# Tests that its two parameters refer to the same revision, or if '!' is\n+# provided first, that its other two parameters refer to different\n+# revisions.\n test_cmp_rev () {\n+\tlocal op\n+\top='='\n+\tif test $# -ge 1 && test \"x$1\" = 'x!'\n+\tthen\n+\t    op='!='\n+\t    shift\n+\tfi\n \tif test $# != 2\n \tthen\n \t\terror \"bug in the test script: test_cmp_rev requires two revisions, but got $#\"\n \telse\n \t\tlocal r1 r2\n \t\tr1=$(git rev-parse --verify \"$1\") &&\n-\t\tr2=$(git rev-parse --verify \"$2\") &&\n-\t\tif test \"$r1\" != \"$r2\"\n+\t\tr2=$(git rev-parse --verify \"$2\") || return 1\n+\n+\t\tif ! test \"$r1\" \"$op\" \"$r2\"\n \t\tthen\n+\t\t\tlocal comp_out\n+\t\t\tif \"x$op\" = 'x='\n+\t\t\tthen\n+\t\t\t\tcomp_out='different'\n+\t\t\telse\n+\t\t\t\tcomp_out='the same'\n+\t\t\tfi\n \t\t\tcat >&4 <<-EOF\n-\t\t\terror: two revisions point to different objects:\n+\t\t\terror: two revisions point to $comp_out objects:\n \t\t\t  '$1': $r1\n \t\t\t  '$2': $r2\n \t\t\tEOF\n-- \n2.24.0.300.g722ba42680\n\n"},{"id":"385958","messageId":"023e0ccc111e81211f65143052e2c145355b95d7.1573517561.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573517561.git.liu.denton@gmail.com","subject":"[PATCH v5 02/14] t5520: improve test style","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T00:13:44Z","receivedAt":"2019-11-12T00:13:48Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Improve the test style by removing leading and trailing empty lines\nwithin test cases. Also, reformat multi-line subshells to conform to the\nexisting style.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 88 +++++++++++++++++++++++++------------------------\n 1 file changed, 45 insertions(+), 43 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex cf4cc32fd0..51d6ce8aec 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -538,7 +538,6 @@ test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-m\n '\n \n test_expect_success '--rebase with rebased upstream' '\n-\n \tgit remote add -f me . &&\n \tgit checkout copy &&\n \tgit tag copy-orig &&\n@@ -552,7 +551,6 @@ test_expect_success '--rebase with rebased upstream' '\n \tgit pull --rebase me copy &&\n \ttest \"conflicting modification\" = \"$(cat file)\" &&\n \ttest file = \"$(cat file2)\"\n-\n '\n \n test_expect_success '--rebase -f with rebased upstream' '\n@@ -564,14 +562,12 @@ test_expect_success '--rebase -f with rebased upstream' '\n '\n \n test_expect_success '--rebase with rebased default upstream' '\n-\n \tgit update-ref refs/remotes/me/copy copy-orig &&\n \tgit checkout --track -b to-rebase2 me/copy &&\n \tgit reset --hard to-rebase-orig &&\n \tgit pull --rebase &&\n \ttest \"conflicting modification\" = \"$(cat file)\" &&\n \ttest file = \"$(cat file2)\"\n-\n '\n \n test_expect_success 'rebased upstream + fetch + pull --rebase' '\n@@ -588,7 +584,6 @@ test_expect_success 'rebased upstream + fetch + pull --rebase' '\n '\n \n test_expect_success 'pull --rebase dies early with dirty working directory' '\n-\n \tgit checkout to-rebase &&\n \tgit update-ref refs/remotes/me/copy copy^ &&\n \tCOPY=\"$(git rev-parse --verify me/copy)\" &&\n@@ -603,16 +598,16 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '\n \tgit checkout HEAD -- file &&\n \tgit pull &&\n \ttest \"$COPY\" != \"$(git rev-parse --verify me/copy)\"\n-\n '\n \n test_expect_success 'pull --rebase works on branch yet to be born' '\n \tgit rev-parse master >expect &&\n \tmkdir empty_repo &&\n-\t(cd empty_repo &&\n-\t git init &&\n-\t git pull --rebase .. master &&\n-\t git rev-parse HEAD >../actual\n+\t(\n+\t\tcd empty_repo &&\n+\t\tgit init &&\n+\t\tgit pull --rebase .. master &&\n+\t\tgit rev-parse HEAD >../actual\n \t) &&\n \ttest_cmp expect actual\n '\n@@ -646,58 +641,65 @@ test_expect_success 'pull --rebase fails on corrupt HEAD' '\n \n test_expect_success 'setup for detecting upstreamed changes' '\n \tmkdir src &&\n-\t(cd src &&\n-\t git init &&\n-\t printf \"1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n10\\n\" > stuff &&\n-\t git add stuff &&\n-\t git commit -m \"Initial revision\"\n+\t(\n+\t\tcd src &&\n+\t\tgit init &&\n+\t\tprintf \"1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n10\\n\" > stuff &&\n+\t\tgit add stuff &&\n+\t\tgit commit -m \"Initial revision\"\n \t) &&\n \tgit clone src dst &&\n-\t(cd src &&\n-\t modify s/5/43/ stuff &&\n-\t git commit -a -m \"5->43\" &&\n-\t modify s/6/42/ stuff &&\n-\t git commit -a -m \"Make it bigger\"\n+\t(\n+\t\tcd src &&\n+\t\tmodify s/5/43/ stuff &&\n+\t\tgit commit -a -m \"5->43\" &&\n+\t\tmodify s/6/42/ stuff &&\n+\t\tgit commit -a -m \"Make it bigger\"\n \t) &&\n-\t(cd dst &&\n-\t modify s/5/43/ stuff &&\n-\t git commit -a -m \"Independent discovery of 5->43\"\n+\t(\n+\t\tcd dst &&\n+\t\tmodify s/5/43/ stuff &&\n+\t\tgit commit -a -m \"Independent discovery of 5->43\"\n \t)\n '\n \n test_expect_success 'git pull --rebase detects upstreamed changes' '\n-\t(cd dst &&\n-\t git pull --rebase &&\n-\t test -z \"$(git ls-files -u)\"\n+\t(\n+\t\tcd dst &&\n+\t\tgit pull --rebase &&\n+\t\ttest -z \"$(git ls-files -u)\"\n \t)\n '\n \n test_expect_success 'setup for avoiding reapplying old patches' '\n-\t(cd dst &&\n-\t test_might_fail git rebase --abort &&\n-\t git reset --hard origin/master\n+\t(\n+\t\tcd dst &&\n+\t\ttest_might_fail git rebase --abort &&\n+\t\tgit reset --hard origin/master\n \t) &&\n \tgit clone --bare src src-replace.git &&\n \trm -rf src &&\n \tmv src-replace.git src &&\n-\t(cd dst &&\n-\t modify s/2/22/ stuff &&\n-\t git commit -a -m \"Change 2\" &&\n-\t modify s/3/33/ stuff &&\n-\t git commit -a -m \"Change 3\" &&\n-\t modify s/4/44/ stuff &&\n-\t git commit -a -m \"Change 4\" &&\n-\t git push &&\n-\n-\t modify s/44/55/ stuff &&\n-\t git commit --amend -a -m \"Modified Change 4\"\n+\t(\n+\t\tcd dst &&\n+\t\tmodify s/2/22/ stuff &&\n+\t\tgit commit -a -m \"Change 2\" &&\n+\t\tmodify s/3/33/ stuff &&\n+\t\tgit commit -a -m \"Change 3\" &&\n+\t\tmodify s/4/44/ stuff &&\n+\t\tgit commit -a -m \"Change 4\" &&\n+\t\tgit push &&\n+\n+\t\tmodify s/44/55/ stuff &&\n+\t\tgit commit --amend -a -m \"Modified Change 4\"\n \t)\n '\n \n test_expect_success 'git pull --rebase does not reapply old patches' '\n-\t(cd dst &&\n-\t test_must_fail git pull --rebase &&\n-\t test 1 = $(find .git/rebase-apply -name \"000*\" | wc -l)\n+\t(\n+\t\tcd dst &&\n+\t\ttest_must_fail git pull --rebase &&\n+\t\ttest 1 = $(find .git/rebase-apply -name \"000*\" | wc -l)\n \t)\n '\n \n-- \n2.24.0.300.g722ba42680\n\n"},{"id":"385959","messageId":"1bb65a59dac978bfb698e87a8cde90f4fb9e4278.1573517561.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573517561.git.liu.denton@gmail.com","subject":"[PATCH v5 03/14] t5520: use sq for test case names","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T00:13:46Z","receivedAt":"2019-11-12T00:13:50Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"The usual convention is for test case names to be written between\nsingle-quotes. Change all double-quoted test case names to single-quotes\nexcept for two test case names that use variables within.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 51d6ce8aec..a3de2e19b6 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -408,7 +408,7 @@ test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n \ttest new = \"$(git show HEAD:file2)\"\n '\n \n-test_expect_success \"pull --rebase warns on --verify-signatures\" '\n+test_expect_success 'pull --rebase warns on --verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --verify-signatures . copy 2>err &&\n \ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n@@ -416,7 +416,7 @@ test_expect_success \"pull --rebase warns on --verify-signatures\" '\n \ttest_i18ngrep \"ignoring --verify-signatures for rebase\" err\n '\n \n-test_expect_success \"pull --rebase does not warn on --no-verify-signatures\" '\n+test_expect_success 'pull --rebase does not warn on --no-verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --no-verify-signatures . copy 2>err &&\n \ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n-- \n2.24.0.300.g722ba42680\n\n"},{"id":"385960","messageId":"d2fbae6ade04c6e30071cfc207f712ef5e5c7f67.1573517561.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573517561.git.liu.denton@gmail.com","subject":"[PATCH v5 04/14] t5520: let sed open its own input","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T00:13:48Z","receivedAt":"2019-11-12T00:13:53Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"We were using a redirection operator to feed input into sed. However,\nsince sed is capable of opening its own files, make sed open its own\nfiles instead of redirecting input into it.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex a3de2e19b6..55560ce3cd 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -5,7 +5,7 @@ test_description='pulling into void'\n . ./test-lib.sh\n \n modify () {\n-\tsed -e \"$1\" <\"$2\" >\"$2.x\" &&\n+\tsed -e \"$1\" \"$2\" >\"$2.x\" &&\n \tmv \"$2.x\" \"$2\"\n }\n \n-- \n2.24.0.300.g722ba42680\n\n"},{"id":"385961","messageId":"1d73546eb65fc32982a9a626d3410a45a84fabe4.1573517561.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573517561.git.liu.denton@gmail.com","subject":"[PATCH v5 05/14] t5520: replace test -f with test-lib functions","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T00:13:50Z","receivedAt":"2019-11-12T00:13:55Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Although `test -f` has the same functionality as test_path_is_file(), in\nthe case where test_path_is_file() fails, we get much better debugging\ninformation.\n\nReplace `test -f` with test_path_is_file() so that future developers\nwill have a better experience debugging these test cases.\n\nAlso, in the case of `! test -f`, not only should that path not be a\nfile, it shouldn't exist at all so replace it with\ntest_path_is_missing().\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 55560ce3cd..004d5884cd 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -39,8 +39,8 @@ test_expect_success 'pulling into void' '\n \t\tcd cloned &&\n \t\tgit pull ..\n \t) &&\n-\ttest -f file &&\n-\ttest -f cloned/file &&\n+\ttest_path_is_file file &&\n+\ttest_path_is_file cloned/file &&\n \ttest_cmp file cloned/file\n '\n \n@@ -50,8 +50,8 @@ test_expect_success 'pulling into void using master:master' '\n \t\tcd cloned-uho &&\n \t\tgit pull .. master:master\n \t) &&\n-\ttest -f file &&\n-\ttest -f cloned-uho/file &&\n+\ttest_path_is_file file &&\n+\ttest_path_is_file cloned-uho/file &&\n \ttest_cmp file cloned-uho/file\n '\n \n@@ -99,7 +99,7 @@ test_expect_success 'pulling into void must not create an octopus' '\n \t(\n \t\tcd cloned-octopus &&\n \t\ttest_must_fail git pull .. master master &&\n-\t\t! test -f file\n+\t\ttest_path_is_missing file\n \t)\n '\n \n-- \n2.24.0.300.g722ba42680\n\n"},{"id":"385962","messageId":"f1141f244f7d543a35bda374ef13ea3826bddbf0.1573517561.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573517561.git.liu.denton@gmail.com","subject":"[PATCH v5 06/14] t5520: remove spaces after redirect operator","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T00:13:53Z","receivedAt":"2019-11-12T00:13:57Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"The style for tests in Git is to have the redirect operator attached to\nthe filename with no spaces. Fix test cases where this is not the case.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 004d5884cd..7bb9031140 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -243,10 +243,10 @@ test_expect_success 'fast-forward fails with conflicting work tree' '\n \n test_expect_success '--rebase' '\n \tgit branch to-rebase &&\n-\techo modified again > file &&\n+\techo modified again >file &&\n \tgit commit -m file file &&\n \tgit checkout to-rebase &&\n-\techo new > file2 &&\n+\techo new >file2 &&\n \tgit add file2 &&\n \tgit commit -m \"new file\" &&\n \tgit tag before-rebase &&\n@@ -542,10 +542,10 @@ test_expect_success '--rebase with rebased upstream' '\n \tgit checkout copy &&\n \tgit tag copy-orig &&\n \tgit reset --hard HEAD^ &&\n-\techo conflicting modification > file &&\n+\techo conflicting modification >file &&\n \tgit commit -m conflict file &&\n \tgit checkout to-rebase &&\n-\techo file > file2 &&\n+\techo file >file2 &&\n \tgit commit -m to-rebase file2 &&\n \tgit tag to-rebase-orig &&\n \tgit pull --rebase me copy &&\n@@ -591,7 +591,7 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '\n \ttest_config branch.to-rebase.remote me &&\n \ttest_config branch.to-rebase.merge refs/heads/copy &&\n \ttest_config branch.to-rebase.rebase true &&\n-\techo dirty >> file &&\n+\techo dirty >>file &&\n \tgit add file &&\n \ttest_must_fail git pull &&\n \ttest \"$COPY\" = \"$(git rev-parse --verify me/copy)\" &&\n-- \n2.24.0.300.g722ba42680\n\n"},{"id":"385963","messageId":"5106004e95b6fedd0bf04922276744d48c1b2dae.1573517561.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573517561.git.liu.denton@gmail.com","subject":"[PATCH v5 07/14] t5520: use test_line_count where possible","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T00:13:55Z","receivedAt":"2019-11-12T00:13:59Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Instead of rolling our own functionality to test the number of lines a\ncommand outputs, use test_line_count() which provides better debugging\ninformation in the case of a failure.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 7bb9031140..0ca4867e96 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -699,7 +699,8 @@ test_expect_success 'git pull --rebase does not reapply old patches' '\n \t(\n \t\tcd dst &&\n \t\ttest_must_fail git pull --rebase &&\n-\t\ttest 1 = $(find .git/rebase-apply -name \"000*\" | wc -l)\n+\t\tfind .git/rebase-apply -name \"000*\" >patches &&\n+\t\ttest_line_count = 1 patches\n \t)\n '\n \n-- \n2.24.0.300.g722ba42680\n\n"},{"id":"385964","messageId":"85b444e8a6c1876e53560dd6a989ef62c2daba2c.1573517561.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573517561.git.liu.denton@gmail.com","subject":"[PATCH v5 08/14] t5520: replace test -{n,z} with test-lib functions","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T00:13:57Z","receivedAt":"2019-11-12T00:14:02Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"When wrapping a Git command in a subshell within another command, we\nthrow away the Git command's exit code. In case the Git command fails,\nwe would like to know about it rather than the failure being silent.\nExtract Git commands so that their exit codes are not lost.\n\nInstead of using `test -n` or `test -z`, replace them respectively with\ninvocations of test_file_not_empty() and test_must_be_empty() so that we\nget better debugging information in the case of a failure.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 12 ++++++++----\n 1 file changed, 8 insertions(+), 4 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 0ca4867e96..18225d8430 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -206,15 +206,18 @@ test_expect_success 'fail if the index has unresolved entries' '\n \ttest_when_finished \"git checkout -f copy && git branch -D third\" &&\n \ttest \"$(cat file)\" = file &&\n \ttest_commit modified2 file &&\n-\ttest -z \"$(git ls-files -u)\" &&\n+\tgit ls-files -u >unmerged &&\n+\ttest_must_be_empty unmerged &&\n \ttest_must_fail git pull . second &&\n-\ttest -n \"$(git ls-files -u)\" &&\n+\tgit ls-files -u >unmerged &&\n+\ttest_file_not_empty unmerged &&\n \tcp file expected &&\n \ttest_must_fail git pull . second 2>err &&\n \ttest_i18ngrep \"Pulling is not possible because you have unmerged files.\" err &&\n \ttest_cmp expected file &&\n \tgit add file &&\n-\ttest -z \"$(git ls-files -u)\" &&\n+\tgit ls-files -u >unmerged &&\n+\ttest_must_be_empty unmerged &&\n \ttest_must_fail git pull . second 2>err &&\n \ttest_i18ngrep \"You have not concluded your merge\" err &&\n \ttest_cmp expected file\n@@ -667,7 +670,8 @@ test_expect_success 'git pull --rebase detects upstreamed changes' '\n \t(\n \t\tcd dst &&\n \t\tgit pull --rebase &&\n-\t\ttest -z \"$(git ls-files -u)\"\n+\t\tgit ls-files -u >untracked &&\n+\t\ttest_must_be_empty untracked\n \t)\n '\n \n-- \n2.24.0.300.g722ba42680\n\n"},{"id":"385965","messageId":"3d437843919e84a056f3b8cab32cb745cc03cea5.1573517561.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573517561.git.liu.denton@gmail.com","subject":"[PATCH v5 09/14] t5520: use test_cmp_rev where possible","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T00:14:00Z","receivedAt":"2019-11-12T00:14:04Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"In case an invocation of `git rev-list` fails within the subshell, the\nfailure will be masked. Remove the subshell and use test_cmp_rev() so\nthat failures can be discovered.\n\nThis change was done with the following sed expressions:\n\n\ts/test \"$(git rev-parse.* \\([^)]*\\))\" = \"$(git rev-parse \\([^)]*\\))\"/test_cmp_rev \\1 \\2/\n\ts/test \\([^ ]*\\) = \"$(git rev-parse.* \\([^)]*\\))\"/test_cmp_rev \\1 \\2/\n\ts/test \"$(git rev-parse.* \\([^)]*\\))\" != \"$(git rev-parse.* \\([^)]*\\))\"/test_cmp_rev ! \\1 \\2/\n\ts/test \\([^ ]*\\) != \"$(git rev-parse.* \\([^)]*\\))\"/test_cmp_rev ! \\1 \\2/\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 50 ++++++++++++++++++++++++-------------------------\n 1 file changed, 25 insertions(+), 25 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 18225d8430..1af6ea06ee 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -230,7 +230,7 @@ test_expect_success 'fast-forwards working tree if branch head is updated' '\n \tgit pull . second:third 2>err &&\n \ttest_i18ngrep \"fetch updated the current branch head\" err &&\n \ttest \"$(cat file)\" = modified &&\n-\ttest \"$(git rev-parse third)\" = \"$(git rev-parse second)\"\n+\ttest_cmp_rev third second\n '\n \n test_expect_success 'fast-forward fails with conflicting work tree' '\n@@ -241,7 +241,7 @@ test_expect_success 'fast-forward fails with conflicting work tree' '\n \ttest_must_fail git pull . second:third 2>err &&\n \ttest_i18ngrep \"Cannot fast-forward your working tree\" err &&\n \ttest \"$(cat file)\" = conflict &&\n-\ttest \"$(git rev-parse third)\" = \"$(git rev-parse second)\"\n+\ttest_cmp_rev third second\n '\n \n test_expect_success '--rebase' '\n@@ -254,7 +254,7 @@ test_expect_success '--rebase' '\n \tgit commit -m \"new file\" &&\n \tgit tag before-rebase &&\n \tgit pull --rebase . copy &&\n-\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\"\n '\n \n@@ -266,7 +266,7 @@ test_expect_success '--rebase fast forward' '\n \n \tgit checkout to-rebase &&\n \tgit pull --rebase . ff &&\n-\ttest \"$(git rev-parse HEAD)\" = \"$(git rev-parse ff)\" &&\n+\ttest_cmp_rev HEAD ff &&\n \n \t# The above only validates the result.  Did we actually bypass rebase?\n \tgit reflog -1 >reflog.actual &&\n@@ -290,7 +290,7 @@ test_expect_success '--rebase --autostash fast forward' '\n \tgit checkout behind &&\n \techo dirty >file &&\n \tgit pull --rebase --autostash . to-rebase-ff &&\n-\ttest \"$(git rev-parse HEAD)\" = \"$(git rev-parse to-rebase-ff)\"\n+\ttest_cmp_rev HEAD to-rebase-ff\n '\n \n test_expect_success '--rebase with conflicts shows advice' '\n@@ -328,7 +328,7 @@ test_expect_success 'failed --rebase shows advice' '\n test_expect_success '--rebase fails with multiple branches' '\n \tgit reset --hard before-rebase &&\n \ttest_must_fail git pull --rebase . copy master 2>err &&\n-\ttest \"$(git rev-parse HEAD)\" = \"$(git rev-parse before-rebase)\" &&\n+\ttest_cmp_rev HEAD before-rebase &&\n \ttest_i18ngrep \"Cannot rebase onto multiple branches\" err &&\n \ttest modified = \"$(git show HEAD:file)\"\n '\n@@ -380,7 +380,7 @@ test_expect_success 'pull.rebase' '\n \tgit reset --hard before-rebase &&\n \ttest_config pull.rebase true &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\"\n '\n \n@@ -398,7 +398,7 @@ test_expect_success 'branch.to-rebase.rebase' '\n \tgit reset --hard before-rebase &&\n \ttest_config branch.to-rebase.rebase true &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\"\n '\n \n@@ -407,14 +407,14 @@ test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n \ttest_config pull.rebase true &&\n \ttest_config branch.to-rebase.rebase false &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^)\" != \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev ! HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\"\n '\n \n test_expect_success 'pull --rebase warns on --verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --verify-signatures . copy 2>err &&\n-\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\" &&\n \ttest_i18ngrep \"ignoring --verify-signatures for rebase\" err\n '\n@@ -422,7 +422,7 @@ test_expect_success 'pull --rebase warns on --verify-signatures' '\n test_expect_success 'pull --rebase does not warn on --no-verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --no-verify-signatures . copy 2>err &&\n-\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\" &&\n \ttest_i18ngrep ! \"verify-signatures\" err\n '\n@@ -443,8 +443,8 @@ test_expect_success 'pull.rebase=false create a new merge commit' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase false &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^1)\" = \"$(git rev-parse before-preserve-rebase)\" &&\n-\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^1 before-preserve-rebase &&\n+\ttest_cmp_rev HEAD^2 copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -452,7 +452,7 @@ test_expect_success 'pull.rebase=true flattens keep-merge' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase true &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^^ copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -460,7 +460,7 @@ test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase 1 &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^^ copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -469,8 +469,8 @@ test_expect_success REBASE_P \\\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase preserve &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n-\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse keep-merge)\"\n+\ttest_cmp_rev HEAD^^ copy &&\n+\ttest_cmp_rev HEAD^2 keep-merge\n '\n \n test_expect_success 'pull.rebase=interactive' '\n@@ -505,8 +505,8 @@ test_expect_success '--rebase=false create a new merge commit' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase true &&\n \tgit pull --rebase=false . copy &&\n-\ttest \"$(git rev-parse HEAD^1)\" = \"$(git rev-parse before-preserve-rebase)\" &&\n-\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^1 before-preserve-rebase &&\n+\ttest_cmp_rev HEAD^2 copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -514,7 +514,7 @@ test_expect_success '--rebase=true rebases and flattens keep-merge' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase preserve &&\n \tgit pull --rebase=true . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^^ copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -523,8 +523,8 @@ test_expect_success REBASE_P \\\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase true &&\n \tgit pull --rebase=preserve . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n-\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse keep-merge)\"\n+\ttest_cmp_rev HEAD^^ copy &&\n+\ttest_cmp_rev HEAD^2 keep-merge\n '\n \n test_expect_success '--rebase=invalid fails' '\n@@ -536,7 +536,7 @@ test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-m\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase preserve &&\n \tgit pull --rebase . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^^ copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -597,10 +597,10 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '\n \techo dirty >>file &&\n \tgit add file &&\n \ttest_must_fail git pull &&\n-\ttest \"$COPY\" = \"$(git rev-parse --verify me/copy)\" &&\n+\ttest_cmp_rev \"$COPY\" me/copy &&\n \tgit checkout HEAD -- file &&\n \tgit pull &&\n-\ttest \"$COPY\" != \"$(git rev-parse --verify me/copy)\"\n+\ttest_cmp_rev ! \"$COPY\" me/copy\n '\n \n test_expect_success 'pull --rebase works on branch yet to be born' '\n-- \n2.24.0.300.g722ba42680\n\n"},{"id":"385966","messageId":"2f9052fd94ebb6fe93ea6fe2e7cd3c717635c822.1573517561.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573517561.git.liu.denton@gmail.com","subject":"[PATCH v5 10/14] t5520: test single-line files by git with test_cmp","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T00:14:02Z","receivedAt":"2019-11-12T00:14:08Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"In case an invocation of a Git command fails within the subshell, the\nfailure will be masked. Replace the subshell with a file-redirection and\na call to test_cmp.\n\nThis change was done with the following GNU sed expressions:\n\n\ts/\\(\\s*\\)test \\([^ ]*\\) = \"$(\\(git [^)]*\\))\"/\\1echo \\2 >expect \\&\\&\\n\\1\\3 >actual \\&\\&\\n\\1test_cmp expect actual/\n\ts/\\(\\s*\\)test \"$(\\(git [^)]*\\))\" = \\([^ ]*\\)/\\1echo \\3 >expect \\&\\&\\n\\1\\2 >actual \\&\\&\\n\\1test_cmp expect actual/\n\nA future patch will clean up situations where we have multiple duplicate\nstatements within a test case. This is done to keep this patch purely\nmechanical.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 64 ++++++++++++++++++++++++++++++++++++-------------\n 1 file changed, 48 insertions(+), 16 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 1af6ea06ee..8b7e7ae55d 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -255,7 +255,9 @@ test_expect_success '--rebase' '\n \tgit tag before-rebase &&\n \tgit pull --rebase . copy &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\"\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success '--rebase fast forward' '\n@@ -330,7 +332,9 @@ test_expect_success '--rebase fails with multiple branches' '\n \ttest_must_fail git pull --rebase . copy master 2>err &&\n \ttest_cmp_rev HEAD before-rebase &&\n \ttest_i18ngrep \"Cannot rebase onto multiple branches\" err &&\n-\ttest modified = \"$(git show HEAD:file)\"\n+\techo modified >expect &&\n+\tgit show HEAD:file >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'pull --rebase succeeds with dirty working directory and rebase.autostash set' '\n@@ -381,7 +385,9 @@ test_expect_success 'pull.rebase' '\n \ttest_config pull.rebase true &&\n \tgit pull . copy &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\"\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'pull --autostash & pull.rebase=true' '\n@@ -399,7 +405,9 @@ test_expect_success 'branch.to-rebase.rebase' '\n \ttest_config branch.to-rebase.rebase true &&\n \tgit pull . copy &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\"\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n@@ -408,14 +416,18 @@ test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n \ttest_config branch.to-rebase.rebase false &&\n \tgit pull . copy &&\n \ttest_cmp_rev ! HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\"\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'pull --rebase warns on --verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --verify-signatures . copy 2>err &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\" &&\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual &&\n \ttest_i18ngrep \"ignoring --verify-signatures for rebase\" err\n '\n \n@@ -423,7 +435,9 @@ test_expect_success 'pull --rebase does not warn on --no-verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --no-verify-signatures . copy 2>err &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\" &&\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual &&\n \ttest_i18ngrep ! \"verify-signatures\" err\n '\n \n@@ -445,7 +459,9 @@ test_expect_success 'pull.rebase=false create a new merge commit' '\n \tgit pull . copy &&\n \ttest_cmp_rev HEAD^1 before-preserve-rebase &&\n \ttest_cmp_rev HEAD^2 copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'pull.rebase=true flattens keep-merge' '\n@@ -453,7 +469,9 @@ test_expect_success 'pull.rebase=true flattens keep-merge' '\n \ttest_config pull.rebase true &&\n \tgit pull . copy &&\n \ttest_cmp_rev HEAD^^ copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' '\n@@ -461,7 +479,9 @@ test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' '\n \ttest_config pull.rebase 1 &&\n \tgit pull . copy &&\n \ttest_cmp_rev HEAD^^ copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success REBASE_P \\\n@@ -507,7 +527,9 @@ test_expect_success '--rebase=false create a new merge commit' '\n \tgit pull --rebase=false . copy &&\n \ttest_cmp_rev HEAD^1 before-preserve-rebase &&\n \ttest_cmp_rev HEAD^2 copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success '--rebase=true rebases and flattens keep-merge' '\n@@ -515,7 +537,9 @@ test_expect_success '--rebase=true rebases and flattens keep-merge' '\n \ttest_config pull.rebase preserve &&\n \tgit pull --rebase=true . copy &&\n \ttest_cmp_rev HEAD^^ copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success REBASE_P \\\n@@ -537,7 +561,9 @@ test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-m\n \ttest_config pull.rebase preserve &&\n \tgit pull --rebase . copy &&\n \ttest_cmp_rev HEAD^^ copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success '--rebase with rebased upstream' '\n@@ -622,10 +648,16 @@ test_expect_success 'pull --rebase fails on unborn branch with staged changes' '\n \t\tcd empty_repo2 &&\n \t\techo staged-file >staged-file &&\n \t\tgit add staged-file &&\n-\t\ttest \"$(git ls-files)\" = staged-file &&\n+\t\techo staged-file >expect &&\n+\t\tgit ls-files >actual &&\n+\t\ttest_cmp expect actual &&\n \t\ttest_must_fail git pull --rebase .. master 2>err &&\n-\t\ttest \"$(git ls-files)\" = staged-file &&\n-\t\ttest \"$(git show :staged-file)\" = staged-file &&\n+\t\techo staged-file >expect &&\n+\t\tgit ls-files >actual &&\n+\t\ttest_cmp expect actual &&\n+\t\techo staged-file >expect &&\n+\t\tgit show :staged-file >actual &&\n+\t\ttest_cmp expect actual &&\n \t\ttest_i18ngrep \"unborn branch with changes added to the index\" err\n \t)\n '\n-- \n2.24.0.300.g722ba42680\n\n"},{"id":"385967","messageId":"3fd10a58c64a7e472c0a972f3477a879b1d14f64.1573517561.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573517561.git.liu.denton@gmail.com","subject":"[PATCH v5 11/14] t5520: don't put git in upstream of pipe","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T00:14:05Z","receivedAt":"2019-11-12T00:14:09Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Before, if the invocation of git failed, it would be masked by the pipe\nsince only the return code of the last element of a pipe is used.\nRewrite the test to put the Git command on its own line so its return\ncode is not masked.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 8b7e7ae55d..8ddf89e550 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -668,7 +668,8 @@ test_expect_success 'pull --rebase fails on corrupt HEAD' '\n \t(\n \t\tcd corrupt &&\n \t\ttest_commit one &&\n-\t\tobj=$(git rev-parse --verify HEAD | sed \"s#^..#&/#\") &&\n+\t\tgit rev-parse --verify HEAD >head &&\n+\t\tobj=$(sed \"s#^..#&/#\" head) &&\n \t\trm -f .git/objects/$obj &&\n \t\ttest_must_fail git pull --rebase\n \t)\n-- \n2.24.0.300.g722ba42680\n\n"},{"id":"385968","messageId":"ed78ed75bdf982202e2ddcb87267448ee5699127.1573517561.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573517561.git.liu.denton@gmail.com","subject":"[PATCH v5 12/14] t5520: replace subshell cat comparison with test_cmp","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T00:14:07Z","receivedAt":"2019-11-12T00:14:12Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"We currently have many instances of `test <line> = $(cat <file>)` and\n`test $(cat <file>) = <line>`.  In the case where this fails, it will be\ndifficult for a developer to debug since the output will be masked.\nReplace these instances with invocations of test_cmp().\n\nThis change was done with the following GNU sed expressions:\n\n\ts/\\(\\s*\\)test \\([^=]*\\)= \"$(cat \\([^)]*\\))\"/\\1echo \\2>expect \\&\\&\\n\\1test_cmp expect \\3/\n\ts/\\(\\s*\\)test \"$(cat \\([^)]*\\))\" = \\([^&]*\\)\\( &&\\)\\?$/\\1echo \\3 >expect \\&\\&\\n\\1test_cmp expect \\2\\4/\n\nA future patch will clean up situations where we have multiple duplicate\nstatements within a test case. This is done to keep this patch purely\nmechanical.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 105 ++++++++++++++++++++++++++++++++----------------\n 1 file changed, 70 insertions(+), 35 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 8ddf89e550..c9e4eec004 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -15,8 +15,10 @@ test_pull_autostash () {\n \tgit add new_file &&\n \tgit pull \"$@\" . copy &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest \"$(cat new_file)\" = dirty &&\n-\ttest \"$(cat file)\" = \"modified again\"\n+\techo dirty >expect &&\n+\ttest_cmp expect new_file &&\n+\techo \"modified again\" >expect &&\n+\ttest_cmp expect file\n }\n \n test_pull_autostash_fail () {\n@@ -110,9 +112,11 @@ test_expect_success 'test . as a remote' '\n \techo updated >file &&\n \tgit commit -a -m updated &&\n \tgit checkout copy &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \tgit pull &&\n-\ttest \"$(cat file)\" = updated &&\n+\techo updated >expect &&\n+\ttest_cmp expect file &&\n \tgit reflog -1 >reflog.actual &&\n \tsed \"s/^[0-9a-f][0-9a-f]*/OBJID/\" reflog.actual >reflog.fuzzy &&\n \techo \"OBJID HEAD@{0}: pull: Fast-forward\" >reflog.expected &&\n@@ -125,9 +129,11 @@ test_expect_success 'the default remote . should not break explicit pull' '\n \tgit commit -a -m modified &&\n \tgit checkout copy &&\n \tgit reset --hard HEAD^ &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \tgit pull . second &&\n-\ttest \"$(cat file)\" = modified &&\n+\techo modified >expect &&\n+\ttest_cmp expect file &&\n \tgit reflog -1 >reflog.actual &&\n \tsed \"s/^[0-9a-f][0-9a-f]*/OBJID/\" reflog.actual >reflog.fuzzy &&\n \techo \"OBJID HEAD@{0}: pull . second: Fast-forward\" >reflog.expected &&\n@@ -137,10 +143,12 @@ test_expect_success 'the default remote . should not break explicit pull' '\n test_expect_success 'fail if wildcard spec does not match any refs' '\n \tgit checkout -b test copy^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_must_fail git pull . \"refs/nonexisting1/*:refs/nonexisting2/*\" 2>err &&\n \ttest_i18ngrep \"no candidates for merging\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'fail if no branches specified with non-default remote' '\n@@ -148,11 +156,13 @@ test_expect_success 'fail if no branches specified with non-default remote' '\n \ttest_when_finished \"git remote remove test_remote\" &&\n \tgit checkout -b test copy^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_config branch.test.remote origin &&\n \ttest_must_fail git pull test_remote 2>err &&\n \ttest_i18ngrep \"specify a branch on the command line\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'fail if not on a branch' '\n@@ -160,10 +170,12 @@ test_expect_success 'fail if not on a branch' '\n \ttest_when_finished \"git remote remove origin\" &&\n \tgit checkout HEAD^ &&\n \ttest_when_finished \"git checkout -f copy\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"not currently on a branch\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'fail if no configuration for current branch' '\n@@ -172,10 +184,12 @@ test_expect_success 'fail if no configuration for current branch' '\n \tgit checkout -b test copy^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n \ttest_config branch.test.remote test_remote &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"no tracking information\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'pull --all: fail if no configuration for current branch' '\n@@ -184,10 +198,12 @@ test_expect_success 'pull --all: fail if no configuration for current branch' '\n \tgit checkout -b test copy^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n \ttest_config branch.test.remote test_remote &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_must_fail git pull --all 2>err &&\n \ttest_i18ngrep \"There is no tracking information\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'fail if upstream branch does not exist' '\n@@ -195,16 +211,19 @@ test_expect_success 'fail if upstream branch does not exist' '\n \ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n \ttest_config branch.test.remote . &&\n \ttest_config branch.test.merge refs/heads/nonexisting &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"no such ref was fetched\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'fail if the index has unresolved entries' '\n \tgit checkout -b third second^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D third\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_commit modified2 file &&\n \tgit ls-files -u >unmerged &&\n \ttest_must_be_empty unmerged &&\n@@ -226,21 +245,25 @@ test_expect_success 'fail if the index has unresolved entries' '\n test_expect_success 'fast-forwards working tree if branch head is updated' '\n \tgit checkout -b third second^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D third\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \tgit pull . second:third 2>err &&\n \ttest_i18ngrep \"fetch updated the current branch head\" err &&\n-\ttest \"$(cat file)\" = modified &&\n+\techo modified >expect &&\n+\ttest_cmp expect file &&\n \ttest_cmp_rev third second\n '\n \n test_expect_success 'fast-forward fails with conflicting work tree' '\n \tgit checkout -b third second^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D third\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \techo conflict >file &&\n \ttest_must_fail git pull . second:third 2>err &&\n \ttest_i18ngrep \"Cannot fast-forward your working tree\" err &&\n-\ttest \"$(cat file)\" = conflict &&\n+\techo conflict >expect &&\n+\ttest_cmp expect file &&\n \ttest_cmp_rev third second\n '\n \n@@ -501,7 +524,8 @@ test_expect_success 'pull.rebase=interactive' '\n \ttest_set_editor \"$TRASH_DIRECTORY/fake-editor\" &&\n \ttest_when_finished \"test_might_fail git rebase --abort\" &&\n \ttest_must_fail git pull --rebase=interactive . copy &&\n-\ttest \"I was here\" = \"$(cat fake.out)\"\n+\techo \"I was here\" >expect &&\n+\ttest_cmp expect fake.out\n '\n \n test_expect_success 'pull --rebase=i' '\n@@ -512,7 +536,8 @@ test_expect_success 'pull --rebase=i' '\n \ttest_set_editor \"$TRASH_DIRECTORY/fake-editor\" &&\n \ttest_when_finished \"test_might_fail git rebase --abort\" &&\n \ttest_must_fail git pull --rebase=i . copy &&\n-\ttest \"I was here, too\" = \"$(cat fake.out)\"\n+\techo \"I was here, too\" >expect &&\n+\ttest_cmp expect fake.out\n '\n \n test_expect_success 'pull.rebase=invalid fails' '\n@@ -578,16 +603,20 @@ test_expect_success '--rebase with rebased upstream' '\n \tgit commit -m to-rebase file2 &&\n \tgit tag to-rebase-orig &&\n \tgit pull --rebase me copy &&\n-\ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = \"$(cat file2)\"\n+\techo \"conflicting modification\" >expect &&\n+\ttest_cmp expect file &&\n+\techo file >expect &&\n+\ttest_cmp expect file2\n '\n \n test_expect_success '--rebase -f with rebased upstream' '\n \ttest_when_finished \"test_might_fail git rebase --abort\" &&\n \tgit reset --hard to-rebase-orig &&\n \tgit pull --rebase -f me copy &&\n-\ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = \"$(cat file2)\"\n+\techo \"conflicting modification\" >expect &&\n+\ttest_cmp expect file &&\n+\techo file >expect &&\n+\ttest_cmp expect file2\n '\n \n test_expect_success '--rebase with rebased default upstream' '\n@@ -595,8 +624,10 @@ test_expect_success '--rebase with rebased default upstream' '\n \tgit checkout --track -b to-rebase2 me/copy &&\n \tgit reset --hard to-rebase-orig &&\n \tgit pull --rebase &&\n-\ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = \"$(cat file2)\"\n+\techo \"conflicting modification\" >expect &&\n+\ttest_cmp expect file &&\n+\techo file >expect &&\n+\ttest_cmp expect file2\n '\n \n test_expect_success 'rebased upstream + fetch + pull --rebase' '\n@@ -607,8 +638,10 @@ test_expect_success 'rebased upstream + fetch + pull --rebase' '\n \tgit reset --hard to-rebase-orig &&\n \tgit fetch &&\n \tgit pull --rebase &&\n-\ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = \"$(cat file2)\"\n+\techo \"conflicting modification\" >expect &&\n+\ttest_cmp expect file &&\n+\techo file >expect &&\n+\ttest_cmp expect file2\n \n '\n \n@@ -744,8 +777,10 @@ test_expect_success 'git pull --rebase does not reapply old patches' '\n test_expect_success 'git pull --rebase against local branch' '\n \tgit checkout -b copy2 to-rebase-orig &&\n \tgit pull --rebase . to-rebase &&\n-\ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = \"$(cat file2)\"\n+\techo \"conflicting modification\" >expect &&\n+\ttest_cmp expect file &&\n+\techo file >expect &&\n+\ttest_cmp expect file2\n '\n \n test_done\n-- \n2.24.0.300.g722ba42680\n\n"},{"id":"385969","messageId":"7888757bd0cfd13fdf278d10123c47f15cac5f59.1573517561.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573517561.git.liu.denton@gmail.com","subject":"[PATCH v5 13/14] t5520: remove redundant lines in test cases","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T00:14:09Z","receivedAt":"2019-11-12T00:14:14Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"In the previous patches, the mechanical application of changes left some\nduplicate statements in the test case which were not strictly incorrect\nbut were redundant and possibly misleading. Remove these duplicate\nstatements so that it is clear that the intent behind the tests are that\nthe content of the file stays the same throughout the whole test case.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 8 --------\n 1 file changed, 8 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex c9e4eec004..ef3dbc201a 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -147,7 +147,6 @@ test_expect_success 'fail if wildcard spec does not match any refs' '\n \ttest_cmp expect file &&\n \ttest_must_fail git pull . \"refs/nonexisting1/*:refs/nonexisting2/*\" 2>err &&\n \ttest_i18ngrep \"no candidates for merging\" err &&\n-\techo file >expect &&\n \ttest_cmp expect file\n '\n \n@@ -161,7 +160,6 @@ test_expect_success 'fail if no branches specified with non-default remote' '\n \ttest_config branch.test.remote origin &&\n \ttest_must_fail git pull test_remote 2>err &&\n \ttest_i18ngrep \"specify a branch on the command line\" err &&\n-\techo file >expect &&\n \ttest_cmp expect file\n '\n \n@@ -174,7 +172,6 @@ test_expect_success 'fail if not on a branch' '\n \ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"not currently on a branch\" err &&\n-\techo file >expect &&\n \ttest_cmp expect file\n '\n \n@@ -188,7 +185,6 @@ test_expect_success 'fail if no configuration for current branch' '\n \ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"no tracking information\" err &&\n-\techo file >expect &&\n \ttest_cmp expect file\n '\n \n@@ -202,7 +198,6 @@ test_expect_success 'pull --all: fail if no configuration for current branch' '\n \ttest_cmp expect file &&\n \ttest_must_fail git pull --all 2>err &&\n \ttest_i18ngrep \"There is no tracking information\" err &&\n-\techo file >expect &&\n \ttest_cmp expect file\n '\n \n@@ -215,7 +210,6 @@ test_expect_success 'fail if upstream branch does not exist' '\n \ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"no such ref was fetched\" err &&\n-\techo file >expect &&\n \ttest_cmp expect file\n '\n \n@@ -685,10 +679,8 @@ test_expect_success 'pull --rebase fails on unborn branch with staged changes' '\n \t\tgit ls-files >actual &&\n \t\ttest_cmp expect actual &&\n \t\ttest_must_fail git pull --rebase .. master 2>err &&\n-\t\techo staged-file >expect &&\n \t\tgit ls-files >actual &&\n \t\ttest_cmp expect actual &&\n-\t\techo staged-file >expect &&\n \t\tgit show :staged-file >actual &&\n \t\ttest_cmp expect actual &&\n \t\ttest_i18ngrep \"unborn branch with changes added to the index\" err\n-- \n2.24.0.300.g722ba42680\n\n"},{"id":"385970","messageId":"1bc7ad364f2e787147f0ac7205f207f9b232a3f7.1573517561.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573517561.git.liu.denton@gmail.com","subject":"[PATCH v5 14/14] t5520: replace `! git` with `test_must_fail git`","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T00:14:11Z","receivedAt":"2019-11-12T00:14:16Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Currently, if a Git command fails in an unexpected way, such as a\nsegfault, it will be masked and ignored. Replace the ! with\ntest_must_fail so that only expected failures pass.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex ef3dbc201a..602d996a33 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -537,7 +537,7 @@ test_expect_success 'pull --rebase=i' '\n test_expect_success 'pull.rebase=invalid fails' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase invalid &&\n-\t! git pull . copy\n+\ttest_must_fail git pull . copy\n '\n \n test_expect_success '--rebase=false create a new merge commit' '\n@@ -572,7 +572,7 @@ test_expect_success REBASE_P \\\n \n test_expect_success '--rebase=invalid fails' '\n \tgit reset --hard before-preserve-rebase &&\n-\t! git pull --rebase=invalid . copy\n+\ttest_must_fail git pull --rebase=invalid . copy\n '\n \n test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-merge' '\n-- \n2.24.0.300.g722ba42680\n\n"},{"id":"385980","messageId":"xmqqh839fzbm.fsf@gitster-ct.c.googlers.com","threadId":"52061","inReplyTo":"2f9052fd94ebb6fe93ea6fe2e7cd3c717635c822.1573517561.git.liu.denton@gmail.com","subject":"Re: [PATCH v5 10/14] t5520: test single-line files by git with test_cmp","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-11-12T05:17:33Z","receivedAt":"2019-11-12T05:17:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Denton Liu <liu.denton@gmail.com> writes:\n\n> In case an invocation of a Git command fails within the subshell, the\n> failure will be masked. Replace the subshell with a file-redirection and\n> a call to test_cmp.\n\nI.e.\n\n    test \"$(git cmd args)\" = \"expected-string\"\n\n=>\n\n    git cmd args >actual && echo \"expected-string\" >expect &&\n    test_cmp expect actual\n\nwhich makes sense.  It may break if expected-string begins with a\ndash or something silly like that, but a quick eyeballing over the\npatch tells me that we are safe there.\n\nTechnically, \"$(git cmd args)\" used as a command line option of\nanother command is called \"command substitution\", not \"subshell\".\nThe proposed log message may need to be updated.\n\n> This change was done with the following GNU sed expressions:\n>\n> \ts/\\(\\s*\\)test \\([^ ]*\\) = \"$(\\(git [^)]*\\))\"/\\1echo \\2 >expect \\&\\&\\n\\1\\3 >actual \\&\\&\\n\\1test_cmp expect actual/\n> \ts/\\(\\s*\\)test \"$(\\(git [^)]*\\))\" = \\([^ ]*\\)/\\1echo \\3 >expect \\&\\&\\n\\1\\2 >actual \\&\\&\\n\\1test_cmp expect actual/\n>\n> A future patch will clean up situations where we have multiple duplicate\n> statements within a test case. This is done to keep this patch purely\n> mechanical.\n\nOK.  One thing that worries me is if the existing tests are not\nexpecting (no pun intended) to see 'expect' or 'actual' (e.g. if\nthey somehow rely on output of \"ls-files -u\", we are now adding two\nuntracked files in the working tree).  Another is if the git command\nis expected to produce nothing, possibly after failing, and the test\nis expecting to see an empty string---in such a case, the hiding of\nthe exit status would have been intentional ;-)  We'd want to be sure\nthat we aren't breaking the tests like that by reading through the\nresult of applying this patch.\n\nSince this is just a single file, I trust you have already done such\nsanity checking ;-)\n\nThe mechanical conversion procedure itself looks OK.\n\nThanks.\n\n> Signed-off-by: Denton Liu <liu.denton@gmail.com>\n> ---\n>  t/t5520-pull.sh | 64 ++++++++++++++++++++++++++++++++++++-------------\n>  1 file changed, 48 insertions(+), 16 deletions(-)\n>\n> diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\n> index 1af6ea06ee..8b7e7ae55d 100755\n> --- a/t/t5520-pull.sh\n> +++ b/t/t5520-pull.sh\n> @@ -255,7 +255,9 @@ test_expect_success '--rebase' '\n>  \tgit tag before-rebase &&\n>  \tgit pull --rebase . copy &&\n>  \ttest_cmp_rev HEAD^ copy &&\n> -\ttest new = \"$(git show HEAD:file2)\"\n> +\techo new >expect &&\n> +\tgit show HEAD:file2 >actual &&\n> +\ttest_cmp expect actual\n>  '\n>  \n>  test_expect_success '--rebase fast forward' '\n> @@ -330,7 +332,9 @@ test_expect_success '--rebase fails with multiple branches' '\n>  \ttest_must_fail git pull --rebase . copy master 2>err &&\n>  \ttest_cmp_rev HEAD before-rebase &&\n>  \ttest_i18ngrep \"Cannot rebase onto multiple branches\" err &&\n> -\ttest modified = \"$(git show HEAD:file)\"\n> +\techo modified >expect &&\n> +\tgit show HEAD:file >actual &&\n> +\ttest_cmp expect actual\n>  '\n>  \n>  test_expect_success 'pull --rebase succeeds with dirty working directory and rebase.autostash set' '\n> @@ -381,7 +385,9 @@ test_expect_success 'pull.rebase' '\n>  \ttest_config pull.rebase true &&\n>  \tgit pull . copy &&\n>  \ttest_cmp_rev HEAD^ copy &&\n> -\ttest new = \"$(git show HEAD:file2)\"\n> +\techo new >expect &&\n> +\tgit show HEAD:file2 >actual &&\n> +\ttest_cmp expect actual\n>  '\n>  \n>  test_expect_success 'pull --autostash & pull.rebase=true' '\n> @@ -399,7 +405,9 @@ test_expect_success 'branch.to-rebase.rebase' '\n>  \ttest_config branch.to-rebase.rebase true &&\n>  \tgit pull . copy &&\n>  \ttest_cmp_rev HEAD^ copy &&\n> -\ttest new = \"$(git show HEAD:file2)\"\n> +\techo new >expect &&\n> +\tgit show HEAD:file2 >actual &&\n> +\ttest_cmp expect actual\n>  '\n>  \n>  test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n> @@ -408,14 +416,18 @@ test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n>  \ttest_config branch.to-rebase.rebase false &&\n>  \tgit pull . copy &&\n>  \ttest_cmp_rev ! HEAD^ copy &&\n> -\ttest new = \"$(git show HEAD:file2)\"\n> +\techo new >expect &&\n> +\tgit show HEAD:file2 >actual &&\n> +\ttest_cmp expect actual\n>  '\n>  \n>  test_expect_success 'pull --rebase warns on --verify-signatures' '\n>  \tgit reset --hard before-rebase &&\n>  \tgit pull --rebase --verify-signatures . copy 2>err &&\n>  \ttest_cmp_rev HEAD^ copy &&\n> -\ttest new = \"$(git show HEAD:file2)\" &&\n> +\techo new >expect &&\n> +\tgit show HEAD:file2 >actual &&\n> +\ttest_cmp expect actual &&\n>  \ttest_i18ngrep \"ignoring --verify-signatures for rebase\" err\n>  '\n>  \n> @@ -423,7 +435,9 @@ test_expect_success 'pull --rebase does not warn on --no-verify-signatures' '\n>  \tgit reset --hard before-rebase &&\n>  \tgit pull --rebase --no-verify-signatures . copy 2>err &&\n>  \ttest_cmp_rev HEAD^ copy &&\n> -\ttest new = \"$(git show HEAD:file2)\" &&\n> +\techo new >expect &&\n> +\tgit show HEAD:file2 >actual &&\n> +\ttest_cmp expect actual &&\n>  \ttest_i18ngrep ! \"verify-signatures\" err\n>  '\n>  \n> @@ -445,7 +459,9 @@ test_expect_success 'pull.rebase=false create a new merge commit' '\n>  \tgit pull . copy &&\n>  \ttest_cmp_rev HEAD^1 before-preserve-rebase &&\n>  \ttest_cmp_rev HEAD^2 copy &&\n> -\ttest file3 = \"$(git show HEAD:file3.t)\"\n> +\techo file3 >expect &&\n> +\tgit show HEAD:file3.t >actual &&\n> +\ttest_cmp expect actual\n>  '\n>  \n>  test_expect_success 'pull.rebase=true flattens keep-merge' '\n> @@ -453,7 +469,9 @@ test_expect_success 'pull.rebase=true flattens keep-merge' '\n>  \ttest_config pull.rebase true &&\n>  \tgit pull . copy &&\n>  \ttest_cmp_rev HEAD^^ copy &&\n> -\ttest file3 = \"$(git show HEAD:file3.t)\"\n> +\techo file3 >expect &&\n> +\tgit show HEAD:file3.t >actual &&\n> +\ttest_cmp expect actual\n>  '\n>  \n>  test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' '\n> @@ -461,7 +479,9 @@ test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' '\n>  \ttest_config pull.rebase 1 &&\n>  \tgit pull . copy &&\n>  \ttest_cmp_rev HEAD^^ copy &&\n> -\ttest file3 = \"$(git show HEAD:file3.t)\"\n> +\techo file3 >expect &&\n> +\tgit show HEAD:file3.t >actual &&\n> +\ttest_cmp expect actual\n>  '\n>  \n>  test_expect_success REBASE_P \\\n> @@ -507,7 +527,9 @@ test_expect_success '--rebase=false create a new merge commit' '\n>  \tgit pull --rebase=false . copy &&\n>  \ttest_cmp_rev HEAD^1 before-preserve-rebase &&\n>  \ttest_cmp_rev HEAD^2 copy &&\n> -\ttest file3 = \"$(git show HEAD:file3.t)\"\n> +\techo file3 >expect &&\n> +\tgit show HEAD:file3.t >actual &&\n> +\ttest_cmp expect actual\n>  '\n>  \n>  test_expect_success '--rebase=true rebases and flattens keep-merge' '\n> @@ -515,7 +537,9 @@ test_expect_success '--rebase=true rebases and flattens keep-merge' '\n>  \ttest_config pull.rebase preserve &&\n>  \tgit pull --rebase=true . copy &&\n>  \ttest_cmp_rev HEAD^^ copy &&\n> -\ttest file3 = \"$(git show HEAD:file3.t)\"\n> +\techo file3 >expect &&\n> +\tgit show HEAD:file3.t >actual &&\n> +\ttest_cmp expect actual\n>  '\n>  \n>  test_expect_success REBASE_P \\\n> @@ -537,7 +561,9 @@ test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-m\n>  \ttest_config pull.rebase preserve &&\n>  \tgit pull --rebase . copy &&\n>  \ttest_cmp_rev HEAD^^ copy &&\n> -\ttest file3 = \"$(git show HEAD:file3.t)\"\n> +\techo file3 >expect &&\n> +\tgit show HEAD:file3.t >actual &&\n> +\ttest_cmp expect actual\n>  '\n>  \n>  test_expect_success '--rebase with rebased upstream' '\n> @@ -622,10 +648,16 @@ test_expect_success 'pull --rebase fails on unborn branch with staged changes' '\n>  \t\tcd empty_repo2 &&\n>  \t\techo staged-file >staged-file &&\n>  \t\tgit add staged-file &&\n> -\t\ttest \"$(git ls-files)\" = staged-file &&\n> +\t\techo staged-file >expect &&\n> +\t\tgit ls-files >actual &&\n> +\t\ttest_cmp expect actual &&\n>  \t\ttest_must_fail git pull --rebase .. master 2>err &&\n> -\t\ttest \"$(git ls-files)\" = staged-file &&\n> -\t\ttest \"$(git show :staged-file)\" = staged-file &&\n> +\t\techo staged-file >expect &&\n> +\t\tgit ls-files >actual &&\n> +\t\ttest_cmp expect actual &&\n> +\t\techo staged-file >expect &&\n> +\t\tgit show :staged-file >actual &&\n> +\t\ttest_cmp expect actual &&\n>  \t\ttest_i18ngrep \"unborn branch with changes added to the index\" err\n>  \t)\n>  '\n"},{"id":"385983","messageId":"xmqq5zjpfux2.fsf@gitster-ct.c.googlers.com","threadId":"52061","inReplyTo":"3c58df27c4b9f405bfc5c163e36a928a75ce8239.1573517561.git.liu.denton@gmail.com","subject":"Re: [PATCH v5 01/14] t: teach test_cmp_rev to accept ! for not-equals","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-11-12T06:52:41Z","receivedAt":"2019-11-12T06:52:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Denton Liu <liu.denton@gmail.com> writes:\n\n> +# Tests that its two parameters refer to the same revision, or if '!' is\n> +# provided first, that its other two parameters refer to different\n> +# revisions.\n>  test_cmp_rev () {\n> +\tlocal op\n> +\top='='\n> +\tif test $# -ge 1 && test \"x$1\" = 'x!'\n> +\tthen\n> +\t    op='!='\n> +\t    shift\n> +\tfi\n\nNot that it is all that important, but how about setting up comp_out\nup here at the same time?  I.e.\n\n\n\tlocal op comp_out\n\n\tif ...\n\tthen\n\t\top=\"!=\" comp_out=\"the same\"\n\t\tshift\n\telse\n\t\top=\"=\" comp_out=different\n\tfi\n\nThat way, we can lose 7 lines down there, while spending only one\nline up here, collecting all the things that conditional on '!' on\nthe command line in one place.\n\nI would have named the message variable \"$wrong_result\" or\nsomething, by the way, i.e. \"two revisions point to $wrong_result\nobjects\".\n\nThanks.  Will queue the whole thing.\n\n>  \tif test $# != 2\n>  \tthen\n>  \t\terror \"bug in the test script: test_cmp_rev requires two revisions, but got $#\"\n>  \telse\n>  \t\tlocal r1 r2\n>  \t\tr1=$(git rev-parse --verify \"$1\") &&\n> -\t\tr2=$(git rev-parse --verify \"$2\") &&\n> -\t\tif test \"$r1\" != \"$r2\"\n> +\t\tr2=$(git rev-parse --verify \"$2\") || return 1\n> +\n> +\t\tif ! test \"$r1\" \"$op\" \"$r2\"\n>  \t\tthen\n> +\t\t\tlocal comp_out\n> +\t\t\tif \"x$op\" = 'x='\n> +\t\t\tthen\n> +\t\t\t\tcomp_out='different'\n> +\t\t\telse\n> +\t\t\t\tcomp_out='the same'\n> +\t\t\tfi\n>  \t\t\tcat >&4 <<-EOF\n> -\t\t\terror: two revisions point to different objects:\n> +\t\t\terror: two revisions point to $comp_out objects:\n>  \t\t\t  '$1': $r1\n>  \t\t\t  '$2': $r2\n>  \t\t\tEOF\n"},{"id":"386041","messageId":"018d2035e0c830d0e184ff209f3f75dd291aa30f.1573587373.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"xmqq5zjpfux2.fsf@gitster-ct.c.googlers.com","subject":"[PATCH] fixup! t: teach test_cmp_rev to accept ! for not-equals","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T19:38:13Z","receivedAt":"2019-11-12T19:38:20Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Signed-off-by: Denton Liu <liu.denton@gmail.com>\n---\nThanks for the suggestion, Junio. Since it's just a minor cleanup,\nhere's the fixup patch for it.\n\n t/test-lib-functions.sh | 13 ++++---------\n 1 file changed, 4 insertions(+), 9 deletions(-)\n\ndiff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh\nindex 01cdbb0478..15f4c96777 100644\n--- a/t/test-lib-functions.sh\n+++ b/t/test-lib-functions.sh\n@@ -1016,11 +1016,13 @@ test_must_be_empty () {\n # provided first, that its other two parameters refer to different\n # revisions.\n test_cmp_rev () {\n-\tlocal op\n+\tlocal op wrong_result\n \top='='\n+\twrong_result='different'\n \tif test $# -ge 1 && test \"x$1\" = 'x!'\n \tthen\n \t    op='!='\n+\t    wrong_result='the same'\n \t    shift\n \tfi\n \tif test $# != 2\n@@ -1033,15 +1035,8 @@ test_cmp_rev () {\n \n \t\tif ! test \"$r1\" \"$op\" \"$r2\"\n \t\tthen\n-\t\t\tlocal comp_out\n-\t\t\tif \"x$op\" = 'x='\n-\t\t\tthen\n-\t\t\t\tcomp_out='different'\n-\t\t\telse\n-\t\t\t\tcomp_out='the same'\n-\t\t\tfi\n \t\t\tcat >&4 <<-EOF\n-\t\t\terror: two revisions point to $comp_out objects:\n+\t\t\terror: two revisions point to $wrong_result objects:\n \t\t\t  '$1': $r1\n \t\t\t  '$2': $r2\n \t\t\tEOF\n-- \n2.24.0.300.g722ba42680\n\n"},{"id":"386050","messageId":"20191112230637.GA61654@generichostname","threadId":"52061","inReplyTo":"xmqqh839fzbm.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH v5 10/14] t5520: test single-line files by git with test_cmp","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T23:06:37Z","receivedAt":"2019-11-12T23:06:42Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Hi Junio,\n\nOn Tue, Nov 12, 2019 at 02:17:33PM +0900, Junio C Hamano wrote:\n> Denton Liu <liu.denton@gmail.com> writes:\n> \n> > In case an invocation of a Git command fails within the subshell, the\n> > failure will be masked. Replace the subshell with a file-redirection and\n> > a call to test_cmp.\n> \n> I.e.\n> \n>     test \"$(git cmd args)\" = \"expected-string\"\n> \n> =>\n> \n>     git cmd args >actual && echo \"expected-string\" >expect &&\n>     test_cmp expect actual\n> \n> which makes sense.  It may break if expected-string begins with a\n> dash or something silly like that, but a quick eyeballing over the\n> patch tells me that we are safe there.\n> \n> Technically, \"$(git cmd args)\" used as a command line option of\n> another command is called \"command substitution\", not \"subshell\".\n> The proposed log message may need to be updated.\n\nOkay, I'll send out a new reroll with some log message cleanup.\n\n> \n> > This change was done with the following GNU sed expressions:\n> >\n> > \ts/\\(\\s*\\)test \\([^ ]*\\) = \"$(\\(git [^)]*\\))\"/\\1echo \\2 >expect \\&\\&\\n\\1\\3 >actual \\&\\&\\n\\1test_cmp expect actual/\n> > \ts/\\(\\s*\\)test \"$(\\(git [^)]*\\))\" = \\([^ ]*\\)/\\1echo \\3 >expect \\&\\&\\n\\1\\2 >actual \\&\\&\\n\\1test_cmp expect actual/\n> >\n> > A future patch will clean up situations where we have multiple duplicate\n> > statements within a test case. This is done to keep this patch purely\n> > mechanical.\n> \n> OK.  One thing that worries me is if the existing tests are not\n> expecting (no pun intended) to see 'expect' or 'actual' (e.g. if\n> they somehow rely on output of \"ls-files -u\", we are now adding two\n> untracked files in the working tree).\n\nDo you mean `ls-files -o`? I think `-u` means \"unmerged\" while `-o`\nmeans \"others\" (or \"untracked\"). This test doesn't have any instances of\n`-o` being used.\n\n> Another is if the git command\n> is expected to produce nothing, possibly after failing, and the test\n> is expecting to see an empty string---in such a case, the hiding of\n> the exit status would have been intentional ;-)  We'd want to be sure\n> that we aren't breaking the tests like that by reading through the\n> result of applying this patch.\n> \n> Since this is just a single file, I trust you have already done such\n> sanity checking ;-)\n\nThanks for double-checking on me. I have, indeed, manually verified the\nchanges.\n\n> \n> The mechanical conversion procedure itself looks OK.\n> \n> Thanks.\n"},{"id":"386051","messageId":"cover.1573595985.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573517561.git.liu.denton@gmail.com","subject":"[PATCH v6 00/14] t5520: various test cleanup","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T23:07:43Z","receivedAt":"2019-11-12T23:07:47Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Thanks for the comments on the last round, Junio.\n\nPlease ignore the fixup patch from earlier, it has been bundled into\nthis reroll.\n\n\nLike earlier patchsets, I want to implement a feature that involves\nmodifications to the test suite. Since that feature will probably take a\nwhile to polish up, however, let's clean up the test suite in a separate\npatchset first so it's not blocked by the feature work.\n\n1/15 is a general improvement to test_rev_cmp() that will be used later\nin the series.\n\nChanges since v5:\n\n* More test_cmp_rev() cleanup\n\n* Changed instances of \"subshell\" to \"command substitution\" where appropriate\n\n* Change instances of \"Git\" to \"git\" when we are referring to the command\n\nChanges since v4:\n\n* Cleaned up test_cmp_rev() logic with suggestions from Junio\n\nChanges since v3:\n\n* Rebased and tested on top of v2.24.0\n\nChanges since v2:\n\n* Drop 't7408: replace `test_must_fail test_path_is_file`' since it's\n  not a rabbit hole we want to go into right now\n\n* Fix the output of `test_cmp_rev !` when revs are actually equal\n\n* Rebase against the latest master since this topic hasn't been picked\n  up yet\n\nChanges since v1:\n\n* Incorporate Eric's feedback\n\nDenton Liu (14):\n  t: teach test_cmp_rev to accept ! for not-equals\n  t5520: improve test style\n  t5520: use sq for test case names\n  t5520: let sed open its own input\n  t5520: replace test -f with test-lib functions\n  t5520: remove spaces after redirect operator\n  t5520: use test_line_count where possible\n  t5520: replace test -{n,z} with test-lib functions\n  t5520: use test_cmp_rev where possible\n  t5520: test single-line files by git with test_cmp\n  t5520: don't put git in upstream of pipe\n  t5520: replace $(cat ...) comparison with test_cmp\n  t5520: remove redundant lines in test cases\n  t5520: replace `! git` with `test_must_fail git`\n\n t/t2400-worktree-add.sh             |   4 +-\n t/t3400-rebase.sh                   |   2 +-\n t/t3421-rebase-topology-linear.sh   |   6 +-\n t/t3430-rebase-merges.sh            |   2 +-\n t/t3432-rebase-fast-forward.sh      |   2 +-\n t/t3501-revert-cherry-pick.sh       |   2 +-\n t/t3508-cherry-pick-many-commits.sh |   2 +-\n t/t5520-pull.sh                     | 343 +++++++++++++++++-----------\n t/test-lib-functions.sh             |  20 +-\n 9 files changed, 231 insertions(+), 152 deletions(-)\n\nRange-diff against v5:\n 1:  85fac754e2 !  1:  0532847787 t: teach test_cmp_rev to accept ! for not-equals\n    @@ t/test-lib-functions.sh: test_must_be_empty () {\n     +# provided first, that its other two parameters refer to different\n     +# revisions.\n      test_cmp_rev () {\n    -+\tlocal op\n    ++\tlocal op wrong_result\n     +\top='='\n    ++\twrong_result='different'\n     +\tif test $# -ge 1 && test \"x$1\" = 'x!'\n     +\tthen\n     +\t    op='!='\n    ++\t    wrong_result='the same'\n     +\t    shift\n     +\tfi\n      \tif test $# != 2\n    @@ t/test-lib-functions.sh: test_must_be_empty () {\n     +\n     +\t\tif ! test \"$r1\" \"$op\" \"$r2\"\n      \t\tthen\n    -+\t\t\tlocal comp_out\n    -+\t\t\tif \"x$op\" = 'x='\n    -+\t\t\tthen\n    -+\t\t\t\tcomp_out='different'\n    -+\t\t\telse\n    -+\t\t\t\tcomp_out='the same'\n    -+\t\t\tfi\n      \t\t\tcat >&4 <<-EOF\n     -\t\t\terror: two revisions point to different objects:\n    -+\t\t\terror: two revisions point to $comp_out objects:\n    ++\t\t\terror: two revisions point to $wrong_result objects:\n      \t\t\t  '$1': $r1\n      \t\t\t  '$2': $r2\n      \t\t\tEOF\n 2:  2b1caec3d7 =  2:  aa3f2e3395 t5520: improve test style\n 3:  1aa0cdad1c =  3:  99b0fb0e1c t5520: use sq for test case names\n 4:  edd4446554 =  4:  0660aa3fff t5520: let sed open its own input\n 5:  c5d5966405 =  5:  00b7143b30 t5520: replace test -f with test-lib functions\n 6:  6a99400ba4 =  6:  c451940c5b t5520: remove spaces after redirect operator\n 7:  b7b66b13f6 =  7:  8e1c90eb70 t5520: use test_line_count where possible\n 8:  07517c868c !  8:  8043b230a7 t5520: replace test -{n,z} with test-lib functions\n    @@ Metadata\n      ## Commit message ##\n         t5520: replace test -{n,z} with test-lib functions\n     \n    -    When wrapping a Git command in a subshell within another command, we\n    -    throw away the Git command's exit code. In case the Git command fails,\n    -    we would like to know about it rather than the failure being silent.\n    -    Extract Git commands so that their exit codes are not lost.\n    +    When wrapping a git command in a command substitution within another\n    +    command, we throw away the git command's exit code. In case the git\n    +    command fails, we would like to know about it rather than the failure\n    +    being silent. Extract git commands so that their exit codes are not\n    +    lost.\n     \n         Instead of using `test -n` or `test -z`, replace them respectively with\n         invocations of test_file_not_empty() and test_must_be_empty() so that we\n 9:  29d9ff3b21 !  9:  7f5347bb40 t5520: use test_cmp_rev where possible\n    @@ Metadata\n      ## Commit message ##\n         t5520: use test_cmp_rev where possible\n     \n    -    In case an invocation of `git rev-list` fails within the subshell, the\n    -    failure will be masked. Remove the subshell and use test_cmp_rev() so\n    -    that failures can be discovered.\n    +    In case an invocation of `git rev-list` fails within the command\n    +    substitution, the failure will be masked. Remove the command\n    +    substitution and use test_cmp_rev() so that failures can be discovered.\n     \n         This change was done with the following sed expressions:\n     \n10:  aeaa3374a7 ! 10:  73004d6cc3 t5520: test single-line files by git with test_cmp\n    @@ Metadata\n      ## Commit message ##\n         t5520: test single-line files by git with test_cmp\n     \n    -    In case an invocation of a Git command fails within the subshell, the\n    -    failure will be masked. Replace the subshell with a file-redirection and\n    -    a call to test_cmp.\n    +    In case an invocation of a git command fails within the command\n    +    substitution, the failure will be masked. Replace the command\n    +    substitution with a file-redirection and a call to test_cmp.\n     \n         This change was done with the following GNU sed expressions:\n     \n11:  131609fc5c ! 11:  463f5c11b9 t5520: don't put git in upstream of pipe\n    @@ Commit message\n     \n         Before, if the invocation of git failed, it would be masked by the pipe\n         since only the return code of the last element of a pipe is used.\n    -    Rewrite the test to put the Git command on its own line so its return\n    +    Rewrite the test to put the git command on its own line so its return\n         code is not masked.\n     \n      ## t/t5520-pull.sh ##\n12:  c67be3d18c ! 12:  67ea3f0238 t5520: replace subshell cat comparison with test_cmp\n    @@ Metadata\n     Author: Denton Liu <liu.denton@gmail.com>\n     \n      ## Commit message ##\n    -    t5520: replace subshell cat comparison with test_cmp\n    +    t5520: replace $(cat ...) comparison with test_cmp\n     \n         We currently have many instances of `test <line> = $(cat <file>)` and\n         `test $(cat <file>) = <line>`.  In the case where this fails, it will be\n13:  04ef898857 = 13:  b45c088d20 t5520: remove redundant lines in test cases\n14:  153ff07dc0 ! 14:  c605afa537 t5520: replace `! git` with `test_must_fail git`\n    @@ Metadata\n      ## Commit message ##\n         t5520: replace `! git` with `test_must_fail git`\n     \n    -    Currently, if a Git command fails in an unexpected way, such as a\n    +    Currently, if a git command fails in an unexpected way, such as a\n         segfault, it will be masked and ignored. Replace the ! with\n         test_must_fail so that only expected failures pass.\n     \n-- \n2.24.0.346.gee0de6d492\n\n"},{"id":"386052","messageId":"0532847787dfd48fbe4b41a4a7d2783748f3bd7f.1573595985.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573595985.git.liu.denton@gmail.com","subject":"[PATCH v6 01/14] t: teach test_cmp_rev to accept ! for not-equals","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T23:07:45Z","receivedAt":"2019-11-12T23:07:51Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"In the case where we are using test_cmp_rev() to report not-equals, we\nwrite `! test_cmp_rev`. However, since test_cmp_rev() contains\n\n\tr1=$(git rev-parse --verify \"$1\") &&\n\tr2=$(git rev-parse --verify \"$2\") &&\n\n`! test_cmp_rev` will succeed if any of the rev-parses fail. This\nbehavior is not desired. We want the rev-parses to _always_ be\nsuccessful.\n\nRewrite test_cmp_rev() to optionally accept \"!\" as the first argument to\ndo a not-equals comparison. Rewrite `! test_cmp_rev` to `test_cmp_rev !`\nin all tests to take advantage of this new functionality.\n\nAlso, rewrite the rev-parse logic to end with a `|| return 1` instead of\n&&-chaining into the rev-comparison logic. This makes it obvious to\nfuture readers that we explicitly intend on returning early if either of\nthe rev-parses fail.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t2400-worktree-add.sh             |  4 ++--\n t/t3400-rebase.sh                   |  2 +-\n t/t3421-rebase-topology-linear.sh   |  6 +++---\n t/t3430-rebase-merges.sh            |  2 +-\n t/t3432-rebase-fast-forward.sh      |  2 +-\n t/t3501-revert-cherry-pick.sh       |  2 +-\n t/t3508-cherry-pick-many-commits.sh |  2 +-\n t/test-lib-functions.sh             | 20 ++++++++++++++++----\n 8 files changed, 26 insertions(+), 14 deletions(-)\n\ndiff --git a/t/t2400-worktree-add.sh b/t/t2400-worktree-add.sh\nindex e819ba741e..52d476979b 100755\n--- a/t/t2400-worktree-add.sh\n+++ b/t/t2400-worktree-add.sh\n@@ -438,7 +438,7 @@ test_expect_success 'git worktree add does not match remote' '\n \t\tcd foo &&\n \t\ttest_must_fail git config \"branch.foo.remote\" &&\n \t\ttest_must_fail git config \"branch.foo.merge\" &&\n-\t\t! test_cmp_rev refs/remotes/repo_a/foo refs/heads/foo\n+\t\ttest_cmp_rev ! refs/remotes/repo_a/foo refs/heads/foo\n \t)\n '\n \n@@ -483,7 +483,7 @@ test_expect_success 'git worktree --no-guess-remote option overrides config' '\n \t\tcd foo &&\n \t\ttest_must_fail git config \"branch.foo.remote\" &&\n \t\ttest_must_fail git config \"branch.foo.merge\" &&\n-\t\t! test_cmp_rev refs/remotes/repo_a/foo refs/heads/foo\n+\t\ttest_cmp_rev ! refs/remotes/repo_a/foo refs/heads/foo\n \t)\n '\n \ndiff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh\nindex ab18ac5f28..f267f6cd54 100755\n--- a/t/t3400-rebase.sh\n+++ b/t/t3400-rebase.sh\n@@ -64,7 +64,7 @@ test_expect_success 'rebase sets ORIG_HEAD to pre-rebase state' '\n \tpre=\"$(git rev-parse --verify HEAD)\" &&\n \tgit rebase master &&\n \ttest_cmp_rev \"$pre\" ORIG_HEAD &&\n-\t! test_cmp_rev \"$pre\" HEAD\n+\ttest_cmp_rev ! \"$pre\" HEAD\n '\n \n test_expect_success 'rebase, with <onto> and <upstream> specified as :/quuxery' '\ndiff --git a/t/t3421-rebase-topology-linear.sh b/t/t3421-rebase-topology-linear.sh\nindex b847064f91..325072b0a3 100755\n--- a/t/t3421-rebase-topology-linear.sh\n+++ b/t/t3421-rebase-topology-linear.sh\n@@ -61,7 +61,7 @@ test_run_rebase () {\n \ttest_expect_$result \"rebase $* -f rewrites even if upstream is an ancestor\" \"\n \t\treset_rebase &&\n \t\tgit rebase $* -f b e &&\n-\t\t! test_cmp_rev e HEAD &&\n+\t\ttest_cmp_rev ! e HEAD &&\n \t\ttest_cmp_rev b HEAD~2 &&\n \t\ttest_linear_range 'd e' b..\n \t\"\n@@ -78,7 +78,7 @@ test_run_rebase () {\n \ttest_expect_$result \"rebase $* -f rewrites even if remote upstream is an ancestor\" \"\n \t\treset_rebase &&\n \t\tgit rebase $* -f branch-b branch-e &&\n-\t\t! test_cmp_rev branch-e origin/branch-e &&\n+\t\ttest_cmp_rev ! branch-e origin/branch-e &&\n \t\ttest_cmp_rev branch-b HEAD~2 &&\n \t\ttest_linear_range 'd e' branch-b..\n \t\"\n@@ -368,7 +368,7 @@ test_run_rebase () {\n \ttest_expect_$result \"rebase $* -f --root on linear history causes re-write\" \"\n \t\treset_rebase &&\n \t\tgit rebase $* -f --root c &&\n-\t\t! test_cmp_rev a HEAD~2 &&\n+\t\ttest_cmp_rev ! a HEAD~2 &&\n \t\ttest_linear_range 'a b c' HEAD\n \t\"\n }\ndiff --git a/t/t3430-rebase-merges.sh b/t/t3430-rebase-merges.sh\nindex 9efcf4808a..abbdc26b1b 100755\n--- a/t/t3430-rebase-merges.sh\n+++ b/t/t3430-rebase-merges.sh\n@@ -346,7 +346,7 @@ test_expect_success 'A root commit can be a cousin, treat it that way' '\n \tgit merge --allow-unrelated-histories khnum &&\n \ttest_tick &&\n \tgit rebase -f -r HEAD^ &&\n-\t! test_cmp_rev HEAD^2 khnum &&\n+\ttest_cmp_rev ! HEAD^2 khnum &&\n \ttest_cmp_graph HEAD^.. <<-\\EOF &&\n \t*   Merge branch '\\''khnum'\\'' into asherah\n \t|\\\ndiff --git a/t/t3432-rebase-fast-forward.sh b/t/t3432-rebase-fast-forward.sh\nindex 034ffc7e76..92f95b57da 100755\n--- a/t/t3432-rebase-fast-forward.sh\n+++ b/t/t3432-rebase-fast-forward.sh\n@@ -64,7 +64,7 @@ test_rebase_same_head_ () {\n \t\t\ttest_cmp_rev \\$oldhead \\$newhead\n \t\telif test $cmp = diff\n \t\tthen\n-\t\t\t! test_cmp_rev \\$oldhead \\$newhead\n+\t\t\ttest_cmp_rev ! \\$oldhead \\$newhead\n \t\tfi\n \t\"\n }\ndiff --git a/t/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh\nindex d1c68af8c5..1c51a9131d 100755\n--- a/t/t3501-revert-cherry-pick.sh\n+++ b/t/t3501-revert-cherry-pick.sh\n@@ -106,7 +106,7 @@ test_expect_success 'cherry-pick on unborn branch' '\n \trm -rf * &&\n \tgit cherry-pick initial &&\n \tgit diff --quiet initial &&\n-\t! test_cmp_rev initial HEAD\n+\ttest_cmp_rev ! initial HEAD\n '\n \n test_expect_success 'cherry-pick \"-\" to pick from previous branch' '\ndiff --git a/t/t3508-cherry-pick-many-commits.sh b/t/t3508-cherry-pick-many-commits.sh\nindex b457333e18..23070a7b73 100755\n--- a/t/t3508-cherry-pick-many-commits.sh\n+++ b/t/t3508-cherry-pick-many-commits.sh\n@@ -5,7 +5,7 @@ test_description='test cherry-picking many commits'\n . ./test-lib.sh\n \n check_head_differs_from() {\n-\t! test_cmp_rev HEAD \"$1\"\n+\ttest_cmp_rev ! HEAD \"$1\"\n }\n \n check_head_equals() {\ndiff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh\nindex b299ecc326..15f4c96777 100644\n--- a/t/test-lib-functions.sh\n+++ b/t/test-lib-functions.sh\n@@ -1012,19 +1012,31 @@ test_must_be_empty () {\n \tfi\n }\n \n-# Tests that its two parameters refer to the same revision\n+# Tests that its two parameters refer to the same revision, or if '!' is\n+# provided first, that its other two parameters refer to different\n+# revisions.\n test_cmp_rev () {\n+\tlocal op wrong_result\n+\top='='\n+\twrong_result='different'\n+\tif test $# -ge 1 && test \"x$1\" = 'x!'\n+\tthen\n+\t    op='!='\n+\t    wrong_result='the same'\n+\t    shift\n+\tfi\n \tif test $# != 2\n \tthen\n \t\terror \"bug in the test script: test_cmp_rev requires two revisions, but got $#\"\n \telse\n \t\tlocal r1 r2\n \t\tr1=$(git rev-parse --verify \"$1\") &&\n-\t\tr2=$(git rev-parse --verify \"$2\") &&\n-\t\tif test \"$r1\" != \"$r2\"\n+\t\tr2=$(git rev-parse --verify \"$2\") || return 1\n+\n+\t\tif ! test \"$r1\" \"$op\" \"$r2\"\n \t\tthen\n \t\t\tcat >&4 <<-EOF\n-\t\t\terror: two revisions point to different objects:\n+\t\t\terror: two revisions point to $wrong_result objects:\n \t\t\t  '$1': $r1\n \t\t\t  '$2': $r2\n \t\t\tEOF\n-- \n2.24.0.346.gee0de6d492\n\n"},{"id":"386053","messageId":"aa3f2e33958be1ab684b3a185e5c5467d2f978f0.1573595985.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573595985.git.liu.denton@gmail.com","subject":"[PATCH v6 02/14] t5520: improve test style","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T23:07:48Z","receivedAt":"2019-11-12T23:07:53Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Improve the test style by removing leading and trailing empty lines\nwithin test cases. Also, reformat multi-line subshells to conform to the\nexisting style.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 88 +++++++++++++++++++++++++------------------------\n 1 file changed, 45 insertions(+), 43 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex cf4cc32fd0..51d6ce8aec 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -538,7 +538,6 @@ test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-m\n '\n \n test_expect_success '--rebase with rebased upstream' '\n-\n \tgit remote add -f me . &&\n \tgit checkout copy &&\n \tgit tag copy-orig &&\n@@ -552,7 +551,6 @@ test_expect_success '--rebase with rebased upstream' '\n \tgit pull --rebase me copy &&\n \ttest \"conflicting modification\" = \"$(cat file)\" &&\n \ttest file = \"$(cat file2)\"\n-\n '\n \n test_expect_success '--rebase -f with rebased upstream' '\n@@ -564,14 +562,12 @@ test_expect_success '--rebase -f with rebased upstream' '\n '\n \n test_expect_success '--rebase with rebased default upstream' '\n-\n \tgit update-ref refs/remotes/me/copy copy-orig &&\n \tgit checkout --track -b to-rebase2 me/copy &&\n \tgit reset --hard to-rebase-orig &&\n \tgit pull --rebase &&\n \ttest \"conflicting modification\" = \"$(cat file)\" &&\n \ttest file = \"$(cat file2)\"\n-\n '\n \n test_expect_success 'rebased upstream + fetch + pull --rebase' '\n@@ -588,7 +584,6 @@ test_expect_success 'rebased upstream + fetch + pull --rebase' '\n '\n \n test_expect_success 'pull --rebase dies early with dirty working directory' '\n-\n \tgit checkout to-rebase &&\n \tgit update-ref refs/remotes/me/copy copy^ &&\n \tCOPY=\"$(git rev-parse --verify me/copy)\" &&\n@@ -603,16 +598,16 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '\n \tgit checkout HEAD -- file &&\n \tgit pull &&\n \ttest \"$COPY\" != \"$(git rev-parse --verify me/copy)\"\n-\n '\n \n test_expect_success 'pull --rebase works on branch yet to be born' '\n \tgit rev-parse master >expect &&\n \tmkdir empty_repo &&\n-\t(cd empty_repo &&\n-\t git init &&\n-\t git pull --rebase .. master &&\n-\t git rev-parse HEAD >../actual\n+\t(\n+\t\tcd empty_repo &&\n+\t\tgit init &&\n+\t\tgit pull --rebase .. master &&\n+\t\tgit rev-parse HEAD >../actual\n \t) &&\n \ttest_cmp expect actual\n '\n@@ -646,58 +641,65 @@ test_expect_success 'pull --rebase fails on corrupt HEAD' '\n \n test_expect_success 'setup for detecting upstreamed changes' '\n \tmkdir src &&\n-\t(cd src &&\n-\t git init &&\n-\t printf \"1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n10\\n\" > stuff &&\n-\t git add stuff &&\n-\t git commit -m \"Initial revision\"\n+\t(\n+\t\tcd src &&\n+\t\tgit init &&\n+\t\tprintf \"1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n10\\n\" > stuff &&\n+\t\tgit add stuff &&\n+\t\tgit commit -m \"Initial revision\"\n \t) &&\n \tgit clone src dst &&\n-\t(cd src &&\n-\t modify s/5/43/ stuff &&\n-\t git commit -a -m \"5->43\" &&\n-\t modify s/6/42/ stuff &&\n-\t git commit -a -m \"Make it bigger\"\n+\t(\n+\t\tcd src &&\n+\t\tmodify s/5/43/ stuff &&\n+\t\tgit commit -a -m \"5->43\" &&\n+\t\tmodify s/6/42/ stuff &&\n+\t\tgit commit -a -m \"Make it bigger\"\n \t) &&\n-\t(cd dst &&\n-\t modify s/5/43/ stuff &&\n-\t git commit -a -m \"Independent discovery of 5->43\"\n+\t(\n+\t\tcd dst &&\n+\t\tmodify s/5/43/ stuff &&\n+\t\tgit commit -a -m \"Independent discovery of 5->43\"\n \t)\n '\n \n test_expect_success 'git pull --rebase detects upstreamed changes' '\n-\t(cd dst &&\n-\t git pull --rebase &&\n-\t test -z \"$(git ls-files -u)\"\n+\t(\n+\t\tcd dst &&\n+\t\tgit pull --rebase &&\n+\t\ttest -z \"$(git ls-files -u)\"\n \t)\n '\n \n test_expect_success 'setup for avoiding reapplying old patches' '\n-\t(cd dst &&\n-\t test_might_fail git rebase --abort &&\n-\t git reset --hard origin/master\n+\t(\n+\t\tcd dst &&\n+\t\ttest_might_fail git rebase --abort &&\n+\t\tgit reset --hard origin/master\n \t) &&\n \tgit clone --bare src src-replace.git &&\n \trm -rf src &&\n \tmv src-replace.git src &&\n-\t(cd dst &&\n-\t modify s/2/22/ stuff &&\n-\t git commit -a -m \"Change 2\" &&\n-\t modify s/3/33/ stuff &&\n-\t git commit -a -m \"Change 3\" &&\n-\t modify s/4/44/ stuff &&\n-\t git commit -a -m \"Change 4\" &&\n-\t git push &&\n-\n-\t modify s/44/55/ stuff &&\n-\t git commit --amend -a -m \"Modified Change 4\"\n+\t(\n+\t\tcd dst &&\n+\t\tmodify s/2/22/ stuff &&\n+\t\tgit commit -a -m \"Change 2\" &&\n+\t\tmodify s/3/33/ stuff &&\n+\t\tgit commit -a -m \"Change 3\" &&\n+\t\tmodify s/4/44/ stuff &&\n+\t\tgit commit -a -m \"Change 4\" &&\n+\t\tgit push &&\n+\n+\t\tmodify s/44/55/ stuff &&\n+\t\tgit commit --amend -a -m \"Modified Change 4\"\n \t)\n '\n \n test_expect_success 'git pull --rebase does not reapply old patches' '\n-\t(cd dst &&\n-\t test_must_fail git pull --rebase &&\n-\t test 1 = $(find .git/rebase-apply -name \"000*\" | wc -l)\n+\t(\n+\t\tcd dst &&\n+\t\ttest_must_fail git pull --rebase &&\n+\t\ttest 1 = $(find .git/rebase-apply -name \"000*\" | wc -l)\n \t)\n '\n \n-- \n2.24.0.346.gee0de6d492\n\n"},{"id":"386054","messageId":"99b0fb0e1c729090ad1d0e8bf5e6eb1d1cf4679d.1573595985.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573595985.git.liu.denton@gmail.com","subject":"[PATCH v6 03/14] t5520: use sq for test case names","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T23:07:50Z","receivedAt":"2019-11-12T23:07:55Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"The usual convention is for test case names to be written between\nsingle-quotes. Change all double-quoted test case names to single-quotes\nexcept for two test case names that use variables within.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 51d6ce8aec..a3de2e19b6 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -408,7 +408,7 @@ test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n \ttest new = \"$(git show HEAD:file2)\"\n '\n \n-test_expect_success \"pull --rebase warns on --verify-signatures\" '\n+test_expect_success 'pull --rebase warns on --verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --verify-signatures . copy 2>err &&\n \ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n@@ -416,7 +416,7 @@ test_expect_success \"pull --rebase warns on --verify-signatures\" '\n \ttest_i18ngrep \"ignoring --verify-signatures for rebase\" err\n '\n \n-test_expect_success \"pull --rebase does not warn on --no-verify-signatures\" '\n+test_expect_success 'pull --rebase does not warn on --no-verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --no-verify-signatures . copy 2>err &&\n \ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n-- \n2.24.0.346.gee0de6d492\n\n"},{"id":"386055","messageId":"0660aa3ffffefb89307a02a0235fd3f8730ae618.1573595985.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573595985.git.liu.denton@gmail.com","subject":"[PATCH v6 04/14] t5520: let sed open its own input","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T23:07:52Z","receivedAt":"2019-11-12T23:07:57Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"We were using a redirection operator to feed input into sed. However,\nsince sed is capable of opening its own files, make sed open its own\nfiles instead of redirecting input into it.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex a3de2e19b6..55560ce3cd 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -5,7 +5,7 @@ test_description='pulling into void'\n . ./test-lib.sh\n \n modify () {\n-\tsed -e \"$1\" <\"$2\" >\"$2.x\" &&\n+\tsed -e \"$1\" \"$2\" >\"$2.x\" &&\n \tmv \"$2.x\" \"$2\"\n }\n \n-- \n2.24.0.346.gee0de6d492\n\n"},{"id":"386056","messageId":"00b7143b30d6527b25a48e6ba829d635170b6a43.1573595985.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573595985.git.liu.denton@gmail.com","subject":"[PATCH v6 05/14] t5520: replace test -f with test-lib functions","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T23:07:55Z","receivedAt":"2019-11-12T23:08:00Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Although `test -f` has the same functionality as test_path_is_file(), in\nthe case where test_path_is_file() fails, we get much better debugging\ninformation.\n\nReplace `test -f` with test_path_is_file() so that future developers\nwill have a better experience debugging these test cases.\n\nAlso, in the case of `! test -f`, not only should that path not be a\nfile, it shouldn't exist at all so replace it with\ntest_path_is_missing().\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 55560ce3cd..004d5884cd 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -39,8 +39,8 @@ test_expect_success 'pulling into void' '\n \t\tcd cloned &&\n \t\tgit pull ..\n \t) &&\n-\ttest -f file &&\n-\ttest -f cloned/file &&\n+\ttest_path_is_file file &&\n+\ttest_path_is_file cloned/file &&\n \ttest_cmp file cloned/file\n '\n \n@@ -50,8 +50,8 @@ test_expect_success 'pulling into void using master:master' '\n \t\tcd cloned-uho &&\n \t\tgit pull .. master:master\n \t) &&\n-\ttest -f file &&\n-\ttest -f cloned-uho/file &&\n+\ttest_path_is_file file &&\n+\ttest_path_is_file cloned-uho/file &&\n \ttest_cmp file cloned-uho/file\n '\n \n@@ -99,7 +99,7 @@ test_expect_success 'pulling into void must not create an octopus' '\n \t(\n \t\tcd cloned-octopus &&\n \t\ttest_must_fail git pull .. master master &&\n-\t\t! test -f file\n+\t\ttest_path_is_missing file\n \t)\n '\n \n-- \n2.24.0.346.gee0de6d492\n\n"},{"id":"386057","messageId":"c451940c5b5876ce7900c45e40a81e78cf1af890.1573595985.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573595985.git.liu.denton@gmail.com","subject":"[PATCH v6 06/14] t5520: remove spaces after redirect operator","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T23:07:58Z","receivedAt":"2019-11-12T23:08:02Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"The style for tests in Git is to have the redirect operator attached to\nthe filename with no spaces. Fix test cases where this is not the case.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 004d5884cd..7bb9031140 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -243,10 +243,10 @@ test_expect_success 'fast-forward fails with conflicting work tree' '\n \n test_expect_success '--rebase' '\n \tgit branch to-rebase &&\n-\techo modified again > file &&\n+\techo modified again >file &&\n \tgit commit -m file file &&\n \tgit checkout to-rebase &&\n-\techo new > file2 &&\n+\techo new >file2 &&\n \tgit add file2 &&\n \tgit commit -m \"new file\" &&\n \tgit tag before-rebase &&\n@@ -542,10 +542,10 @@ test_expect_success '--rebase with rebased upstream' '\n \tgit checkout copy &&\n \tgit tag copy-orig &&\n \tgit reset --hard HEAD^ &&\n-\techo conflicting modification > file &&\n+\techo conflicting modification >file &&\n \tgit commit -m conflict file &&\n \tgit checkout to-rebase &&\n-\techo file > file2 &&\n+\techo file >file2 &&\n \tgit commit -m to-rebase file2 &&\n \tgit tag to-rebase-orig &&\n \tgit pull --rebase me copy &&\n@@ -591,7 +591,7 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '\n \ttest_config branch.to-rebase.remote me &&\n \ttest_config branch.to-rebase.merge refs/heads/copy &&\n \ttest_config branch.to-rebase.rebase true &&\n-\techo dirty >> file &&\n+\techo dirty >>file &&\n \tgit add file &&\n \ttest_must_fail git pull &&\n \ttest \"$COPY\" = \"$(git rev-parse --verify me/copy)\" &&\n-- \n2.24.0.346.gee0de6d492\n\n"},{"id":"386058","messageId":"8e1c90eb70e4325861d82ae5da9b99a914b28759.1573595985.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573595985.git.liu.denton@gmail.com","subject":"[PATCH v6 07/14] t5520: use test_line_count where possible","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T23:08:00Z","receivedAt":"2019-11-12T23:08:06Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Instead of rolling our own functionality to test the number of lines a\ncommand outputs, use test_line_count() which provides better debugging\ninformation in the case of a failure.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 7bb9031140..0ca4867e96 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -699,7 +699,8 @@ test_expect_success 'git pull --rebase does not reapply old patches' '\n \t(\n \t\tcd dst &&\n \t\ttest_must_fail git pull --rebase &&\n-\t\ttest 1 = $(find .git/rebase-apply -name \"000*\" | wc -l)\n+\t\tfind .git/rebase-apply -name \"000*\" >patches &&\n+\t\ttest_line_count = 1 patches\n \t)\n '\n \n-- \n2.24.0.346.gee0de6d492\n\n"},{"id":"386059","messageId":"8043b230a727b253dbc14e2b9eb5c79d056da673.1573595985.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573595985.git.liu.denton@gmail.com","subject":"[PATCH v6 08/14] t5520: replace test -{n,z} with test-lib functions","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T23:08:02Z","receivedAt":"2019-11-12T23:08:09Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"When wrapping a git command in a command substitution within another\ncommand, we throw away the git command's exit code. In case the git\ncommand fails, we would like to know about it rather than the failure\nbeing silent. Extract git commands so that their exit codes are not\nlost.\n\nInstead of using `test -n` or `test -z`, replace them respectively with\ninvocations of test_file_not_empty() and test_must_be_empty() so that we\nget better debugging information in the case of a failure.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 12 ++++++++----\n 1 file changed, 8 insertions(+), 4 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 0ca4867e96..18225d8430 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -206,15 +206,18 @@ test_expect_success 'fail if the index has unresolved entries' '\n \ttest_when_finished \"git checkout -f copy && git branch -D third\" &&\n \ttest \"$(cat file)\" = file &&\n \ttest_commit modified2 file &&\n-\ttest -z \"$(git ls-files -u)\" &&\n+\tgit ls-files -u >unmerged &&\n+\ttest_must_be_empty unmerged &&\n \ttest_must_fail git pull . second &&\n-\ttest -n \"$(git ls-files -u)\" &&\n+\tgit ls-files -u >unmerged &&\n+\ttest_file_not_empty unmerged &&\n \tcp file expected &&\n \ttest_must_fail git pull . second 2>err &&\n \ttest_i18ngrep \"Pulling is not possible because you have unmerged files.\" err &&\n \ttest_cmp expected file &&\n \tgit add file &&\n-\ttest -z \"$(git ls-files -u)\" &&\n+\tgit ls-files -u >unmerged &&\n+\ttest_must_be_empty unmerged &&\n \ttest_must_fail git pull . second 2>err &&\n \ttest_i18ngrep \"You have not concluded your merge\" err &&\n \ttest_cmp expected file\n@@ -667,7 +670,8 @@ test_expect_success 'git pull --rebase detects upstreamed changes' '\n \t(\n \t\tcd dst &&\n \t\tgit pull --rebase &&\n-\t\ttest -z \"$(git ls-files -u)\"\n+\t\tgit ls-files -u >untracked &&\n+\t\ttest_must_be_empty untracked\n \t)\n '\n \n-- \n2.24.0.346.gee0de6d492\n\n"},{"id":"386060","messageId":"7f5347bb40697a4708708e6c7ae0829575ddde31.1573595985.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573595985.git.liu.denton@gmail.com","subject":"[PATCH v6 09/14] t5520: use test_cmp_rev where possible","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T23:08:05Z","receivedAt":"2019-11-12T23:08:10Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"In case an invocation of `git rev-list` fails within the command\nsubstitution, the failure will be masked. Remove the command\nsubstitution and use test_cmp_rev() so that failures can be discovered.\n\nThis change was done with the following sed expressions:\n\n\ts/test \"$(git rev-parse.* \\([^)]*\\))\" = \"$(git rev-parse \\([^)]*\\))\"/test_cmp_rev \\1 \\2/\n\ts/test \\([^ ]*\\) = \"$(git rev-parse.* \\([^)]*\\))\"/test_cmp_rev \\1 \\2/\n\ts/test \"$(git rev-parse.* \\([^)]*\\))\" != \"$(git rev-parse.* \\([^)]*\\))\"/test_cmp_rev ! \\1 \\2/\n\ts/test \\([^ ]*\\) != \"$(git rev-parse.* \\([^)]*\\))\"/test_cmp_rev ! \\1 \\2/\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 50 ++++++++++++++++++++++++-------------------------\n 1 file changed, 25 insertions(+), 25 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 18225d8430..1af6ea06ee 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -230,7 +230,7 @@ test_expect_success 'fast-forwards working tree if branch head is updated' '\n \tgit pull . second:third 2>err &&\n \ttest_i18ngrep \"fetch updated the current branch head\" err &&\n \ttest \"$(cat file)\" = modified &&\n-\ttest \"$(git rev-parse third)\" = \"$(git rev-parse second)\"\n+\ttest_cmp_rev third second\n '\n \n test_expect_success 'fast-forward fails with conflicting work tree' '\n@@ -241,7 +241,7 @@ test_expect_success 'fast-forward fails with conflicting work tree' '\n \ttest_must_fail git pull . second:third 2>err &&\n \ttest_i18ngrep \"Cannot fast-forward your working tree\" err &&\n \ttest \"$(cat file)\" = conflict &&\n-\ttest \"$(git rev-parse third)\" = \"$(git rev-parse second)\"\n+\ttest_cmp_rev third second\n '\n \n test_expect_success '--rebase' '\n@@ -254,7 +254,7 @@ test_expect_success '--rebase' '\n \tgit commit -m \"new file\" &&\n \tgit tag before-rebase &&\n \tgit pull --rebase . copy &&\n-\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\"\n '\n \n@@ -266,7 +266,7 @@ test_expect_success '--rebase fast forward' '\n \n \tgit checkout to-rebase &&\n \tgit pull --rebase . ff &&\n-\ttest \"$(git rev-parse HEAD)\" = \"$(git rev-parse ff)\" &&\n+\ttest_cmp_rev HEAD ff &&\n \n \t# The above only validates the result.  Did we actually bypass rebase?\n \tgit reflog -1 >reflog.actual &&\n@@ -290,7 +290,7 @@ test_expect_success '--rebase --autostash fast forward' '\n \tgit checkout behind &&\n \techo dirty >file &&\n \tgit pull --rebase --autostash . to-rebase-ff &&\n-\ttest \"$(git rev-parse HEAD)\" = \"$(git rev-parse to-rebase-ff)\"\n+\ttest_cmp_rev HEAD to-rebase-ff\n '\n \n test_expect_success '--rebase with conflicts shows advice' '\n@@ -328,7 +328,7 @@ test_expect_success 'failed --rebase shows advice' '\n test_expect_success '--rebase fails with multiple branches' '\n \tgit reset --hard before-rebase &&\n \ttest_must_fail git pull --rebase . copy master 2>err &&\n-\ttest \"$(git rev-parse HEAD)\" = \"$(git rev-parse before-rebase)\" &&\n+\ttest_cmp_rev HEAD before-rebase &&\n \ttest_i18ngrep \"Cannot rebase onto multiple branches\" err &&\n \ttest modified = \"$(git show HEAD:file)\"\n '\n@@ -380,7 +380,7 @@ test_expect_success 'pull.rebase' '\n \tgit reset --hard before-rebase &&\n \ttest_config pull.rebase true &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\"\n '\n \n@@ -398,7 +398,7 @@ test_expect_success 'branch.to-rebase.rebase' '\n \tgit reset --hard before-rebase &&\n \ttest_config branch.to-rebase.rebase true &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\"\n '\n \n@@ -407,14 +407,14 @@ test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n \ttest_config pull.rebase true &&\n \ttest_config branch.to-rebase.rebase false &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^)\" != \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev ! HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\"\n '\n \n test_expect_success 'pull --rebase warns on --verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --verify-signatures . copy 2>err &&\n-\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\" &&\n \ttest_i18ngrep \"ignoring --verify-signatures for rebase\" err\n '\n@@ -422,7 +422,7 @@ test_expect_success 'pull --rebase warns on --verify-signatures' '\n test_expect_success 'pull --rebase does not warn on --no-verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --no-verify-signatures . copy 2>err &&\n-\ttest \"$(git rev-parse HEAD^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^ copy &&\n \ttest new = \"$(git show HEAD:file2)\" &&\n \ttest_i18ngrep ! \"verify-signatures\" err\n '\n@@ -443,8 +443,8 @@ test_expect_success 'pull.rebase=false create a new merge commit' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase false &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^1)\" = \"$(git rev-parse before-preserve-rebase)\" &&\n-\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^1 before-preserve-rebase &&\n+\ttest_cmp_rev HEAD^2 copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -452,7 +452,7 @@ test_expect_success 'pull.rebase=true flattens keep-merge' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase true &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^^ copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -460,7 +460,7 @@ test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase 1 &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^^ copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -469,8 +469,8 @@ test_expect_success REBASE_P \\\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase preserve &&\n \tgit pull . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n-\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse keep-merge)\"\n+\ttest_cmp_rev HEAD^^ copy &&\n+\ttest_cmp_rev HEAD^2 keep-merge\n '\n \n test_expect_success 'pull.rebase=interactive' '\n@@ -505,8 +505,8 @@ test_expect_success '--rebase=false create a new merge commit' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase true &&\n \tgit pull --rebase=false . copy &&\n-\ttest \"$(git rev-parse HEAD^1)\" = \"$(git rev-parse before-preserve-rebase)\" &&\n-\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^1 before-preserve-rebase &&\n+\ttest_cmp_rev HEAD^2 copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -514,7 +514,7 @@ test_expect_success '--rebase=true rebases and flattens keep-merge' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase preserve &&\n \tgit pull --rebase=true . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^^ copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -523,8 +523,8 @@ test_expect_success REBASE_P \\\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase true &&\n \tgit pull --rebase=preserve . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n-\ttest \"$(git rev-parse HEAD^2)\" = \"$(git rev-parse keep-merge)\"\n+\ttest_cmp_rev HEAD^^ copy &&\n+\ttest_cmp_rev HEAD^2 keep-merge\n '\n \n test_expect_success '--rebase=invalid fails' '\n@@ -536,7 +536,7 @@ test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-m\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase preserve &&\n \tgit pull --rebase . copy &&\n-\ttest \"$(git rev-parse HEAD^^)\" = \"$(git rev-parse copy)\" &&\n+\ttest_cmp_rev HEAD^^ copy &&\n \ttest file3 = \"$(git show HEAD:file3.t)\"\n '\n \n@@ -597,10 +597,10 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '\n \techo dirty >>file &&\n \tgit add file &&\n \ttest_must_fail git pull &&\n-\ttest \"$COPY\" = \"$(git rev-parse --verify me/copy)\" &&\n+\ttest_cmp_rev \"$COPY\" me/copy &&\n \tgit checkout HEAD -- file &&\n \tgit pull &&\n-\ttest \"$COPY\" != \"$(git rev-parse --verify me/copy)\"\n+\ttest_cmp_rev ! \"$COPY\" me/copy\n '\n \n test_expect_success 'pull --rebase works on branch yet to be born' '\n-- \n2.24.0.346.gee0de6d492\n\n"},{"id":"386061","messageId":"73004d6cc354493cab1116e5f4a2021ec05ad05d.1573595985.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573595985.git.liu.denton@gmail.com","subject":"[PATCH v6 10/14] t5520: test single-line files by git with test_cmp","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T23:08:07Z","receivedAt":"2019-11-12T23:08:12Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"In case an invocation of a git command fails within the command\nsubstitution, the failure will be masked. Replace the command\nsubstitution with a file-redirection and a call to test_cmp.\n\nThis change was done with the following GNU sed expressions:\n\n\ts/\\(\\s*\\)test \\([^ ]*\\) = \"$(\\(git [^)]*\\))\"/\\1echo \\2 >expect \\&\\&\\n\\1\\3 >actual \\&\\&\\n\\1test_cmp expect actual/\n\ts/\\(\\s*\\)test \"$(\\(git [^)]*\\))\" = \\([^ ]*\\)/\\1echo \\3 >expect \\&\\&\\n\\1\\2 >actual \\&\\&\\n\\1test_cmp expect actual/\n\nA future patch will clean up situations where we have multiple duplicate\nstatements within a test case. This is done to keep this patch purely\nmechanical.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 64 ++++++++++++++++++++++++++++++++++++-------------\n 1 file changed, 48 insertions(+), 16 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 1af6ea06ee..8b7e7ae55d 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -255,7 +255,9 @@ test_expect_success '--rebase' '\n \tgit tag before-rebase &&\n \tgit pull --rebase . copy &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\"\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success '--rebase fast forward' '\n@@ -330,7 +332,9 @@ test_expect_success '--rebase fails with multiple branches' '\n \ttest_must_fail git pull --rebase . copy master 2>err &&\n \ttest_cmp_rev HEAD before-rebase &&\n \ttest_i18ngrep \"Cannot rebase onto multiple branches\" err &&\n-\ttest modified = \"$(git show HEAD:file)\"\n+\techo modified >expect &&\n+\tgit show HEAD:file >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'pull --rebase succeeds with dirty working directory and rebase.autostash set' '\n@@ -381,7 +385,9 @@ test_expect_success 'pull.rebase' '\n \ttest_config pull.rebase true &&\n \tgit pull . copy &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\"\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'pull --autostash & pull.rebase=true' '\n@@ -399,7 +405,9 @@ test_expect_success 'branch.to-rebase.rebase' '\n \ttest_config branch.to-rebase.rebase true &&\n \tgit pull . copy &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\"\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n@@ -408,14 +416,18 @@ test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '\n \ttest_config branch.to-rebase.rebase false &&\n \tgit pull . copy &&\n \ttest_cmp_rev ! HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\"\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'pull --rebase warns on --verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --verify-signatures . copy 2>err &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\" &&\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual &&\n \ttest_i18ngrep \"ignoring --verify-signatures for rebase\" err\n '\n \n@@ -423,7 +435,9 @@ test_expect_success 'pull --rebase does not warn on --no-verify-signatures' '\n \tgit reset --hard before-rebase &&\n \tgit pull --rebase --no-verify-signatures . copy 2>err &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest new = \"$(git show HEAD:file2)\" &&\n+\techo new >expect &&\n+\tgit show HEAD:file2 >actual &&\n+\ttest_cmp expect actual &&\n \ttest_i18ngrep ! \"verify-signatures\" err\n '\n \n@@ -445,7 +459,9 @@ test_expect_success 'pull.rebase=false create a new merge commit' '\n \tgit pull . copy &&\n \ttest_cmp_rev HEAD^1 before-preserve-rebase &&\n \ttest_cmp_rev HEAD^2 copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'pull.rebase=true flattens keep-merge' '\n@@ -453,7 +469,9 @@ test_expect_success 'pull.rebase=true flattens keep-merge' '\n \ttest_config pull.rebase true &&\n \tgit pull . copy &&\n \ttest_cmp_rev HEAD^^ copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' '\n@@ -461,7 +479,9 @@ test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' '\n \ttest_config pull.rebase 1 &&\n \tgit pull . copy &&\n \ttest_cmp_rev HEAD^^ copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success REBASE_P \\\n@@ -507,7 +527,9 @@ test_expect_success '--rebase=false create a new merge commit' '\n \tgit pull --rebase=false . copy &&\n \ttest_cmp_rev HEAD^1 before-preserve-rebase &&\n \ttest_cmp_rev HEAD^2 copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success '--rebase=true rebases and flattens keep-merge' '\n@@ -515,7 +537,9 @@ test_expect_success '--rebase=true rebases and flattens keep-merge' '\n \ttest_config pull.rebase preserve &&\n \tgit pull --rebase=true . copy &&\n \ttest_cmp_rev HEAD^^ copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success REBASE_P \\\n@@ -537,7 +561,9 @@ test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-m\n \ttest_config pull.rebase preserve &&\n \tgit pull --rebase . copy &&\n \ttest_cmp_rev HEAD^^ copy &&\n-\ttest file3 = \"$(git show HEAD:file3.t)\"\n+\techo file3 >expect &&\n+\tgit show HEAD:file3.t >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success '--rebase with rebased upstream' '\n@@ -622,10 +648,16 @@ test_expect_success 'pull --rebase fails on unborn branch with staged changes' '\n \t\tcd empty_repo2 &&\n \t\techo staged-file >staged-file &&\n \t\tgit add staged-file &&\n-\t\ttest \"$(git ls-files)\" = staged-file &&\n+\t\techo staged-file >expect &&\n+\t\tgit ls-files >actual &&\n+\t\ttest_cmp expect actual &&\n \t\ttest_must_fail git pull --rebase .. master 2>err &&\n-\t\ttest \"$(git ls-files)\" = staged-file &&\n-\t\ttest \"$(git show :staged-file)\" = staged-file &&\n+\t\techo staged-file >expect &&\n+\t\tgit ls-files >actual &&\n+\t\ttest_cmp expect actual &&\n+\t\techo staged-file >expect &&\n+\t\tgit show :staged-file >actual &&\n+\t\ttest_cmp expect actual &&\n \t\ttest_i18ngrep \"unborn branch with changes added to the index\" err\n \t)\n '\n-- \n2.24.0.346.gee0de6d492\n\n"},{"id":"386062","messageId":"463f5c11b9fa0527d0e7b1b38c002b91d386d003.1573595985.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573595985.git.liu.denton@gmail.com","subject":"[PATCH v6 11/14] t5520: don't put git in upstream of pipe","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T23:08:10Z","receivedAt":"2019-11-12T23:08:14Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Before, if the invocation of git failed, it would be masked by the pipe\nsince only the return code of the last element of a pipe is used.\nRewrite the test to put the git command on its own line so its return\ncode is not masked.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 8b7e7ae55d..8ddf89e550 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -668,7 +668,8 @@ test_expect_success 'pull --rebase fails on corrupt HEAD' '\n \t(\n \t\tcd corrupt &&\n \t\ttest_commit one &&\n-\t\tobj=$(git rev-parse --verify HEAD | sed \"s#^..#&/#\") &&\n+\t\tgit rev-parse --verify HEAD >head &&\n+\t\tobj=$(sed \"s#^..#&/#\" head) &&\n \t\trm -f .git/objects/$obj &&\n \t\ttest_must_fail git pull --rebase\n \t)\n-- \n2.24.0.346.gee0de6d492\n\n"},{"id":"386063","messageId":"67ea3f0238845f3717e85593e0f10c086df04280.1573595985.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573595985.git.liu.denton@gmail.com","subject":"[PATCH v6 12/14] t5520: replace $(cat ...) comparison with test_cmp","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T23:08:12Z","receivedAt":"2019-11-12T23:08:17Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"We currently have many instances of `test <line> = $(cat <file>)` and\n`test $(cat <file>) = <line>`.  In the case where this fails, it will be\ndifficult for a developer to debug since the output will be masked.\nReplace these instances with invocations of test_cmp().\n\nThis change was done with the following GNU sed expressions:\n\n\ts/\\(\\s*\\)test \\([^=]*\\)= \"$(cat \\([^)]*\\))\"/\\1echo \\2>expect \\&\\&\\n\\1test_cmp expect \\3/\n\ts/\\(\\s*\\)test \"$(cat \\([^)]*\\))\" = \\([^&]*\\)\\( &&\\)\\?$/\\1echo \\3 >expect \\&\\&\\n\\1test_cmp expect \\2\\4/\n\nA future patch will clean up situations where we have multiple duplicate\nstatements within a test case. This is done to keep this patch purely\nmechanical.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 105 ++++++++++++++++++++++++++++++++----------------\n 1 file changed, 70 insertions(+), 35 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 8ddf89e550..c9e4eec004 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -15,8 +15,10 @@ test_pull_autostash () {\n \tgit add new_file &&\n \tgit pull \"$@\" . copy &&\n \ttest_cmp_rev HEAD^ copy &&\n-\ttest \"$(cat new_file)\" = dirty &&\n-\ttest \"$(cat file)\" = \"modified again\"\n+\techo dirty >expect &&\n+\ttest_cmp expect new_file &&\n+\techo \"modified again\" >expect &&\n+\ttest_cmp expect file\n }\n \n test_pull_autostash_fail () {\n@@ -110,9 +112,11 @@ test_expect_success 'test . as a remote' '\n \techo updated >file &&\n \tgit commit -a -m updated &&\n \tgit checkout copy &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \tgit pull &&\n-\ttest \"$(cat file)\" = updated &&\n+\techo updated >expect &&\n+\ttest_cmp expect file &&\n \tgit reflog -1 >reflog.actual &&\n \tsed \"s/^[0-9a-f][0-9a-f]*/OBJID/\" reflog.actual >reflog.fuzzy &&\n \techo \"OBJID HEAD@{0}: pull: Fast-forward\" >reflog.expected &&\n@@ -125,9 +129,11 @@ test_expect_success 'the default remote . should not break explicit pull' '\n \tgit commit -a -m modified &&\n \tgit checkout copy &&\n \tgit reset --hard HEAD^ &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \tgit pull . second &&\n-\ttest \"$(cat file)\" = modified &&\n+\techo modified >expect &&\n+\ttest_cmp expect file &&\n \tgit reflog -1 >reflog.actual &&\n \tsed \"s/^[0-9a-f][0-9a-f]*/OBJID/\" reflog.actual >reflog.fuzzy &&\n \techo \"OBJID HEAD@{0}: pull . second: Fast-forward\" >reflog.expected &&\n@@ -137,10 +143,12 @@ test_expect_success 'the default remote . should not break explicit pull' '\n test_expect_success 'fail if wildcard spec does not match any refs' '\n \tgit checkout -b test copy^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_must_fail git pull . \"refs/nonexisting1/*:refs/nonexisting2/*\" 2>err &&\n \ttest_i18ngrep \"no candidates for merging\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'fail if no branches specified with non-default remote' '\n@@ -148,11 +156,13 @@ test_expect_success 'fail if no branches specified with non-default remote' '\n \ttest_when_finished \"git remote remove test_remote\" &&\n \tgit checkout -b test copy^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_config branch.test.remote origin &&\n \ttest_must_fail git pull test_remote 2>err &&\n \ttest_i18ngrep \"specify a branch on the command line\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'fail if not on a branch' '\n@@ -160,10 +170,12 @@ test_expect_success 'fail if not on a branch' '\n \ttest_when_finished \"git remote remove origin\" &&\n \tgit checkout HEAD^ &&\n \ttest_when_finished \"git checkout -f copy\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"not currently on a branch\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'fail if no configuration for current branch' '\n@@ -172,10 +184,12 @@ test_expect_success 'fail if no configuration for current branch' '\n \tgit checkout -b test copy^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n \ttest_config branch.test.remote test_remote &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"no tracking information\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'pull --all: fail if no configuration for current branch' '\n@@ -184,10 +198,12 @@ test_expect_success 'pull --all: fail if no configuration for current branch' '\n \tgit checkout -b test copy^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n \ttest_config branch.test.remote test_remote &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_must_fail git pull --all 2>err &&\n \ttest_i18ngrep \"There is no tracking information\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'fail if upstream branch does not exist' '\n@@ -195,16 +211,19 @@ test_expect_success 'fail if upstream branch does not exist' '\n \ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n \ttest_config branch.test.remote . &&\n \ttest_config branch.test.merge refs/heads/nonexisting &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"no such ref was fetched\" err &&\n-\ttest \"$(cat file)\" = file\n+\techo file >expect &&\n+\ttest_cmp expect file\n '\n \n test_expect_success 'fail if the index has unresolved entries' '\n \tgit checkout -b third second^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D third\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \ttest_commit modified2 file &&\n \tgit ls-files -u >unmerged &&\n \ttest_must_be_empty unmerged &&\n@@ -226,21 +245,25 @@ test_expect_success 'fail if the index has unresolved entries' '\n test_expect_success 'fast-forwards working tree if branch head is updated' '\n \tgit checkout -b third second^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D third\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \tgit pull . second:third 2>err &&\n \ttest_i18ngrep \"fetch updated the current branch head\" err &&\n-\ttest \"$(cat file)\" = modified &&\n+\techo modified >expect &&\n+\ttest_cmp expect file &&\n \ttest_cmp_rev third second\n '\n \n test_expect_success 'fast-forward fails with conflicting work tree' '\n \tgit checkout -b third second^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D third\" &&\n-\ttest \"$(cat file)\" = file &&\n+\techo file >expect &&\n+\ttest_cmp expect file &&\n \techo conflict >file &&\n \ttest_must_fail git pull . second:third 2>err &&\n \ttest_i18ngrep \"Cannot fast-forward your working tree\" err &&\n-\ttest \"$(cat file)\" = conflict &&\n+\techo conflict >expect &&\n+\ttest_cmp expect file &&\n \ttest_cmp_rev third second\n '\n \n@@ -501,7 +524,8 @@ test_expect_success 'pull.rebase=interactive' '\n \ttest_set_editor \"$TRASH_DIRECTORY/fake-editor\" &&\n \ttest_when_finished \"test_might_fail git rebase --abort\" &&\n \ttest_must_fail git pull --rebase=interactive . copy &&\n-\ttest \"I was here\" = \"$(cat fake.out)\"\n+\techo \"I was here\" >expect &&\n+\ttest_cmp expect fake.out\n '\n \n test_expect_success 'pull --rebase=i' '\n@@ -512,7 +536,8 @@ test_expect_success 'pull --rebase=i' '\n \ttest_set_editor \"$TRASH_DIRECTORY/fake-editor\" &&\n \ttest_when_finished \"test_might_fail git rebase --abort\" &&\n \ttest_must_fail git pull --rebase=i . copy &&\n-\ttest \"I was here, too\" = \"$(cat fake.out)\"\n+\techo \"I was here, too\" >expect &&\n+\ttest_cmp expect fake.out\n '\n \n test_expect_success 'pull.rebase=invalid fails' '\n@@ -578,16 +603,20 @@ test_expect_success '--rebase with rebased upstream' '\n \tgit commit -m to-rebase file2 &&\n \tgit tag to-rebase-orig &&\n \tgit pull --rebase me copy &&\n-\ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = \"$(cat file2)\"\n+\techo \"conflicting modification\" >expect &&\n+\ttest_cmp expect file &&\n+\techo file >expect &&\n+\ttest_cmp expect file2\n '\n \n test_expect_success '--rebase -f with rebased upstream' '\n \ttest_when_finished \"test_might_fail git rebase --abort\" &&\n \tgit reset --hard to-rebase-orig &&\n \tgit pull --rebase -f me copy &&\n-\ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = \"$(cat file2)\"\n+\techo \"conflicting modification\" >expect &&\n+\ttest_cmp expect file &&\n+\techo file >expect &&\n+\ttest_cmp expect file2\n '\n \n test_expect_success '--rebase with rebased default upstream' '\n@@ -595,8 +624,10 @@ test_expect_success '--rebase with rebased default upstream' '\n \tgit checkout --track -b to-rebase2 me/copy &&\n \tgit reset --hard to-rebase-orig &&\n \tgit pull --rebase &&\n-\ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = \"$(cat file2)\"\n+\techo \"conflicting modification\" >expect &&\n+\ttest_cmp expect file &&\n+\techo file >expect &&\n+\ttest_cmp expect file2\n '\n \n test_expect_success 'rebased upstream + fetch + pull --rebase' '\n@@ -607,8 +638,10 @@ test_expect_success 'rebased upstream + fetch + pull --rebase' '\n \tgit reset --hard to-rebase-orig &&\n \tgit fetch &&\n \tgit pull --rebase &&\n-\ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = \"$(cat file2)\"\n+\techo \"conflicting modification\" >expect &&\n+\ttest_cmp expect file &&\n+\techo file >expect &&\n+\ttest_cmp expect file2\n \n '\n \n@@ -744,8 +777,10 @@ test_expect_success 'git pull --rebase does not reapply old patches' '\n test_expect_success 'git pull --rebase against local branch' '\n \tgit checkout -b copy2 to-rebase-orig &&\n \tgit pull --rebase . to-rebase &&\n-\ttest \"conflicting modification\" = \"$(cat file)\" &&\n-\ttest file = \"$(cat file2)\"\n+\techo \"conflicting modification\" >expect &&\n+\ttest_cmp expect file &&\n+\techo file >expect &&\n+\ttest_cmp expect file2\n '\n \n test_done\n-- \n2.24.0.346.gee0de6d492\n\n"},{"id":"386064","messageId":"b45c088d20c75f9e58cffd500beda32399071d12.1573595985.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573595985.git.liu.denton@gmail.com","subject":"[PATCH v6 13/14] t5520: remove redundant lines in test cases","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T23:08:14Z","receivedAt":"2019-11-12T23:08:23Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"In the previous patches, the mechanical application of changes left some\nduplicate statements in the test case which were not strictly incorrect\nbut were redundant and possibly misleading. Remove these duplicate\nstatements so that it is clear that the intent behind the tests are that\nthe content of the file stays the same throughout the whole test case.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 8 --------\n 1 file changed, 8 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex c9e4eec004..ef3dbc201a 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -147,7 +147,6 @@ test_expect_success 'fail if wildcard spec does not match any refs' '\n \ttest_cmp expect file &&\n \ttest_must_fail git pull . \"refs/nonexisting1/*:refs/nonexisting2/*\" 2>err &&\n \ttest_i18ngrep \"no candidates for merging\" err &&\n-\techo file >expect &&\n \ttest_cmp expect file\n '\n \n@@ -161,7 +160,6 @@ test_expect_success 'fail if no branches specified with non-default remote' '\n \ttest_config branch.test.remote origin &&\n \ttest_must_fail git pull test_remote 2>err &&\n \ttest_i18ngrep \"specify a branch on the command line\" err &&\n-\techo file >expect &&\n \ttest_cmp expect file\n '\n \n@@ -174,7 +172,6 @@ test_expect_success 'fail if not on a branch' '\n \ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"not currently on a branch\" err &&\n-\techo file >expect &&\n \ttest_cmp expect file\n '\n \n@@ -188,7 +185,6 @@ test_expect_success 'fail if no configuration for current branch' '\n \ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"no tracking information\" err &&\n-\techo file >expect &&\n \ttest_cmp expect file\n '\n \n@@ -202,7 +198,6 @@ test_expect_success 'pull --all: fail if no configuration for current branch' '\n \ttest_cmp expect file &&\n \ttest_must_fail git pull --all 2>err &&\n \ttest_i18ngrep \"There is no tracking information\" err &&\n-\techo file >expect &&\n \ttest_cmp expect file\n '\n \n@@ -215,7 +210,6 @@ test_expect_success 'fail if upstream branch does not exist' '\n \ttest_cmp expect file &&\n \ttest_must_fail git pull 2>err &&\n \ttest_i18ngrep \"no such ref was fetched\" err &&\n-\techo file >expect &&\n \ttest_cmp expect file\n '\n \n@@ -685,10 +679,8 @@ test_expect_success 'pull --rebase fails on unborn branch with staged changes' '\n \t\tgit ls-files >actual &&\n \t\ttest_cmp expect actual &&\n \t\ttest_must_fail git pull --rebase .. master 2>err &&\n-\t\techo staged-file >expect &&\n \t\tgit ls-files >actual &&\n \t\ttest_cmp expect actual &&\n-\t\techo staged-file >expect &&\n \t\tgit show :staged-file >actual &&\n \t\ttest_cmp expect actual &&\n \t\ttest_i18ngrep \"unborn branch with changes added to the index\" err\n-- \n2.24.0.346.gee0de6d492\n\n"},{"id":"386065","messageId":"c605afa53702ba425d2c341b57a69c700fb2d423.1573595985.git.liu.denton@gmail.com","threadId":"52061","inReplyTo":"cover.1573595985.git.liu.denton@gmail.com","subject":"[PATCH v6 14/14] t5520: replace `! git` with `test_must_fail git`","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-12T23:08:16Z","receivedAt":"2019-11-12T23:08:24Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Currently, if a git command fails in an unexpected way, such as a\nsegfault, it will be masked and ignored. Replace the ! with\ntest_must_fail so that only expected failures pass.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t5520-pull.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex ef3dbc201a..602d996a33 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -537,7 +537,7 @@ test_expect_success 'pull --rebase=i' '\n test_expect_success 'pull.rebase=invalid fails' '\n \tgit reset --hard before-preserve-rebase &&\n \ttest_config pull.rebase invalid &&\n-\t! git pull . copy\n+\ttest_must_fail git pull . copy\n '\n \n test_expect_success '--rebase=false create a new merge commit' '\n@@ -572,7 +572,7 @@ test_expect_success REBASE_P \\\n \n test_expect_success '--rebase=invalid fails' '\n \tgit reset --hard before-preserve-rebase &&\n-\t! git pull --rebase=invalid . copy\n+\ttest_must_fail git pull --rebase=invalid . copy\n '\n \n test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-merge' '\n-- \n2.24.0.346.gee0de6d492\n\n"},{"id":"386081","messageId":"xmqqmud0czch.fsf@gitster-ct.c.googlers.com","threadId":"52061","inReplyTo":"0532847787dfd48fbe4b41a4a7d2783748f3bd7f.1573595985.git.liu.denton@gmail.com","subject":"Re: [PATCH v6 01/14] t: teach test_cmp_rev to accept ! for not-equals","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-11-13T01:57:34Z","receivedAt":"2019-11-13T01:57:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Denton Liu <liu.denton@gmail.com> writes:\n\n> +# Tests that its two parameters refer to the same revision, or if '!' is\n> +# provided first, that its other two parameters refer to different\n> +# revisions.\n>  test_cmp_rev () {\n> +\tlocal op wrong_result\n> +\top='='\n> +\twrong_result='different'\n> +\tif test $# -ge 1 && test \"x$1\" = 'x!'\n> +\tthen\n> +\t    op='!='\n> +\t    wrong_result='the same'\n> +\t    shift\n> +\tfi\n\nI'd prefer\n\n\tlocal op wrong_result\n\n\tif test $# -ge 1 && test \"x$1\" = 'x!'\n\tthen\n\t    op='!='\n\t    wrong_result='the same'\n\t    shift\n\telse\n\t    op='='\n\t    wrong_result='different'\n\tfi\n\nthat clarifies that the variants with and without '!' are equals, as\nopposed to the form with '!' is an afterthought exception.\n\nOn the other hand, if we want to insist that the form without '!' is\nthe norm, then\n\n\tlocal op='=' wrong_result='different'\n\n\tif test $# -ge 1 && test \"x$1\" = 'x!'\n\tthen\n\t    op='!='\n\t    wrong_result='the same'\n\t    shift\n\tfi\n\nwould be shorter (yes, I made sure we already use assignment to a\nvariable on the same line where it is declared \"local\"; we used to\navoid \"local\" that is outside POSIX so I want to make sure our use\nis safe).\n\nI'll queue the patches as-is, but if enough people agree with me (on\neither variants), I'd locally amend to make it so (i.e. no need to\nresend only for this change).\n\nThanks.\n"},{"id":"386084","messageId":"xmqqimnocza1.fsf@gitster-ct.c.googlers.com","threadId":"52061","inReplyTo":"cover.1573595985.git.liu.denton@gmail.com","subject":"Re: [PATCH v6 00/14] t5520: various test cleanup","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-11-13T01:59:02Z","receivedAt":"2019-11-13T02:10:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Denton Liu <liu.denton@gmail.com> writes:\n\n> Like earlier patchsets, I want to implement a feature that involves\n> modifications to the test suite. Since that feature will probably take a\n> while to polish up, however, let's clean up the test suite in a separate\n> patchset first so it's not blocked by the feature work.\n>\n> 1/15 is a general improvement to test_rev_cmp() that will be used later\n> in the series.\n>\n> Changes since v5:\n>\n> * More test_cmp_rev() cleanup\n>\n> * Changed instances of \"subshell\" to \"command substitution\" where appropriate\n>\n> * Change instances of \"Git\" to \"git\" when we are referring to the command\n\nLooked reasonable.  Will replace.\n\nThanks.\n"},{"id":"386148","messageId":"20191114005215.GA24527@generichostname","threadId":"52061","inReplyTo":"xmqqmud0czch.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH v6 01/14] t: teach test_cmp_rev to accept ! for not-equals","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-11-14T00:52:15Z","receivedAt":"2019-11-14T00:52:21Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Hi Junio,\n\nOn Wed, Nov 13, 2019 at 10:57:34AM +0900, Junio C Hamano wrote:\n> Denton Liu <liu.denton@gmail.com> writes:\n> \n> > +# Tests that its two parameters refer to the same revision, or if '!' is\n> > +# provided first, that its other two parameters refer to different\n> > +# revisions.\n> >  test_cmp_rev () {\n> > +\tlocal op wrong_result\n> > +\top='='\n> > +\twrong_result='different'\n> > +\tif test $# -ge 1 && test \"x$1\" = 'x!'\n> > +\tthen\n> > +\t    op='!='\n> > +\t    wrong_result='the same'\n> > +\t    shift\n> > +\tfi\n> On the other hand, if we want to insist that the form without '!' is\n> the norm, then\n> \n> \tlocal op='=' wrong_result='different'\n> \n> \tif test $# -ge 1 && test \"x$1\" = 'x!'\n> \tthen\n> \t    op='!='\n> \t    wrong_result='the same'\n> \t    shift\n> \tfi\n> \n> would be shorter (yes, I made sure we already use assignment to a\n> variable on the same line where it is declared \"local\"; we used to\n> avoid \"local\" that is outside POSIX so I want to make sure our use\n> is safe).\n\nI'd prefer this form. Unless anyone else objects, you can squash it in.\n\nYou bring up a good point about us _already_ using inline assignments\nwith `local`, though. In fact, it looks like we already test for this in\nthe very first test case of t0000 so I comfortable with this change.\n\nHowever, I'd feel _more_ comfortable with this change if we also queued\nthe following patch. (This change can either live on a separate branch\nor become the first patch in this series.)\n\n-- >8 --\nSubject: [PATCH] t0000: test multiple local assignment\n\nAccording to POSIX enhancement request '0000767: Add built-in\n\"local\"'[1],\n\n\tdash only allows one variable in a local definition; it permits\n\tassignment though it doesn't document that clearly.\n\nhowever, this isn't true since t0000 still passes with this patch\napplied on dash 0.5.10.2. Needless to say, since `local` isn't POSIX\nstandardized, it is not exactly clear what `local` entails on different\nversions of different shells.\n\nWe currently already have many instances of multiple local assignments\nin our codebase. Ensure that this is actually supported by explicitly\ntesting that it is sane.\n\n[1]: http://austingroupbugs.net/bug_view_page.php?bug_id=767\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n t/t0000-basic.sh | 15 ++++++++-------\n 1 file changed, 8 insertions(+), 7 deletions(-)\n\ndiff --git a/t/t0000-basic.sh b/t/t0000-basic.sh\nindex 4d3f7ba295..a4af2342d1 100755\n--- a/t/t0000-basic.sh\n+++ b/t/t0000-basic.sh\n@@ -20,9 +20,9 @@ modification *should* take notice and update the test vectors here.\n \n . ./test-lib.sh\n \n-try_local_x () {\n-\tlocal x=\"local\" &&\n-\techo \"$x\"\n+try_local_xy () {\n+\tlocal x=\"local\" y=\"alsolocal\" &&\n+\techo \"$x $y\"\n }\n \n # Check whether the shell supports the \"local\" keyword. \"local\" is not\n@@ -35,11 +35,12 @@ try_local_x () {\n # relying on \"local\".\n test_expect_success 'verify that the running shell supports \"local\"' '\n \tx=\"notlocal\" &&\n-\techo \"local\" >expected1 &&\n-\ttry_local_x >actual1 &&\n+\ty=\"alsonotlocal\" &&\n+\techo \"local alsolocal\" >expected1 &&\n+\ttry_local_xy >actual1 &&\n \ttest_cmp expected1 actual1 &&\n-\techo \"notlocal\" >expected2 &&\n-\techo \"$x\" >actual2 &&\n+\techo \"notlocal alsonotlocal\" >expected2 &&\n+\techo \"$x $y\" >actual2 &&\n \ttest_cmp expected2 actual2\n '\n \n-- \n2.24.0.346.gee0de6d492\n\n"}]}