{"thread":{"id":"21900","subject":"[PATCH 0/2] Add a few more status tests","startedAt":"2009-12-08T10:12:00Z","lastAt":"2009-12-09T21:59:15Z","messageCount":9,"participants":["Michael J Gruber","Jakub Narebski","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"129516","messageId":"cover.1260266027.git.git@drmicha.warpmail.net","threadId":"21900","inReplyTo":null,"subject":"[PATCH 0/2] Add a few more status tests","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-12-08T10:12:00Z","receivedAt":"2009-12-08T10:12:00Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Here are a few more tests for git status. The first one makes sure that\n--porcelain uses paths based on the root, it makes sense on top of\n14ed05d (t7508-status.sh: Add tests for status -s, 2009-11-27) or later.\n\nThe second one checks long, short and porcelain with color. It makes\nsense on top of 3fe2a89 (status -s: obey color.status, 2009-12-05),\nalthough one test will fail without the later 8661768 (status: reduce\nduplicated setup code, 2009-12-07) and predecessor.\n\nRemarks:\n- There's not a single merge related status test so far.\n- There's no test with -z because I don't know what it's suppoded to\n  (besides the obvious thing): should it turn off color automatically\n  but not relativePaths? Or should it switch to --porcelain -z?\n\nDepending on the answer to the latter I have to do one more fixup to\nwt-status.c (and write another test).\n\nThanks:\nto J6t for pointing me to decrypt_color()\n\nMichael J Gruber (2):\n  t7508-status: status --porcelain ignores relative paths setting\n  t7508-status: test all modes with color\n\n t/t7508-status.sh |  137 +++++++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 137 insertions(+), 0 deletions(-)\n"},{"id":"129518","messageId":"313cf8059f028c670b6f17bef412080146669b94.1260266027.git.git@drmicha.warpmail.net","threadId":"21900","inReplyTo":"cover.1260266027.git.git@drmicha.warpmail.net","subject":"[PATCH 1/2] t7508-status: status --porcelain ignores relative paths setting","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-12-08T10:12:01Z","receivedAt":"2009-12-08T10:12:01Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\n t/t7508-status.sh |   18 ++++++++++++++++++\n 1 files changed, 18 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t7508-status.sh b/t/t7508-status.sh\nindex 99a74bd..8e7727e 100755\n--- a/t/t7508-status.sh\n+++ b/t/t7508-status.sh\n@@ -298,6 +298,24 @@ test_expect_success 'status -s with relative paths' '\n '\n \n cat > expect << \\EOF\n+ M dir1/modified\n+A  dir2/added\n+?? dir1/untracked\n+?? dir2/modified\n+?? dir2/untracked\n+?? expect\n+?? output\n+?? untracked\n+EOF\n+\n+test_expect_success 'status --porcelain ignores relative paths setting' '\n+\n+\t(cd dir1 && git status --porcelain) > output &&\n+\ttest_cmp expect output\n+\n+'\n+\n+cat > expect << \\EOF\n # On branch master\n # Changes to be committed:\n #   (use \"git reset HEAD <file>...\" to unstage)\n-- \n1.6.6.rc1.292.gd8fe\n"},{"id":"129517","messageId":"39211ecec866882503d1188d359e1183341faeb1.1260266027.git.git@drmicha.warpmail.net","threadId":"21900","inReplyTo":"cover.1260266027.git.git@drmicha.warpmail.net","subject":"[PATCH 2/2] t7508-status: test all modes with color","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-12-08T10:12:02Z","receivedAt":"2009-12-08T10:12:02Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\n t/t7508-status.sh |  119 +++++++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 119 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t7508-status.sh b/t/t7508-status.sh\nindex 8e7727e..50554a0 100755\n--- a/t/t7508-status.sh\n+++ b/t/t7508-status.sh\n@@ -31,6 +31,15 @@ test_expect_success 'setup' '\n \tgit add dir2/added\n '\n \n+decrypt_color () {\n+\tsed \\\n+\t\t-e 's/.\\[1m/<WHITE>/g' \\\n+\t\t-e 's/.\\[31m/<RED>/g' \\\n+\t\t-e 's/.\\[32m/<GREEN>/g' \\\n+\t\t-e 's/.\\[34m/<BLUE>/g' \\\n+\t\t-e 's/.\\[m/<RESET>/g'\n+}\n+\n test_expect_success 'status (1)' '\n \n \tgrep \"use \\\"git rm --cached <file>\\.\\.\\.\\\" to unstage\" output\n@@ -315,6 +324,115 @@ test_expect_success 'status --porcelain ignores relative paths setting' '\n \n '\n \n+test_expect_success 'setup unique colors' '\n+\n+\tgit config status.color.untracked blue\n+\n+'\n+\n+cat > expect << \\EOF\n+# On branch master\n+# Changes to be committed:\n+#   (use \"git reset HEAD <file>...\" to unstage)\n+#\n+#\t<GREEN>new file:   dir2/added<RESET>\n+#\n+# Changed but not updated:\n+#   (use \"git add <file>...\" to update what will be committed)\n+#   (use \"git checkout -- <file>...\" to discard changes in working directory)\n+#\n+#\t<RED>modified:   dir1/modified<RESET>\n+#\n+# Untracked files:\n+#   (use \"git add <file>...\" to include in what will be committed)\n+#\n+#\t<BLUE>dir1/untracked<RESET>\n+#\t<BLUE>dir2/modified<RESET>\n+#\t<BLUE>dir2/untracked<RESET>\n+#\t<BLUE>expect<RESET>\n+#\t<BLUE>output<RESET>\n+#\t<BLUE>untracked<RESET>\n+EOF\n+\n+test_expect_success 'status with color.ui' '\n+\n+\tgit config color.ui always &&\n+\tgit status | decrypt_color > output &&\n+\ttest_cmp expect output\n+\n+'\n+\n+test_expect_success 'status with color.status' '\n+\n+\tgit config --unset color.ui &&\n+\tgit config color.status always &&\n+\tgit status | decrypt_color > output &&\n+\ttest_cmp expect output\n+\n+'\n+\n+cat > expect << \\EOF\n+ <RED>M<RESET> dir1/modified\n+<GREEN>A<RESET>  dir2/added\n+<BLUE>??<RESET> dir1/untracked\n+<BLUE>??<RESET> dir2/modified\n+<BLUE>??<RESET> dir2/untracked\n+<BLUE>??<RESET> expect\n+<BLUE>??<RESET> output\n+<BLUE>??<RESET> untracked\n+EOF\n+\n+test_expect_success 'status -s with color.ui' '\n+\n+\tgit config --unset color.status &&\n+\tgit config color.ui always &&\n+\tgit status -s | decrypt_color > output &&\n+\ttest_cmp expect output\n+\n+'\n+\n+test_expect_success 'status -s with color.status' '\n+\n+\tgit config --unset color.ui &&\n+\tgit config color.status always &&\n+\tgit status -s | decrypt_color > output &&\n+\ttest_cmp expect output\n+\n+'\n+\n+cat > expect << \\EOF\n+ M dir1/modified\n+A  dir2/added\n+?? dir1/untracked\n+?? dir2/modified\n+?? dir2/untracked\n+?? expect\n+?? output\n+?? untracked\n+EOF\n+\n+test_expect_success 'status --porcelain ignores color.ui' '\n+\n+\tgit config --unset color.status &&\n+\tgit config color.ui always &&\n+\tgit status --porcelain | decrypt_color > output &&\n+\ttest_cmp expect output\n+\n+'\n+\n+test_expect_success 'status --porcelain ignores color.status' '\n+\n+\tgit config --unset color.ui &&\n+\tgit config color.status always &&\n+\tgit status --porcelain | decrypt_color > output &&\n+\ttest_cmp expect output\n+\n+'\n+\n+# recover unconditionally from color tests\n+git config --unset color.status\n+git config --unset color.ui\n+\n cat > expect << \\EOF\n # On branch master\n # Changes to be committed:\n@@ -339,6 +457,7 @@ cat > expect << \\EOF\n #\tuntracked\n EOF\n \n+\n test_expect_success 'status without relative paths' '\n \n \tgit config status.relativePaths false\n-- \n1.6.6.rc1.292.gd8fe\n"},{"id":"129520","messageId":"hflc82$sf8$1@ger.gmane.org","threadId":"21900","inReplyTo":"39211ecec866882503d1188d359e1183341faeb1.1260266027.git.git@drmicha.warpmail.net","subject":"Re: [PATCH 2/2] t7508-status: test all modes with color","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-12-08T11:10:58Z","receivedAt":"2009-12-08T11:10:58Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Michael J Gruber wrote:\n\n> +decrypt_color () {\n> +       sed \\\n> +               -e 's/.\\[1m/<WHITE>/g' \\\n> +               -e 's/.\\[31m/<RED>/g' \\\n> +               -e 's/.\\[32m/<GREEN>/g' \\\n> +               -e 's/.\\[34m/<BLUE>/g' \\\n> +               -e 's/.\\[m/<RESET>/g'\n> +}\n\nShouldn't this be better in test-lib.sh, or some common lib \n(lib-color.sh or color-lib.sh; we are unfortunately a bit inconsistent\nin naming here)?\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"129553","messageId":"4B1E798C.5050204@drmicha.warpmail.net","threadId":"21900","inReplyTo":"hflc82$sf8$1@ger.gmane.org","subject":"Re: [PATCH 2/2] t7508-status: test all modes with color","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-12-08T16:06:36Z","receivedAt":"2009-12-08T16:06:36Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Jakub Narebski venit, vidit, dixit 08.12.2009 12:10:\n> Michael J Gruber wrote:\n> \n>> +decrypt_color () {\n>> +       sed \\\n>> +               -e 's/.\\[1m/<WHITE>/g' \\\n>> +               -e 's/.\\[31m/<RED>/g' \\\n>> +               -e 's/.\\[32m/<GREEN>/g' \\\n>> +               -e 's/.\\[34m/<BLUE>/g' \\\n>> +               -e 's/.\\[m/<RESET>/g'\n>> +}\n> \n> Shouldn't this be better in test-lib.sh, or some common lib \n> (lib-color.sh or color-lib.sh; we are unfortunately a bit inconsistent\n> in naming here)?\n\nWell, so far it's used in two places (and somewhat differently). I would\nsay test-libification starts at 3 :)\n\nMichael\n"},{"id":"129602","messageId":"7vzl5sww3w.fsf@alter.siamese.dyndns.org","threadId":"21900","inReplyTo":"4B1E798C.5050204@drmicha.warpmail.net","subject":"Re: [PATCH 2/2] t7508-status: test all modes with color","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-12-09T05:32:35Z","receivedAt":"2009-12-09T05:32:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n\n> Jakub Narebski venit, vidit, dixit 08.12.2009 12:10:\n>> Michael J Gruber wrote:\n>> \n>>> +decrypt_color () {\n>>> +       sed \\\n>>> +               -e 's/.\\[1m/<WHITE>/g' \\\n>>> +               -e 's/.\\[31m/<RED>/g' \\\n>>> +               -e 's/.\\[32m/<GREEN>/g' \\\n>>> +               -e 's/.\\[34m/<BLUE>/g' \\\n>>> +               -e 's/.\\[m/<RESET>/g'\n>>> +}\n>> \n>> Shouldn't this be better in test-lib.sh, or some common lib \n>> (lib-color.sh or color-lib.sh; we are unfortunately a bit inconsistent\n>> in naming here)?\n>\n> Well, so far it's used in two places (and somewhat differently). I would\n> say test-libification starts at 3 :)\n\nThat is a pretty lame excuse and is a bad way to keep things maintainable.\n\nHaving two copies now means that you will *double* the chance for the next\nperson to copy and paste one of the existing copies that are found in the\nnon-library-ish part of the test script set to create the third duplicate,\nwithout even realizing that there already are two copies that should have\nbeen consolidated in the first place.  The worst part is that once that\nduplication is pointed out, s/he will use the existing two copies as an\nexcuse for copy and paste.\n\nPlease don't.\n"},{"id":"129603","messageId":"7vmy1swvjc.fsf@alter.siamese.dyndns.org","threadId":"21900","inReplyTo":"7vzl5sww3w.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 2/2] t7508-status: test all modes with color","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-12-09T05:44:55Z","receivedAt":"2009-12-09T05:44:55Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Michael J Gruber <git@drmicha.warpmail.net> writes:\n>\n>> Jakub Narebski venit, vidit, dixit 08.12.2009 12:10:\n>>> Michael J Gruber wrote:\n>>> \n>>>> +decrypt_color () {\n>>>> +       sed \\\n>>>> +               -e 's/.\\[1m/<WHITE>/g' \\\n>>>> +               -e 's/.\\[31m/<RED>/g' \\\n>>>> +               -e 's/.\\[32m/<GREEN>/g' \\\n>>>> +               -e 's/.\\[34m/<BLUE>/g' \\\n>>>> +               -e 's/.\\[m/<RESET>/g'\n>>>> +}\n>>> \n>>> Shouldn't this be better in test-lib.sh, or some common lib \n>>> (lib-color.sh or color-lib.sh; we are unfortunately a bit inconsistent\n>>> in naming here)?\n>>\n>> Well, so far it's used in two places (and somewhat differently). I would\n>> say test-libification starts at 3 :)\n> ...\n> Please don't.\n\nI'll squash this in to fix it up.\n\nI don't know where 36->BROWN mistake came from when color.h has a\nseries of #define that can be used to make the decoding script\nmechanically, though ;-)\n\n t/t4034-diff-words.sh |   23 ++++---------\n t/t7508-status.sh     |   83 ++++++++++++++++++++++---------------------------\n t/test-lib.sh         |   11 ++++++\n 3 files changed, 55 insertions(+), 62 deletions(-)\n\ndiff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh\nindex 4508eff..ea895b0 100755\n--- a/t/t4034-diff-words.sh\n+++ b/t/t4034-diff-words.sh\n@@ -11,18 +11,9 @@ test_expect_success setup '\n \n '\n \n-decrypt_color () {\n-\tsed \\\n-\t\t-e 's/.\\[1m/<WHITE>/g' \\\n-\t\t-e 's/.\\[31m/<RED>/g' \\\n-\t\t-e 's/.\\[32m/<GREEN>/g' \\\n-\t\t-e 's/.\\[36m/<BROWN>/g' \\\n-\t\t-e 's/.\\[m/<RESET>/g'\n-}\n-\n word_diff () {\n \ttest_must_fail git diff --no-index \"$@\" pre post > output &&\n-\tdecrypt_color < output > output.decrypted &&\n+\ttest_decode_color <output >output.decrypted &&\n \ttest_cmp expect output.decrypted\n }\n \n@@ -47,7 +38,7 @@ cat > expect <<\\EOF\n <WHITE>index 330b04f..5ed8eff 100644<RESET>\n <WHITE>--- a/pre<RESET>\n <WHITE>+++ b/post<RESET>\n-<BROWN>@@ -1,3 +1,7 @@<RESET>\n+<CYAN>@@ -1,3 +1,7 @@<RESET>\n <RED>h(4)<RESET><GREEN>h(4),hh[44]<RESET>\n <RESET>\n a = b + c<RESET>\n@@ -68,7 +59,7 @@ cat > expect <<\\EOF\n <WHITE>index 330b04f..5ed8eff 100644<RESET>\n <WHITE>--- a/pre<RESET>\n <WHITE>+++ b/post<RESET>\n-<BROWN>@@ -1,3 +1,7 @@<RESET>\n+<CYAN>@@ -1,3 +1,7 @@<RESET>\n h(4),<GREEN>hh<RESET>[44]\n <RESET>\n a = b + c<RESET>\n@@ -104,7 +95,7 @@ cat > expect <<\\EOF\n <WHITE>index 330b04f..5ed8eff 100644<RESET>\n <WHITE>--- a/pre<RESET>\n <WHITE>+++ b/post<RESET>\n-<BROWN>@@ -1,3 +1,7 @@<RESET>\n+<CYAN>@@ -1,3 +1,7 @@<RESET>\n h(4)<GREEN>,hh[44]<RESET>\n <RESET>\n a = b + c<RESET>\n@@ -146,7 +137,7 @@ cat > expect <<\\EOF\n <WHITE>index 330b04f..5ed8eff 100644<RESET>\n <WHITE>--- a/pre<RESET>\n <WHITE>+++ b/post<RESET>\n-<BROWN>@@ -1,3 +1,7 @@<RESET>\n+<CYAN>@@ -1,3 +1,7 @@<RESET>\n h(4),<GREEN>hh[44<RESET>]\n <RESET>\n a = b + c<RESET>\n@@ -168,7 +159,7 @@ cat > expect <<\\EOF\n <WHITE>index c29453b..be22f37 100644<RESET>\n <WHITE>--- a/pre<RESET>\n <WHITE>+++ b/post<RESET>\n-<BROWN>@@ -1 +1 @@<RESET>\n+<CYAN>@@ -1 +1 @@<RESET>\n aaa (aaa) <GREEN>aaa<RESET>\n EOF\n \n@@ -187,7 +178,7 @@ cat > expect <<\\EOF\n <WHITE>index 289cb9d..2d06f37 100644<RESET>\n <WHITE>--- a/pre<RESET>\n <WHITE>+++ b/post<RESET>\n-<BROWN>@@ -1 +1 @@<RESET>\n+<CYAN>@@ -1 +1 @@<RESET>\n (<RED>:<RESET>\n EOF\n \ndiff --git a/t/t7508-status.sh b/t/t7508-status.sh\nindex 50554a0..cf67fe3 100755\n--- a/t/t7508-status.sh\n+++ b/t/t7508-status.sh\n@@ -8,45 +8,36 @@ test_description='git status'\n . ./test-lib.sh\n \n test_expect_success 'setup' '\n-\t: > tracked &&\n-\t: > modified &&\n+\t: >tracked &&\n+\t: >modified &&\n \tmkdir dir1 &&\n-\t: > dir1/tracked &&\n-\t: > dir1/modified &&\n+\t: >dir1/tracked &&\n+\t: >dir1/modified &&\n \tmkdir dir2 &&\n-\t: > dir1/tracked &&\n-\t: > dir1/modified &&\n+\t: >dir1/tracked &&\n+\t: >dir1/modified &&\n \tgit add . &&\n \n \tgit status >output &&\n \n \ttest_tick &&\n \tgit commit -m initial &&\n-\t: > untracked &&\n-\t: > dir1/untracked &&\n-\t: > dir2/untracked &&\n-\techo 1 > dir1/modified &&\n-\techo 2 > dir2/modified &&\n-\techo 3 > dir2/added &&\n+\t: >untracked &&\n+\t: >dir1/untracked &&\n+\t: >dir2/untracked &&\n+\techo 1 >dir1/modified &&\n+\techo 2 >dir2/modified &&\n+\techo 3 >dir2/added &&\n \tgit add dir2/added\n '\n \n-decrypt_color () {\n-\tsed \\\n-\t\t-e 's/.\\[1m/<WHITE>/g' \\\n-\t\t-e 's/.\\[31m/<RED>/g' \\\n-\t\t-e 's/.\\[32m/<GREEN>/g' \\\n-\t\t-e 's/.\\[34m/<BLUE>/g' \\\n-\t\t-e 's/.\\[m/<RESET>/g'\n-}\n-\n test_expect_success 'status (1)' '\n \n \tgrep \"use \\\"git rm --cached <file>\\.\\.\\.\\\" to unstage\" output\n \n '\n \n-cat > expect << \\EOF\n+cat >expect <<\\EOF\n # On branch master\n # Changes to be committed:\n #   (use \"git reset HEAD <file>...\" to unstage)\n@@ -72,12 +63,12 @@ EOF\n \n test_expect_success 'status (2)' '\n \n-\tgit status > output &&\n+\tgit status >output &&\n \ttest_cmp expect output\n \n '\n \n-cat > expect << \\EOF\n+cat >expect <<\\EOF\n  M dir1/modified\n A  dir2/added\n ?? dir1/untracked\n@@ -90,7 +81,7 @@ EOF\n \n test_expect_success 'status -s (2)' '\n \n-\tgit status -s > output &&\n+\tgit status -s >output &&\n \ttest_cmp expect output\n \n '\n@@ -112,8 +103,8 @@ cat >expect <<EOF\n EOF\n test_expect_success 'status -uno' '\n \tmkdir dir3 &&\n-\t: > dir3/untracked1 &&\n-\t: > dir3/untracked2 &&\n+\t: >dir3/untracked1 &&\n+\t: >dir3/untracked2 &&\n \tgit status -uno >output &&\n \ttest_cmp expect output\n '\n@@ -258,7 +249,7 @@ test_expect_success 'status -s (status.showUntrackedFiles all)' '\n \ttest_cmp expect output\n '\n \n-cat > expect << \\EOF\n+cat >expect <<\\EOF\n # On branch master\n # Changes to be committed:\n #   (use \"git reset HEAD <file>...\" to unstage)\n@@ -284,12 +275,12 @@ EOF\n \n test_expect_success 'status with relative paths' '\n \n-\t(cd dir1 && git status) > output &&\n+\t(cd dir1 && git status) >output &&\n \ttest_cmp expect output\n \n '\n \n-cat > expect << \\EOF\n+cat >expect <<\\EOF\n  M modified\n A  ../dir2/added\n ?? untracked\n@@ -301,12 +292,12 @@ A  ../dir2/added\n EOF\n test_expect_success 'status -s with relative paths' '\n \n-\t(cd dir1 && git status -s) > output &&\n+\t(cd dir1 && git status -s) >output &&\n \ttest_cmp expect output\n \n '\n \n-cat > expect << \\EOF\n+cat >expect <<\\EOF\n  M dir1/modified\n A  dir2/added\n ?? dir1/untracked\n@@ -319,7 +310,7 @@ EOF\n \n test_expect_success 'status --porcelain ignores relative paths setting' '\n \n-\t(cd dir1 && git status --porcelain) > output &&\n+\t(cd dir1 && git status --porcelain) >output &&\n \ttest_cmp expect output\n \n '\n@@ -330,7 +321,7 @@ test_expect_success 'setup unique colors' '\n \n '\n \n-cat > expect << \\EOF\n+cat >expect <<\\EOF\n # On branch master\n # Changes to be committed:\n #   (use \"git reset HEAD <file>...\" to unstage)\n@@ -357,7 +348,7 @@ EOF\n test_expect_success 'status with color.ui' '\n \n \tgit config color.ui always &&\n-\tgit status | decrypt_color > output &&\n+\tgit status | test_decode_color >output &&\n \ttest_cmp expect output\n \n '\n@@ -366,12 +357,12 @@ test_expect_success 'status with color.status' '\n \n \tgit config --unset color.ui &&\n \tgit config color.status always &&\n-\tgit status | decrypt_color > output &&\n+\tgit status | test_decode_color >output &&\n \ttest_cmp expect output\n \n '\n \n-cat > expect << \\EOF\n+cat >expect <<\\EOF\n  <RED>M<RESET> dir1/modified\n <GREEN>A<RESET>  dir2/added\n <BLUE>??<RESET> dir1/untracked\n@@ -386,7 +377,7 @@ test_expect_success 'status -s with color.ui' '\n \n \tgit config --unset color.status &&\n \tgit config color.ui always &&\n-\tgit status -s | decrypt_color > output &&\n+\tgit status -s | test_decode_color >output &&\n \ttest_cmp expect output\n \n '\n@@ -395,12 +386,12 @@ test_expect_success 'status -s with color.status' '\n \n \tgit config --unset color.ui &&\n \tgit config color.status always &&\n-\tgit status -s | decrypt_color > output &&\n+\tgit status -s | test_decode_color >output &&\n \ttest_cmp expect output\n \n '\n \n-cat > expect << \\EOF\n+cat >expect <<\\EOF\n  M dir1/modified\n A  dir2/added\n ?? dir1/untracked\n@@ -415,7 +406,7 @@ test_expect_success 'status --porcelain ignores color.ui' '\n \n \tgit config --unset color.status &&\n \tgit config color.ui always &&\n-\tgit status --porcelain | decrypt_color > output &&\n+\tgit status --porcelain | test_decode_color >output &&\n \ttest_cmp expect output\n \n '\n@@ -424,7 +415,7 @@ test_expect_success 'status --porcelain ignores color.status' '\n \n \tgit config --unset color.ui &&\n \tgit config color.status always &&\n-\tgit status --porcelain | decrypt_color > output &&\n+\tgit status --porcelain | test_decode_color >output &&\n \ttest_cmp expect output\n \n '\n@@ -433,7 +424,7 @@ test_expect_success 'status --porcelain ignores color.status' '\n git config --unset color.status\n git config --unset color.ui\n \n-cat > expect << \\EOF\n+cat >expect <<\\EOF\n # On branch master\n # Changes to be committed:\n #   (use \"git reset HEAD <file>...\" to unstage)\n@@ -461,12 +452,12 @@ EOF\n test_expect_success 'status without relative paths' '\n \n \tgit config status.relativePaths false\n-\t(cd dir1 && git status) > output &&\n+\t(cd dir1 && git status) >output &&\n \ttest_cmp expect output\n \n '\n \n-cat > expect << \\EOF\n+cat >expect <<\\EOF\n  M dir1/modified\n A  dir2/added\n ?? dir1/untracked\n@@ -479,7 +470,7 @@ EOF\n \n test_expect_success 'status -s without relative paths' '\n \n-\t(cd dir1 && git status -s) > output &&\n+\t(cd dir1 && git status -s) >output &&\n \ttest_cmp expect output\n \n '\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 5fdc5d9..d63ad2d 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -208,6 +208,17 @@ test_set_editor () {\n \texport VISUAL\n }\n \n+test_decode_color () {\n+\tsed\t-e 's/.\\[1m/<WHITE>/g' \\\n+\t\t-e 's/.\\[31m/<RED>/g' \\\n+\t\t-e 's/.\\[32m/<GREEN>/g' \\\n+\t\t-e 's/.\\[33m/<YELLOW>/g' \\\n+\t\t-e 's/.\\[34m/<BLUE>/g' \\\n+\t\t-e 's/.\\[35m/<MAGENTA>/g' \\\n+\t\t-e 's/.\\[36m/<CYAN>/g' \\\n+\t\t-e 's/.\\[m/<RESET>/g'\n+}\n+\n test_tick () {\n \tif test -z \"${test_tick+set}\"\n \tthen\n"},{"id":"129615","messageId":"4B1F6B77.80108@drmicha.warpmail.net","threadId":"21900","inReplyTo":"7vmy1swvjc.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 2/2] t7508-status: test all modes with color","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-12-09T09:18:47Z","receivedAt":"2009-12-09T09:18:47Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Junio C Hamano venit, vidit, dixit 09.12.2009 06:32/06:44:\n> Michael J Gruber <git@drmicha.warpmail.net> writes:\n> \n>> > Jakub Narebski venit, vidit, dixit 08.12.2009 12:10:\n>>> >> Michael J Gruber wrote:\n>>> >> \n>>>> >>> +decrypt_color () {\n>>>> >>> +       sed \\\n>>>> >>> +               -e 's/.\\[1m/<WHITE>/g' \\\n>>>> >>> +               -e 's/.\\[31m/<RED>/g' \\\n>>>> >>> +               -e 's/.\\[32m/<GREEN>/g' \\\n>>>> >>> +               -e 's/.\\[34m/<BLUE>/g' \\\n>>>> >>> +               -e 's/.\\[m/<RESET>/g'\n>>>> >>> +}\n>>> >> \n>>> >> Shouldn't this be better in test-lib.sh, or some common lib \n>>> >> (lib-color.sh or color-lib.sh; we are unfortunately a bit inconsistent\n>>> >> in naming here)?\n>> >\n>> > Well, so far it's used in two places (and somewhat differently). I would\n>> > say test-libification starts at 3 :)\n> That is a pretty lame excuse and is a bad way to keep things maintainable.\n> \n> Having two copies now means that you will *double* the chance for the next\n> person to copy and paste one of the existing copies that are found in the\n> non-library-ish part of the test script set to create the third duplicate,\n> without even realizing that there already are two copies that should have\n> been consolidated in the first place.  The worst part is that once that\n> duplication is pointed out, s/he will use the existing two copies as an\n> excuse for copy and paste.\n> \n> Please don't.\n> \n\nOkay okay, I guess I have to spell out my smileys better in the future.\nThe real question for us (Jakub and me) was where to put the code. I\nthink by giving that info I could have been easily convinced to do that\nstep...\n\n> Junio C Hamano <gitster@pobox.com> writes:\n> \n>> Michael J Gruber <git@drmicha.warpmail.net> writes:\n>>\n>>> Jakub Narebski venit, vidit, dixit 08.12.2009 12:10:\n>>>> Michael J Gruber wrote:\n>>>>\n>>>>> +decrypt_color () {\n>>>>> +       sed \\\n>>>>> +               -e 's/.\\[1m/<WHITE>/g' \\\n>>>>> +               -e 's/.\\[31m/<RED>/g' \\\n>>>>> +               -e 's/.\\[32m/<GREEN>/g' \\\n>>>>> +               -e 's/.\\[34m/<BLUE>/g' \\\n>>>>> +               -e 's/.\\[m/<RESET>/g'\n>>>>> +}\n>>>>\n>>>> Shouldn't this be better in test-lib.sh, or some common lib \n>>>> (lib-color.sh or color-lib.sh; we are unfortunately a bit inconsistent\n>>>> in naming here)?\n>>>\n>>> Well, so far it's used in two places (and somewhat differently). I would\n>>> say test-libification starts at 3 :)\n>> ...\n>> Please don't.\n> \n> I'll squash this in to fix it up.\n> \n> I don't know where 36->BROWN mistake came from when color.h has a\n> series of #define that can be used to make the decoding script\n> mechanically, though ;-)\n\nI don't know either, I didn't make it - I even corrected it in my copy -\nwhich proves your former point, of course.\n\n>  t/t4034-diff-words.sh |   23 ++++---------\n>  t/t7508-status.sh     |   83 ++++++++++++++++++++++---------------------------\n>  t/test-lib.sh         |   11 ++++++\n>  3 files changed, 55 insertions(+), 62 deletions(-)\n> \n> diff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh\n> index 4508eff..ea895b0 100755\n> --- a/t/t4034-diff-words.sh\n> +++ b/t/t4034-diff-words.sh\n> @@ -11,18 +11,9 @@ test_expect_success setup '\n>  \n>  '\n>  \n> -decrypt_color () {\n> -\tsed \\\n> -\t\t-e 's/.\\[1m/<WHITE>/g' \\\n> -\t\t-e 's/.\\[31m/<RED>/g' \\\n> -\t\t-e 's/.\\[32m/<GREEN>/g' \\\n> -\t\t-e 's/.\\[36m/<BROWN>/g' \\\n> -\t\t-e 's/.\\[m/<RESET>/g'\n> -}\n> -\n>  word_diff () {\n>  \ttest_must_fail git diff --no-index \"$@\" pre post > output &&\n> -\tdecrypt_color < output > output.decrypted &&\n> +\ttest_decode_color <output >output.decrypted &&\n>  \ttest_cmp expect output.decrypted\n>  }\n>  \n> @@ -47,7 +38,7 @@ cat > expect <<\\EOF\n>  <WHITE>index 330b04f..5ed8eff 100644<RESET>\n>  <WHITE>--- a/pre<RESET>\n>  <WHITE>+++ b/post<RESET>\n> -<BROWN>@@ -1,3 +1,7 @@<RESET>\n> +<CYAN>@@ -1,3 +1,7 @@<RESET>\n>  <RED>h(4)<RESET><GREEN>h(4),hh[44]<RESET>\n>  <RESET>\n>  a = b + c<RESET>\n> @@ -68,7 +59,7 @@ cat > expect <<\\EOF\n>  <WHITE>index 330b04f..5ed8eff 100644<RESET>\n>  <WHITE>--- a/pre<RESET>\n>  <WHITE>+++ b/post<RESET>\n> -<BROWN>@@ -1,3 +1,7 @@<RESET>\n> +<CYAN>@@ -1,3 +1,7 @@<RESET>\n>  h(4),<GREEN>hh<RESET>[44]\n>  <RESET>\n>  a = b + c<RESET>\n> @@ -104,7 +95,7 @@ cat > expect <<\\EOF\n>  <WHITE>index 330b04f..5ed8eff 100644<RESET>\n>  <WHITE>--- a/pre<RESET>\n>  <WHITE>+++ b/post<RESET>\n> -<BROWN>@@ -1,3 +1,7 @@<RESET>\n> +<CYAN>@@ -1,3 +1,7 @@<RESET>\n>  h(4)<GREEN>,hh[44]<RESET>\n>  <RESET>\n>  a = b + c<RESET>\n> @@ -146,7 +137,7 @@ cat > expect <<\\EOF\n>  <WHITE>index 330b04f..5ed8eff 100644<RESET>\n>  <WHITE>--- a/pre<RESET>\n>  <WHITE>+++ b/post<RESET>\n> -<BROWN>@@ -1,3 +1,7 @@<RESET>\n> +<CYAN>@@ -1,3 +1,7 @@<RESET>\n>  h(4),<GREEN>hh[44<RESET>]\n>  <RESET>\n>  a = b + c<RESET>\n> @@ -168,7 +159,7 @@ cat > expect <<\\EOF\n>  <WHITE>index c29453b..be22f37 100644<RESET>\n>  <WHITE>--- a/pre<RESET>\n>  <WHITE>+++ b/post<RESET>\n> -<BROWN>@@ -1 +1 @@<RESET>\n> +<CYAN>@@ -1 +1 @@<RESET>\n>  aaa (aaa) <GREEN>aaa<RESET>\n>  EOF\n>  \n> @@ -187,7 +178,7 @@ cat > expect <<\\EOF\n>  <WHITE>index 289cb9d..2d06f37 100644<RESET>\n>  <WHITE>--- a/pre<RESET>\n>  <WHITE>+++ b/post<RESET>\n> -<BROWN>@@ -1 +1 @@<RESET>\n> +<CYAN>@@ -1 +1 @@<RESET>\n>  (<RED>:<RESET>\n>  EOF\n>  \n> diff --git a/t/t7508-status.sh b/t/t7508-status.sh\n> index 50554a0..cf67fe3 100755\n> --- a/t/t7508-status.sh\n> +++ b/t/t7508-status.sh\n> @@ -8,45 +8,36 @@ test_description='git status'\n>  . ./test-lib.sh\n>  \n>  test_expect_success 'setup' '\n> -\t: > tracked &&\n> -\t: > modified &&\n> +\t: >tracked &&\n> +\t: >modified &&\n>  \tmkdir dir1 &&\n> -\t: > dir1/tracked &&\n> -\t: > dir1/modified &&\n> +\t: >dir1/tracked &&\n> +\t: >dir1/modified &&\n>  \tmkdir dir2 &&\n> -\t: > dir1/tracked &&\n> -\t: > dir1/modified &&\n> +\t: >dir1/tracked &&\n> +\t: >dir1/modified &&\n>  \tgit add . &&\n>  \n>  \tgit status >output &&\n>  \n>  \ttest_tick &&\n>  \tgit commit -m initial &&\n> -\t: > untracked &&\n> -\t: > dir1/untracked &&\n> -\t: > dir2/untracked &&\n> -\techo 1 > dir1/modified &&\n> -\techo 2 > dir2/modified &&\n> -\techo 3 > dir2/added &&\n> +\t: >untracked &&\n> +\t: >dir1/untracked &&\n> +\t: >dir2/untracked &&\n> +\techo 1 >dir1/modified &&\n> +\techo 2 >dir2/modified &&\n> +\techo 3 >dir2/added &&\n>  \tgit add dir2/added\n>  '\n>  \n> -decrypt_color () {\n> -\tsed \\\n> -\t\t-e 's/.\\[1m/<WHITE>/g' \\\n> -\t\t-e 's/.\\[31m/<RED>/g' \\\n> -\t\t-e 's/.\\[32m/<GREEN>/g' \\\n> -\t\t-e 's/.\\[34m/<BLUE>/g' \\\n> -\t\t-e 's/.\\[m/<RESET>/g'\n> -}\n> -\n>  test_expect_success 'status (1)' '\n>  \n>  \tgrep \"use \\\"git rm --cached <file>\\.\\.\\.\\\" to unstage\" output\n>  \n>  '\n>  \n> -cat > expect << \\EOF\n> +cat >expect <<\\EOF\n>  # On branch master\n>  # Changes to be committed:\n>  #   (use \"git reset HEAD <file>...\" to unstage)\n> @@ -72,12 +63,12 @@ EOF\n>  \n>  test_expect_success 'status (2)' '\n>  \n> -\tgit status > output &&\n> +\tgit status >output &&\n>  \ttest_cmp expect output\n>  \n>  '\n>  \n> -cat > expect << \\EOF\n> +cat >expect <<\\EOF\n>   M dir1/modified\n>  A  dir2/added\n>  ?? dir1/untracked\n> @@ -90,7 +81,7 @@ EOF\n>  \n>  test_expect_success 'status -s (2)' '\n>  \n> -\tgit status -s > output &&\n> +\tgit status -s >output &&\n>  \ttest_cmp expect output\n>  \n>  '\n> @@ -112,8 +103,8 @@ cat >expect <<EOF\n>  EOF\n>  test_expect_success 'status -uno' '\n>  \tmkdir dir3 &&\n> -\t: > dir3/untracked1 &&\n> -\t: > dir3/untracked2 &&\n> +\t: >dir3/untracked1 &&\n> +\t: >dir3/untracked2 &&\n>  \tgit status -uno >output &&\n>  \ttest_cmp expect output\n>  '\n> @@ -258,7 +249,7 @@ test_expect_success 'status -s (status.showUntrackedFiles all)' '\n>  \ttest_cmp expect output\n>  '\n>  \n> -cat > expect << \\EOF\n> +cat >expect <<\\EOF\n>  # On branch master\n>  # Changes to be committed:\n>  #   (use \"git reset HEAD <file>...\" to unstage)\n> @@ -284,12 +275,12 @@ EOF\n>  \n>  test_expect_success 'status with relative paths' '\n>  \n> -\t(cd dir1 && git status) > output &&\n> +\t(cd dir1 && git status) >output &&\n>  \ttest_cmp expect output\n>  \n>  '\n>  \n> -cat > expect << \\EOF\n> +cat >expect <<\\EOF\n>   M modified\n>  A  ../dir2/added\n>  ?? untracked\n> @@ -301,12 +292,12 @@ A  ../dir2/added\n>  EOF\n>  test_expect_success 'status -s with relative paths' '\n>  \n> -\t(cd dir1 && git status -s) > output &&\n> +\t(cd dir1 && git status -s) >output &&\n>  \ttest_cmp expect output\n>  \n>  '\n>  \n> -cat > expect << \\EOF\n> +cat >expect <<\\EOF\n>   M dir1/modified\n>  A  dir2/added\n>  ?? dir1/untracked\n> @@ -319,7 +310,7 @@ EOF\n>  \n>  test_expect_success 'status --porcelain ignores relative paths setting' '\n>  \n> -\t(cd dir1 && git status --porcelain) > output &&\n> +\t(cd dir1 && git status --porcelain) >output &&\n>  \ttest_cmp expect output\n>  \n>  '\n> @@ -330,7 +321,7 @@ test_expect_success 'setup unique colors' '\n>  \n>  '\n>  \n> -cat > expect << \\EOF\n> +cat >expect <<\\EOF\n>  # On branch master\n>  # Changes to be committed:\n>  #   (use \"git reset HEAD <file>...\" to unstage)\n> @@ -357,7 +348,7 @@ EOF\n>  test_expect_success 'status with color.ui' '\n>  \n>  \tgit config color.ui always &&\n> -\tgit status | decrypt_color > output &&\n> +\tgit status | test_decode_color >output &&\n>  \ttest_cmp expect output\n>  \n>  '\n> @@ -366,12 +357,12 @@ test_expect_success 'status with color.status' '\n>  \n>  \tgit config --unset color.ui &&\n>  \tgit config color.status always &&\n> -\tgit status | decrypt_color > output &&\n> +\tgit status | test_decode_color >output &&\n>  \ttest_cmp expect output\n>  \n>  '\n>  \n> -cat > expect << \\EOF\n> +cat >expect <<\\EOF\n>   <RED>M<RESET> dir1/modified\n>  <GREEN>A<RESET>  dir2/added\n>  <BLUE>??<RESET> dir1/untracked\n> @@ -386,7 +377,7 @@ test_expect_success 'status -s with color.ui' '\n>  \n>  \tgit config --unset color.status &&\n>  \tgit config color.ui always &&\n> -\tgit status -s | decrypt_color > output &&\n> +\tgit status -s | test_decode_color >output &&\n>  \ttest_cmp expect output\n>  \n>  '\n> @@ -395,12 +386,12 @@ test_expect_success 'status -s with color.status' '\n>  \n>  \tgit config --unset color.ui &&\n>  \tgit config color.status always &&\n> -\tgit status -s | decrypt_color > output &&\n> +\tgit status -s | test_decode_color >output &&\n>  \ttest_cmp expect output\n>  \n>  '\n>  \n> -cat > expect << \\EOF\n> +cat >expect <<\\EOF\n>   M dir1/modified\n>  A  dir2/added\n>  ?? dir1/untracked\n> @@ -415,7 +406,7 @@ test_expect_success 'status --porcelain ignores color.ui' '\n>  \n>  \tgit config --unset color.status &&\n>  \tgit config color.ui always &&\n> -\tgit status --porcelain | decrypt_color > output &&\n> +\tgit status --porcelain | test_decode_color >output &&\n>  \ttest_cmp expect output\n>  \n>  '\n> @@ -424,7 +415,7 @@ test_expect_success 'status --porcelain ignores color.status' '\n>  \n>  \tgit config --unset color.ui &&\n>  \tgit config color.status always &&\n> -\tgit status --porcelain | decrypt_color > output &&\n> +\tgit status --porcelain | test_decode_color >output &&\n>  \ttest_cmp expect output\n>  \n>  '\n> @@ -433,7 +424,7 @@ test_expect_success 'status --porcelain ignores color.status' '\n>  git config --unset color.status\n>  git config --unset color.ui\n>  \n> -cat > expect << \\EOF\n> +cat >expect <<\\EOF\n>  # On branch master\n>  # Changes to be committed:\n>  #   (use \"git reset HEAD <file>...\" to unstage)\n> @@ -461,12 +452,12 @@ EOF\n>  test_expect_success 'status without relative paths' '\n>  \n>  \tgit config status.relativePaths false\n> -\t(cd dir1 && git status) > output &&\n> +\t(cd dir1 && git status) >output &&\n>  \ttest_cmp expect output\n>  \n>  '\n>  \n> -cat > expect << \\EOF\n> +cat >expect <<\\EOF\n>   M dir1/modified\n>  A  dir2/added\n>  ?? dir1/untracked\n> @@ -479,7 +470,7 @@ EOF\n>  \n>  test_expect_success 'status -s without relative paths' '\n>  \n> -\t(cd dir1 && git status -s) > output &&\n> +\t(cd dir1 && git status -s) >output &&\n>  \ttest_cmp expect output\n>  \n>  '\n> diff --git a/t/test-lib.sh b/t/test-lib.sh\n> index 5fdc5d9..d63ad2d 100644\n> --- a/t/test-lib.sh\n> +++ b/t/test-lib.sh\n> @@ -208,6 +208,17 @@ test_set_editor () {\n>  \texport VISUAL\n>  }\n>  \n> +test_decode_color () {\n> +\tsed\t-e 's/.\\[1m/<WHITE>/g' \\\n> +\t\t-e 's/.\\[31m/<RED>/g' \\\n> +\t\t-e 's/.\\[32m/<GREEN>/g' \\\n> +\t\t-e 's/.\\[33m/<YELLOW>/g' \\\n> +\t\t-e 's/.\\[34m/<BLUE>/g' \\\n> +\t\t-e 's/.\\[35m/<MAGENTA>/g' \\\n> +\t\t-e 's/.\\[36m/<CYAN>/g' \\\n> +\t\t-e 's/.\\[m/<RESET>/g'\n> +}\n> +\n>  test_tick () {\n>  \tif test -z \"${test_tick+set}\"\n>  \tthen\n\nRegarding the larger part of your change: Is there a specific reason for\n\">output\" rather than \"> output\" or just a style issue? I was simply\nfollowing the style which I found present in t7508 (same goes for empty\nleading and trailing lines in the test bodies).\n\nMichael\n"},{"id":"129665","messageId":"7vpr6nn70s.fsf@alter.siamese.dyndns.org","threadId":"21900","inReplyTo":"4B1F6B77.80108@drmicha.warpmail.net","subject":"Re: [PATCH 2/2] t7508-status: test all modes with color","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-12-09T21:59:15Z","receivedAt":"2009-12-09T21:59:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n\n> Regarding the larger part of your change: Is there a specific reason for\n> ...\n> \">output\" rather than \"> output\" or just a style issue?\n\nYeah, I shouldn't have included these style fixes in there.\n"}]}