{"thread":{"id":"28230","subject":"[PATCH 1/4] t/t3905: use the name 'actual' for test output, swap arguments to test_cmp","startedAt":"2011-08-27T00:59:24Z","lastAt":"2011-08-27T18:50:36Z","messageCount":6,"participants":["Brandon Casey","Hilco Wijbenga","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"174360","messageId":"1314406767-17832-1-git-send-email-drafnel@gmail.com","threadId":"28230","inReplyTo":null,"subject":"[PATCH 1/4] t/t3905: use the name 'actual' for test output, swap arguments to test_cmp","fromName":"Brandon Casey","fromEmail":"drafnel@gmail.com","sentAt":"2011-08-27T00:59:24Z","receivedAt":"2011-08-27T00:59:24Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"It is common practice in the git test suite to use the file names 'actual'\nand 'expect' to hold the actual and expected output of commands.  So change\nthe name 'output' to 'actual'.\n\nAdditionally, swap the order of arguments to test_cmp when comparing\nexpected output and actual output so that if diff output is produced, it\ndescribes how the actual output differs from what was expected rather than\nthe other way around.\n\nSigned-off-by: Brandon Casey <drafnel@gmail.com>\n---\n t/t3905-stash-include-untracked.sh |   24 ++++++++++++------------\n 1 files changed, 12 insertions(+), 12 deletions(-)\n\ndiff --git a/t/t3905-stash-include-untracked.sh b/t/t3905-stash-include-untracked.sh\nindex 4f2eedf..adc2524 100755\n--- a/t/t3905-stash-include-untracked.sh\n+++ b/t/t3905-stash-include-untracked.sh\n@@ -23,13 +23,13 @@ test_expect_success 'stash save --include-untracked some dirty working directory\n '\n \n cat > expect <<EOF\n+?? actual\n ?? expect\n-?? output\n EOF\n \n test_expect_success 'stash save --include-untracked cleaned the untracked files' '\n-\tgit status --porcelain > output\n-\ttest_cmp output expect\n+\tgit status --porcelain >actual\n+\ttest_cmp expect actual\n '\n \n cat > expect.diff <<EOF\n@@ -47,10 +47,10 @@ EOF\n \n test_expect_success 'stash save --include-untracked stashed the untracked files' '\n \ttest \"!\" -f file2 &&\n-\tgit diff HEAD..stash^3 -- file2 > output &&\n-\ttest_cmp output expect.diff &&\n-\tgit ls-tree --name-only stash^3: > output &&\n-\ttest_cmp output expect.lstree\n+\tgit diff HEAD..stash^3 -- file2 >actual &&\n+\ttest_cmp expect.diff actual &&\n+\tgit ls-tree --name-only stash^3: >actual &&\n+\ttest_cmp expect.lstree actual\n '\n test_expect_success 'stash save --patch --include-untracked fails' '\n \ttest_must_fail git stash --patch --include-untracked\n@@ -64,15 +64,15 @@ git clean --force --quiet\n \n cat > expect <<EOF\n  M file\n+?? actual\n ?? expect\n ?? file2\n-?? output\n EOF\n \n test_expect_success 'stash pop after save --include-untracked leaves files untracked again' '\n \tgit stash pop &&\n-\tgit status --porcelain > output\n-\ttest_cmp output expect\n+\tgit status --porcelain >actual\n+\ttest_cmp expect actual\n '\n \n git clean --force --quiet\n@@ -96,8 +96,8 @@ EOF\n \n test_expect_success 'stash save --include-untracked dirty index got stashed' '\n \tgit stash pop --index &&\n-\tgit diff --cached > output &&\n-\ttest_cmp output expect\n+\tgit diff --cached >actual &&\n+\ttest_cmp expect actual\n '\n \n git reset > /dev/null\n-- \n1.7.6\n"},{"id":"174362","messageId":"1314406767-17832-2-git-send-email-drafnel@gmail.com","threadId":"28230","inReplyTo":"1314406767-17832-1-git-send-email-drafnel@gmail.com","subject":"[PATCH 2/4] git-stash.sh: fix typo in error message","fromName":"Brandon Casey","fromEmail":"drafnel@gmail.com","sentAt":"2011-08-27T00:59:25Z","receivedAt":"2011-08-27T00:59:25Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"\nSigned-off-by: Brandon Casey <drafnel@gmail.com>\n---\n git-stash.sh |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/git-stash.sh b/git-stash.sh\nindex 31dec0a..9d65250 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -211,7 +211,7 @@ save_stash () {\n \n \tif test -n \"$patch_mode\" && test -n \"$untracked\"\n \tthen\n-\t    die \"Can't use --patch and ---include-untracked or --all at the same time\"\n+\t    die \"Can't use --patch and --include-untracked or --all at the same time\"\n \tfi\n \n \tstash_msg=\"$*\"\n-- \n1.7.6\n"},{"id":"174361","messageId":"1314406767-17832-3-git-send-email-drafnel@gmail.com","threadId":"28230","inReplyTo":"1314406767-17832-1-git-send-email-drafnel@gmail.com","subject":"[PATCH 3/4] t/t3905: add missing '&&' linkage","fromName":"Brandon Casey","fromEmail":"drafnel@gmail.com","sentAt":"2011-08-27T00:59:26Z","receivedAt":"2011-08-27T00:59:26Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"\nSigned-off-by: Brandon Casey <drafnel@gmail.com>\n---\n t/t3905-stash-include-untracked.sh |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/t/t3905-stash-include-untracked.sh b/t/t3905-stash-include-untracked.sh\nindex adc2524..ca1a46c 100755\n--- a/t/t3905-stash-include-untracked.sh\n+++ b/t/t3905-stash-include-untracked.sh\n@@ -28,7 +28,7 @@ cat > expect <<EOF\n EOF\n \n test_expect_success 'stash save --include-untracked cleaned the untracked files' '\n-\tgit status --porcelain >actual\n+\tgit status --porcelain >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -71,7 +71,7 @@ EOF\n \n test_expect_success 'stash pop after save --include-untracked leaves files untracked again' '\n \tgit stash pop &&\n-\tgit status --porcelain >actual\n+\tgit status --porcelain >actual &&\n \ttest_cmp expect actual\n '\n \n@@ -136,7 +136,7 @@ test_expect_success 'stash save --include-untracked respects .gitignore' '\n \n test_expect_success 'stash save -u can stash with only untracked files different' '\n \techo 4 > file4 &&\n-\tgit stash -u\n+\tgit stash -u &&\n \ttest \"!\" -f file4\n '\n \n-- \n1.7.6\n"},{"id":"174363","messageId":"1314406767-17832-4-git-send-email-drafnel@gmail.com","threadId":"28230","inReplyTo":"1314406767-17832-1-git-send-email-drafnel@gmail.com","subject":"[PATCH 4/4] git-stash: remove untracked/ignored directories when stashed","fromName":"Brandon Casey","fromEmail":"drafnel@gmail.com","sentAt":"2011-08-27T00:59:27Z","receivedAt":"2011-08-27T00:59:27Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"The two new stash options --include-untracked and --all do not remove the\nuntracked and/or ignored files that are stashed if those files reside in\na subdirectory. e.g. the following sequence fails:\n\n   mkdir untracked &&\n   echo hello >untracked/file.txt &&\n   git stash --include-untracked &&\n   test ! -f untracked/file.txt\n\nWithin the git-stash script, git-clean is used to remove the\nuntracked/ignored files, but since the -d option was not supplied, it does\nnot remove directories.\n\nSo, add -d to the git-clean arguments, and update the tests to test this\nfunctionality.\n\nReported-by: Hilco Wijbenga <hilco.wijbenga@gmail.com>\nSigned-off-by: Brandon Casey <drafnel@gmail.com>\n---\n git-stash.sh                       |    2 +-\n t/t3905-stash-include-untracked.sh |   26 +++++++++++++++++++++++---\n 2 files changed, 24 insertions(+), 4 deletions(-)\n\ndiff --git a/git-stash.sh b/git-stash.sh\nindex 9d65250..c766692 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -240,7 +240,7 @@ save_stash () {\n \t\ttest \"$untracked\" = \"all\" && CLEAN_X_OPTION=-x || CLEAN_X_OPTION=\n \t\tif test -n \"$untracked\"\n \t\tthen\n-\t\t\tgit clean --force --quiet $CLEAN_X_OPTION\n+\t\t\tgit clean --force --quiet -d $CLEAN_X_OPTION\n \t\tfi\n \n \t\tif test \"$keep_index\" = \"t\" && test -n $i_tree\ndiff --git a/t/t3905-stash-include-untracked.sh b/t/t3905-stash-include-untracked.sh\nindex ca1a46c..ef44fb2 100755\n--- a/t/t3905-stash-include-untracked.sh\n+++ b/t/t3905-stash-include-untracked.sh\n@@ -17,6 +17,8 @@ test_expect_success 'stash save --include-untracked some dirty working directory\n \techo 3 > file &&\n \ttest_tick &&\n \techo 1 > file2 &&\n+\tmkdir untracked &&\n+\techo untracked >untracked/untracked &&\n \tgit stash --include-untracked &&\n \tgit diff-files --quiet &&\n \tgit diff-index --cached --quiet HEAD\n@@ -40,14 +42,23 @@ index 0000000..d00491f\n +++ b/file2\n @@ -0,0 +1 @@\n +1\n+diff --git a/untracked/untracked b/untracked/untracked\n+new file mode 100644\n+index 0000000..5a72eb2\n+--- /dev/null\n++++ b/untracked/untracked\n+@@ -0,0 +1 @@\n++untracked\n EOF\n cat > expect.lstree <<EOF\n file2\n+untracked\n EOF\n \n test_expect_success 'stash save --include-untracked stashed the untracked files' '\n \ttest \"!\" -f file2 &&\n-\tgit diff HEAD..stash^3 -- file2 >actual &&\n+\ttest ! -e untracked &&\n+\tgit diff HEAD stash^3 -- file2 untracked >actual &&\n \ttest_cmp expect.diff actual &&\n \tgit ls-tree --name-only stash^3: >actual &&\n \ttest_cmp expect.lstree actual\n@@ -67,15 +78,18 @@ cat > expect <<EOF\n ?? actual\n ?? expect\n ?? file2\n+?? untracked/\n EOF\n \n test_expect_success 'stash pop after save --include-untracked leaves files untracked again' '\n \tgit stash pop &&\n \tgit status --porcelain >actual &&\n-\ttest_cmp expect actual\n+\ttest_cmp expect actual &&\n+\ttest \"1\" = \"`cat file2`\" &&\n+\ttest untracked = \"`cat untracked/untracked`\"\n '\n \n-git clean --force --quiet\n+git clean --force --quiet -d\n \n test_expect_success 'stash save -u dirty index' '\n \techo 4 > file3 &&\n@@ -125,12 +139,16 @@ test_expect_success 'stash save --include-untracked removed files got stashed' '\n cat > .gitignore <<EOF\n .gitignore\n ignored\n+ignored.d/\n EOF\n \n test_expect_success 'stash save --include-untracked respects .gitignore' '\n \techo ignored > ignored &&\n+\tmkdir ignored.d &&\n+\techo ignored >ignored.d/untracked &&\n \tgit stash -u &&\n \ttest -s ignored &&\n+\ttest -s ignored.d/untracked &&\n \ttest -s .gitignore\n '\n \n@@ -143,12 +161,14 @@ test_expect_success 'stash save -u can stash with only untracked files different\n test_expect_success 'stash save --all does not respect .gitignore' '\n \tgit stash -a &&\n \ttest \"!\" -f ignored &&\n+\ttest \"!\" -e ignored.d &&\n \ttest \"!\" -f .gitignore\n '\n \n test_expect_success 'stash save --all is stash poppable' '\n \tgit stash pop &&\n \ttest -s ignored &&\n+\ttest -s ignored.d/untracked &&\n \ttest -s .gitignore\n '\n \n-- \n1.7.6\n"},{"id":"174364","messageId":"CAE1pOi0gZ6Dv3k0Eg5bJXygdvvAdBi7MKx_bZOaNTdtVbf3HRQ@mail.gmail.com","threadId":"28230","inReplyTo":"1314406767-17832-4-git-send-email-drafnel@gmail.com","subject":"Re: [PATCH 4/4] git-stash: remove untracked/ignored directories when stashed","fromName":"Hilco Wijbenga","fromEmail":"hilco.wijbenga@gmail.com","sentAt":"2011-08-27T01:04:47Z","receivedAt":"2011-08-27T01:04:47Z","isPatch":true,"sender":{"key":"hilco.wijbenga@gmail.com","avatar":null},"body":"On 26 August 2011 17:59, Brandon Casey <drafnel@gmail.com> wrote:\n> The two new stash options --include-untracked and --all do not remove the\n> untracked and/or ignored files that are stashed if those files reside in\n> a subdirectory. e.g. the following sequence fails:\n>\n>   mkdir untracked &&\n>   echo hello >untracked/file.txt &&\n>   git stash --include-untracked &&\n>   test ! -f untracked/file.txt\n>\n> Within the git-stash script, git-clean is used to remove the\n> untracked/ignored files, but since the -d option was not supplied, it does\n> not remove directories.\n>\n> So, add -d to the git-clean arguments, and update the tests to test this\n> functionality.\n>\n> Reported-by: Hilco Wijbenga <hilco.wijbenga@gmail.com>\n> Signed-off-by: Brandon Casey <drafnel@gmail.com>\n> ---\n>  git-stash.sh                       |    2 +-\n>  t/t3905-stash-include-untracked.sh |   26 +++++++++++++++++++++++---\n>  2 files changed, 24 insertions(+), 4 deletions(-)\n>\n> diff --git a/git-stash.sh b/git-stash.sh\n> index 9d65250..c766692 100755\n> --- a/git-stash.sh\n> +++ b/git-stash.sh\n> @@ -240,7 +240,7 @@ save_stash () {\n>                test \"$untracked\" = \"all\" && CLEAN_X_OPTION=-x || CLEAN_X_OPTION=\n>                if test -n \"$untracked\"\n>                then\n> -                       git clean --force --quiet $CLEAN_X_OPTION\n> +                       git clean --force --quiet -d $CLEAN_X_OPTION\n>                fi\n>\n>                if test \"$keep_index\" = \"t\" && test -n $i_tree\n> diff --git a/t/t3905-stash-include-untracked.sh b/t/t3905-stash-include-untracked.sh\n> index ca1a46c..ef44fb2 100755\n> --- a/t/t3905-stash-include-untracked.sh\n> +++ b/t/t3905-stash-include-untracked.sh\n> @@ -17,6 +17,8 @@ test_expect_success 'stash save --include-untracked some dirty working directory\n>        echo 3 > file &&\n>        test_tick &&\n>        echo 1 > file2 &&\n> +       mkdir untracked &&\n> +       echo untracked >untracked/untracked &&\n>        git stash --include-untracked &&\n>        git diff-files --quiet &&\n>        git diff-index --cached --quiet HEAD\n> @@ -40,14 +42,23 @@ index 0000000..d00491f\n>  +++ b/file2\n>  @@ -0,0 +1 @@\n>  +1\n> +diff --git a/untracked/untracked b/untracked/untracked\n> +new file mode 100644\n> +index 0000000..5a72eb2\n> +--- /dev/null\n> ++++ b/untracked/untracked\n> +@@ -0,0 +1 @@\n> ++untracked\n>  EOF\n>  cat > expect.lstree <<EOF\n>  file2\n> +untracked\n>  EOF\n>\n>  test_expect_success 'stash save --include-untracked stashed the untracked files' '\n>        test \"!\" -f file2 &&\n> -       git diff HEAD..stash^3 -- file2 >actual &&\n> +       test ! -e untracked &&\n> +       git diff HEAD stash^3 -- file2 untracked >actual &&\n>        test_cmp expect.diff actual &&\n>        git ls-tree --name-only stash^3: >actual &&\n>        test_cmp expect.lstree actual\n> @@ -67,15 +78,18 @@ cat > expect <<EOF\n>  ?? actual\n>  ?? expect\n>  ?? file2\n> +?? untracked/\n>  EOF\n>\n>  test_expect_success 'stash pop after save --include-untracked leaves files untracked again' '\n>        git stash pop &&\n>        git status --porcelain >actual &&\n> -       test_cmp expect actual\n> +       test_cmp expect actual &&\n> +       test \"1\" = \"`cat file2`\" &&\n> +       test untracked = \"`cat untracked/untracked`\"\n>  '\n>\n> -git clean --force --quiet\n> +git clean --force --quiet -d\n>\n>  test_expect_success 'stash save -u dirty index' '\n>        echo 4 > file3 &&\n> @@ -125,12 +139,16 @@ test_expect_success 'stash save --include-untracked removed files got stashed' '\n>  cat > .gitignore <<EOF\n>  .gitignore\n>  ignored\n> +ignored.d/\n>  EOF\n>\n>  test_expect_success 'stash save --include-untracked respects .gitignore' '\n>        echo ignored > ignored &&\n> +       mkdir ignored.d &&\n> +       echo ignored >ignored.d/untracked &&\n>        git stash -u &&\n>        test -s ignored &&\n> +       test -s ignored.d/untracked &&\n>        test -s .gitignore\n>  '\n>\n> @@ -143,12 +161,14 @@ test_expect_success 'stash save -u can stash with only untracked files different\n>  test_expect_success 'stash save --all does not respect .gitignore' '\n>        git stash -a &&\n>        test \"!\" -f ignored &&\n> +       test \"!\" -e ignored.d &&\n>        test \"!\" -f .gitignore\n>  '\n>\n>  test_expect_success 'stash save --all is stash poppable' '\n>        git stash pop &&\n>        test -s ignored &&\n> +       test -s ignored.d/untracked &&\n>        test -s .gitignore\n>  '\n>\n> --\n> 1.7.6\n\nThanks Brandon! Especially for making me famous. ;-)\n"},{"id":"174388","messageId":"7vei06adtv.fsf@alter.siamese.dyndns.org","threadId":"28230","inReplyTo":"1314406767-17832-1-git-send-email-drafnel@gmail.com","subject":"Re: [PATCH 1/4] t/t3905: use the name 'actual' for test output, swap arguments to test_cmp","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-08-27T18:50:36Z","receivedAt":"2011-08-27T18:50:36Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks; will queue all four patches.\n"}]}