{"thread":{"id":"38725","subject":"[PATCHv4 1/3] t7508: .gitignore 'expect' and 'output' files","startedAt":"2015-03-06T09:43:32Z","lastAt":"2015-03-06T09:48:25Z","messageCount":5,"participants":["Michael J Gruber"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"257139","messageId":"cover.1425634616.git.git@drmicha.warpmail.net","threadId":"38725","inReplyTo":"mqqfv9j2nqu.fsf@gitster.dls.corp.google.com","subject":"[PATCHv4 0/3]","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2015-03-06T09:43:32Z","receivedAt":"2015-03-06T09:43:32Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"v4 has an additional line with 50*\"-\" before the second header (if there\nis any).\n\nAlso, if status spewed out a cut-line (for commit) we emit a trailer\nline before the first header (if there is any) so that it doesn't get\nsucked in visually with the cut line description.\n\nIf there is only a \"second\" header it stands out by itself already due\nto quinti-dashed line.\n\nJunio C Hamano (1):\n  t7508: .gitignore 'expect' and 'output' files\n\nMichael J Gruber (2):\n  t7508: test git status -v\n  commit/status: show the index-worktree diff with -v -v\n\n Documentation/git-commit.txt |   4 ++\n t/t7508-status.sh            | 103 +++++++++++++++----------------------------\n wt-status.c                  |  20 +++++++++\n 3 files changed, 60 insertions(+), 67 deletions(-)\n\n-- \n2.3.1.303.g5174db1\n"},{"id":"257138","messageId":"488ba82f7a2a7901b2f8d083d5079a9b49b06cbe.1425634616.git.git@drmicha.warpmail.net","threadId":"38725","inReplyTo":"mqqfv9j2nqu.fsf@gitster.dls.corp.google.com","subject":"[PATCHv4 1/3] t7508: .gitignore 'expect' and 'output' files","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2015-03-06T09:43:33Z","receivedAt":"2015-03-06T09:43:33Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"From: Junio C Hamano <gitster@pobox.com>\n\nThese files are used to observe the behaviour of the 'status'\ncommand and if there weren't any such observer, the expected\noutput from 'status' wouldn't even mention them.\n\nPlace them in .gitignore to unclutter the output expected by the\ntests.  An added benefit is that future tests can add such files\nthat are purely for use by the observer, i.e. the tests themselves,\nby naming them as expect-foo and/or output-bar.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\n t/t7508-status.sh | 78 ++++++++++---------------------------------------------\n 1 file changed, 13 insertions(+), 65 deletions(-)\n\ndiff --git a/t/t7508-status.sh b/t/t7508-status.sh\nindex 8ed5788..514df67 100755\n--- a/t/t7508-status.sh\n+++ b/t/t7508-status.sh\n@@ -66,6 +66,12 @@ strip_comments () {\n \trm \"$1\" && mv \"$1\".tmp \"$1\"\n }\n \n+cat >.gitignore <<\\EOF\n+.gitignore\n+expect*\n+output*\n+EOF\n+\n test_expect_success 'status --column' '\n \tcat >expect <<\\EOF &&\n # On branch master\n@@ -83,8 +89,8 @@ test_expect_success 'status --column' '\n # Untracked files:\n #   (use \"git add <file>...\" to include in what will be committed)\n #\n-#\tdir1/untracked dir2/untracked output\n-#\tdir2/modified  expect         untracked\n+#\tdir1/untracked dir2/untracked\n+#\tdir2/modified  untracked\n #\n EOF\n \tCOLUMNS=50 git -c status.displayCommentPrefix=true status --column=\"column dense\" >output &&\n@@ -116,8 +122,6 @@ cat >expect <<\\EOF\n #\tdir1/untracked\n #\tdir2/modified\n #\tdir2/untracked\n-#\texpect\n-#\toutput\n #\tuntracked\n #\n EOF\n@@ -167,8 +171,6 @@ Untracked files:\n \tdir1/untracked\n \tdir2/modified\n \tdir2/untracked\n-\texpect\n-\toutput\n \tuntracked\n \n EOF\n@@ -186,8 +188,6 @@ A  dir2/added\n ?? dir1/untracked\n ?? dir2/modified\n ?? dir2/untracked\n-?? expect\n-?? output\n ?? untracked\n EOF\n \n@@ -320,7 +320,11 @@ EOF\n \ttest_i18ncmp expect output\n '\n \n-rm -f .gitignore\n+cat >.gitignore <<\\EOF\n+.gitignore\n+expect*\n+output*\n+EOF\n \n cat >expect <<\\EOF\n ## master\n@@ -329,8 +333,6 @@ A  dir2/added\n ?? dir1/untracked\n ?? dir2/modified\n ?? dir2/untracked\n-?? expect\n-?? output\n ?? untracked\n EOF\n \n@@ -434,8 +436,6 @@ Untracked files:\n \tdir2/modified\n \tdir2/untracked\n \tdir3/\n-\texpect\n-\toutput\n \tuntracked\n \n EOF\n@@ -456,8 +456,6 @@ A  dir2/added\n ?? dir2/modified\n ?? dir2/untracked\n ?? dir3/\n-?? expect\n-?? output\n ?? untracked\n EOF\n test_expect_success 'status -s -unormal' '\n@@ -493,8 +491,6 @@ Untracked files:\n \tdir2/untracked\n \tdir3/untracked1\n \tdir3/untracked2\n-\texpect\n-\toutput\n \tuntracked\n \n EOF\n@@ -518,8 +514,6 @@ A  dir2/added\n ?? dir1/untracked\n ?? dir2/modified\n ?? dir2/untracked\n-?? expect\n-?? output\n ?? untracked\n EOF\n test_expect_success 'status -s -uall' '\n@@ -554,8 +548,6 @@ Untracked files:\n \tuntracked\n \t../dir2/modified\n \t../dir2/untracked\n-\t../expect\n-\t../output\n \t../untracked\n \n EOF\n@@ -569,8 +561,6 @@ A  ../dir2/added\n ?? untracked\n ?? ../dir2/modified\n ?? ../dir2/untracked\n-?? ../expect\n-?? ../output\n ?? ../untracked\n EOF\n test_expect_success 'status -s with relative paths' '\n@@ -586,8 +576,6 @@ A  dir2/added\n ?? dir1/untracked\n ?? dir2/modified\n ?? dir2/untracked\n-?? expect\n-?? output\n ?? untracked\n EOF\n \n@@ -625,8 +613,6 @@ Untracked files:\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 \n EOF\n@@ -647,8 +633,6 @@ cat >expect <<\\EOF\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@@ -676,8 +660,6 @@ cat >expect <<\\EOF\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@@ -694,8 +676,6 @@ A  dir2/added\n ?? dir1/untracked\n ?? dir2/modified\n ?? dir2/untracked\n-?? expect\n-?? output\n ?? untracked\n EOF\n \n@@ -755,8 +735,6 @@ Untracked files:\n \tdir1/untracked\n \tdir2/modified\n \tdir2/untracked\n-\texpect\n-\toutput\n \tuntracked\n \n EOF\n@@ -772,8 +750,6 @@ A  dir2/added\n ?? dir1/untracked\n ?? dir2/modified\n ?? dir2/untracked\n-?? expect\n-?? output\n ?? untracked\n EOF\n \n@@ -798,8 +774,6 @@ Untracked files:\n \n \tdir1/untracked\n \tdir2/\n-\texpect\n-\toutput\n \tuntracked\n \n EOF\n@@ -848,8 +822,6 @@ Untracked files:\n \tdir1/untracked\n \tdir2/modified\n \tdir2/untracked\n-\texpect\n-\toutput\n \tuntracked\n \n EOF\n@@ -870,8 +842,6 @@ A  sm\n ?? dir1/untracked\n ?? dir2/modified\n ?? dir2/untracked\n-?? expect\n-?? output\n ?? untracked\n EOF\n test_expect_success 'status -s submodule summary is disabled by default' '\n@@ -913,8 +883,6 @@ Untracked files:\n \tdir1/untracked\n \tdir2/modified\n \tdir2/untracked\n-\texpect\n-\toutput\n \tuntracked\n \n EOF\n@@ -940,8 +908,6 @@ A  sm\n ?? dir1/untracked\n ?? dir2/modified\n ?? dir2/untracked\n-?? expect\n-?? output\n ?? untracked\n EOF\n test_expect_success 'status -s submodule summary' '\n@@ -964,8 +930,6 @@ Untracked files:\n \tdir1/untracked\n \tdir2/modified\n \tdir2/untracked\n-\texpect\n-\toutput\n \tuntracked\n \n no changes added to commit (use \"git add\" and/or \"git commit -a\")\n@@ -983,8 +947,6 @@ cat >expect <<EOF\n ?? dir1/untracked\n ?? dir2/modified\n ?? dir2/untracked\n-?? expect\n-?? output\n ?? untracked\n EOF\n test_expect_success 'status -s submodule summary (clean submodule)' '\n@@ -1025,8 +987,6 @@ Untracked files:\n \tdir1/untracked\n \tdir2/modified\n \tdir2/untracked\n-\texpect\n-\toutput\n \tuntracked\n \n EOF\n@@ -1080,8 +1040,6 @@ Untracked files:\n \tdir1/untracked\n \tdir2/modified\n \tdir2/untracked\n-\texpect\n-\toutput\n \tuntracked\n \n EOF\n@@ -1192,8 +1150,6 @@ Untracked files:\n \tdir1/untracked\n \tdir2/modified\n \tdir2/untracked\n-\texpect\n-\toutput\n \tuntracked\n \n EOF\n@@ -1254,8 +1210,6 @@ Untracked files:\n \tdir1/untracked\n \tdir2/modified\n \tdir2/untracked\n-\texpect\n-\toutput\n \tuntracked\n \n EOF\n@@ -1336,8 +1290,6 @@ cat > expect << EOF\n ;\tdir1/untracked\n ;\tdir2/modified\n ;\tdir2/untracked\n-;\texpect\n-;\toutput\n ;\tuntracked\n ;\n EOF\n@@ -1369,8 +1321,6 @@ Untracked files:\n \tdir1/untracked\n \tdir2/modified\n \tdir2/untracked\n-\texpect\n-\toutput\n \tuntracked\n \n no changes added to commit (use \"git add\" and/or \"git commit -a\")\n@@ -1400,8 +1350,6 @@ Untracked files:\n \tdir1/untracked\n \tdir2/modified\n \tdir2/untracked\n-\texpect\n-\toutput\n \tuntracked\n \n EOF\n-- \n2.3.1.303.g5174db1\n"},{"id":"257140","messageId":"4423047f119f779299bb426978d2d58a1ee7b305.1425634616.git.git@drmicha.warpmail.net","threadId":"38725","inReplyTo":"mqqfv9j2nqu.fsf@gitster.dls.corp.google.com","subject":"[PATCHv4 2/3] t7508: test git status -v","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2015-03-06T09:43:34Z","receivedAt":"2015-03-06T09:43:34Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"\"status -v\" had no test. Include one.\n\nThis also requires changing the .gitignore subtests, which is a good thing:\nthey include testing a .gitignore pattern now.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\n t/t7508-status.sh | 14 ++++++++++++--\n 1 file changed, 12 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t7508-status.sh b/t/t7508-status.sh\nindex 514df67..e3c9cf9 100755\n--- a/t/t7508-status.sh\n+++ b/t/t7508-status.sh\n@@ -137,6 +137,12 @@ test_expect_success 'status with status.displayCommentPrefix=false' '\n \ttest_i18ncmp expect output\n '\n \n+test_expect_success 'status -v' '\n+\t(cat expect && git diff --cached) >expect-with-v &&\n+\tgit status -v >output &&\n+\ttest_i18ncmp expect-with-v output\n+'\n+\n test_expect_success 'setup fake editor' '\n \tcat >.git/editor <<-\\EOF &&\n \t#! /bin/sh\n@@ -201,7 +207,7 @@ test_expect_success 'status -s' '\n test_expect_success 'status with gitignore' '\n \t{\n \t\techo \".gitignore\" &&\n-\t\techo \"expect\" &&\n+\t\techo \"expect*\" &&\n \t\techo \"output\" &&\n \t\techo \"untracked\"\n \t} >.gitignore &&\n@@ -222,6 +228,7 @@ test_expect_success 'status with gitignore' '\n \t!! dir1/untracked\n \t!! dir2/untracked\n \t!! expect\n+\t!! expect-with-v\n \t!! output\n \t!! untracked\n \tEOF\n@@ -253,6 +260,7 @@ Ignored files:\n \tdir1/untracked\n \tdir2/untracked\n \texpect\n+\texpect-with-v\n \toutput\n \tuntracked\n \n@@ -264,7 +272,7 @@ EOF\n test_expect_success 'status with gitignore (nothing untracked)' '\n \t{\n \t\techo \".gitignore\" &&\n-\t\techo \"expect\" &&\n+\t\techo \"expect*\" &&\n \t\techo \"dir2/modified\" &&\n \t\techo \"output\" &&\n \t\techo \"untracked\"\n@@ -285,6 +293,7 @@ test_expect_success 'status with gitignore (nothing untracked)' '\n \t!! dir2/modified\n \t!! dir2/untracked\n \t!! expect\n+\t!! expect-with-v\n \t!! output\n \t!! untracked\n \tEOF\n@@ -312,6 +321,7 @@ Ignored files:\n \tdir2/modified\n \tdir2/untracked\n \texpect\n+\texpect-with-v\n \toutput\n \tuntracked\n \n-- \n2.3.1.303.g5174db1\n"},{"id":"257141","messageId":"8aaef5cee137a213efc90ab6dacff0837cb8d077.1425634616.git.git@drmicha.warpmail.net","threadId":"38725","inReplyTo":"mqqfv9j2nqu.fsf@gitster.dls.corp.google.com","subject":"[PATCHv4 3/3] commit/status: show the index-worktree diff with -v -v","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2015-03-06T09:43:35Z","receivedAt":"2015-03-06T09:43:35Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"git commit and git status in long format show the diff between HEAD\nand the index when given -v. This allows previewing a commit to be made.\n\nThey also list tracked files with unstaged changes, but without a diff.\n\nIntroduce '-v -v' which shows the diff between the index and the\nworktree in addition to the HEAD index diff. This allows a review of unstaged\nchanges which might be missing from the commit.\n\nIn the case of '-v -v', additonal header lines\n\nChanges to be committed:\n\nand\n\nChanges not staged for commit:\n\nare inserted before the diffs, which are equal to those in the status\npart; the latter preceded by 50*\"-\" to make it stick out more.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\n Documentation/git-commit.txt |  4 ++++\n t/t7508-status.sh            | 11 +++++++++++\n wt-status.c                  | 20 ++++++++++++++++++++\n 3 files changed, 35 insertions(+)\n\ndiff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt\nindex 1e74b75..f14d2ec 100644\n--- a/Documentation/git-commit.txt\n+++ b/Documentation/git-commit.txt\n@@ -284,6 +284,10 @@ configuration variable documented in linkgit:git-config[1].\n \twould be committed at the bottom of the commit message\n \ttemplate.  Note that this diff output doesn't have its\n \tlines prefixed with '#'.\n++\n+If specified twice, show in addition the unified diff between\n+what would be committed and the worktree files, i.e. the unstaged\n+changes to tracked files.\n \n -q::\n --quiet::\ndiff --git a/t/t7508-status.sh b/t/t7508-status.sh\nindex e3c9cf9..6b16bcb 100755\n--- a/t/t7508-status.sh\n+++ b/t/t7508-status.sh\n@@ -143,6 +143,17 @@ test_expect_success 'status -v' '\n \ttest_i18ncmp expect-with-v output\n '\n \n+test_expect_success 'status -v -v' '\n+\t(cat expect &&\n+\t echo \"Changes to be committed:\" &&\n+\t git -c diff.mnemonicprefix=true diff --cached &&\n+\t echo \"--------------------------------------------------\" &&\n+\t echo \"Changes not staged for commit:\" &&\n+\t git -c diff.mnemonicprefix=true diff) >expect-with-v &&\n+\tgit status -v -v >output &&\n+\ttest_i18ncmp expect-with-v output\n+'\n+\n test_expect_success 'setup fake editor' '\n \tcat >.git/editor <<-\\EOF &&\n \t#! /bin/sh\ndiff --git a/wt-status.c b/wt-status.c\nindex 29666d0..422dc0e 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -849,6 +849,8 @@ static void wt_status_print_verbose(struct wt_status *s)\n {\n \tstruct rev_info rev;\n \tstruct setup_revision_opt opt;\n+\tint dirty_submodules;\n+\tconst char *c = color(WT_STATUS_HEADER, s);\n \n \tinit_revisions(&rev, NULL);\n \tDIFF_OPT_SET(&rev.diffopt, ALLOW_TEXTCONV);\n@@ -873,7 +875,25 @@ static void wt_status_print_verbose(struct wt_status *s)\n \t\trev.diffopt.use_color = 0;\n \t\twt_status_add_cut_line(s->fp);\n \t}\n+\tif (s->verbose > 1 && s->commitable) {\n+\t\t/* print_updated() printed a header, so do we */\n+\t\tif (s->fp != stdout)\n+\t\t\twt_status_print_trailer(s);\n+\t\tstatus_printf_ln(s, c, _(\"Changes to be committed:\"));\n+\t\trev.diffopt.a_prefix = \"c/\";\n+\t\trev.diffopt.b_prefix = \"i/\";\n+\t} /* else use prefix as per user config */\n \trun_diff_index(&rev, 1);\n+\tif (s->verbose > 1 &&\n+\t    wt_status_check_worktree_changes(s, &dirty_submodules)) {\n+\t\tstatus_printf_ln(s, c,\n+\t\t\t\"--------------------------------------------------\");\n+\t\tstatus_printf_ln(s, c, _(\"Changes not staged for commit:\"));\n+\t\tsetup_work_tree();\n+\t\trev.diffopt.a_prefix = \"i/\";\n+\t\trev.diffopt.b_prefix = \"w/\";\n+\t\trun_diff_files(&rev, 0);\n+\t}\n }\n \n static void wt_status_print_tracking(struct wt_status *s)\n-- \n2.3.1.303.g5174db1\n"},{"id":"257142","messageId":"54F977E9.4010601@drmicha.warpmail.net","threadId":"38725","inReplyTo":"cover.1425634616.git.git@drmicha.warpmail.net","subject":"Re: [PATCHv4 0/3] More diffs for commit/status","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2015-03-06T09:48:25Z","receivedAt":"2015-03-06T09:48:25Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Michael J Gruber venit, vidit, dixit 06.03.2015 10:43:\n...\n\nSo, I both managed to\n\n- omit the cover letter subject (which format-patch helpfully does *not*\nfill in from the branch description) and\n\n- mis-copy the in-reply-to message id (to a non-existent one).\nThunderbird user....\n\nSorry.\n\nI really need to get myself a different workflow.\n\nMichael\n"}]}