{"thread":{"id":"27531","subject":"git status --ignored","startedAt":"2011-06-02T04:34:22Z","lastAt":"2011-06-02T18:30:37Z","messageCount":7,"participants":["Andrew Spiers","Junio C Hamano","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"169172","messageId":"4DE712CE.20509@vpac.org","threadId":"27531","inReplyTo":null,"subject":"git status --ignored","fromName":"Andrew Spiers","fromEmail":"aspiers@vpac.org","sentAt":"2011-06-02T04:34:22Z","receivedAt":"2011-06-02T04:34:22Z","isPatch":false,"sender":{"key":"aspiers@vpac.org","avatar":null},"body":"This looks like a bug in git 1.7.4.1.\n\ngit status --ignored does not show my ignored files and directories. git \nstatus -h suggests it should.\ngit status --ignored -h does show my ignored files and directories.\n\nAlso, git help status does not mention the --ignored switch.\n"},{"id":"169175","messageId":"7vr57cerxo.fsf@alter.siamese.dyndns.org","threadId":"27531","inReplyTo":"4DE712CE.20509@vpac.org","subject":"Re: git status --ignored","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-06-02T05:13:55Z","receivedAt":"2011-06-02T05:13:55Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andrew Spiers <aspiers@vpac.org> writes:\n\n> This looks like a bug in git 1.7.4.1.\n>\n> git status --ignored does not show my ignored files and\n> directories. git status -h suggests it should.\n> git status --ignored -h does show my ignored files and directories.\n\nDoes not reproduce for me. With --ignored (with or without -s), I see all\nthe dot-o files that are ignored by .gitignore rules that are usually\nomitted from status output without --ignored.\n\n  $ make >/dev/null 2>&1\n  $ rungit v1.7.3 status | grep -F git.o\n  $ rungit v1.7.3 status --ignored | grep -F git.o\n  #       git.o\n  $ rungit v1.7.3 status -s --ignored | grep -F git.o\n  !! git.o\n\nThe same for v1.7.4.5 or more recent versions. I am not inclined to build\nand install v1.7.4.1 to test, as I do not think it is likely that the\nparticular version is bad. It is more likely that there is something wrong\nwith your particular setting or expectation.  E.g. already tracking a path\nthat would match .gitignore rule, and expecting that such a path is shown,\neven though it is not \"ignored\".\n\n> Also, git help status does not mention the --ignored switch.\n\nThat may be true; patches welcome.\n"},{"id":"169176","messageId":"20110602055449.GA28292@sigill.intra.peff.net","threadId":"27531","inReplyTo":"7vr57cerxo.fsf@alter.siamese.dyndns.org","subject":"Re: git status --ignored","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-06-02T05:54:49Z","receivedAt":"2011-06-02T05:54:49Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Jun 01, 2011 at 10:13:55PM -0700, Junio C Hamano wrote:\n\n> Andrew Spiers <aspiers@vpac.org> writes:\n> \n> > This looks like a bug in git 1.7.4.1.\n> >\n> > git status --ignored does not show my ignored files and\n> > directories. git status -h suggests it should.\n> > git status --ignored -h does show my ignored files and directories.\n> \n> Does not reproduce for me. With --ignored (with or without -s), I see all\n> the dot-o files that are ignored by .gitignore rules that are usually\n> omitted from status output without --ignored.\n> \n>   $ make >/dev/null 2>&1\n>   $ rungit v1.7.3 status | grep -F git.o\n>   $ rungit v1.7.3 status --ignored | grep -F git.o\n>   #       git.o\n>   $ rungit v1.7.3 status -s --ignored | grep -F git.o\n>   !! git.o\n\nI can reproduce here. The faulty logic means the bug only shows when you\nactually have no real untracked files. You should keep your git\ndirectory cleaner. ;)\n\n-- >8 --\nSubject: [PATCH] status: fix bug with missing --ignore files\n\nCommit 1b908b6 (wt-status: rename and restructure\nstatus-print-untracked, 2010-04-10) converted the\nwt_status_print_untracked function into\nwt_status_print_other, taking a string_list of either\nuntracked or ignored items to print. However, the \"nothing\nto show\" early return still checked the wt_status->untracked\nlist instead of the passed-in list.\n\nThat meant that if we had ignored items to show, but no\nuntracked items, we would erroneously exit early and fail to\nshow the ignored items.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n wt-status.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/wt-status.c b/wt-status.c\nindex 9f4e0ba..0237772 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -642,7 +642,7 @@ static void wt_status_print_other(struct wt_status *s,\n \tint i;\n \tstruct strbuf buf = STRBUF_INIT;\n \n-\tif (!s->untracked.nr)\n+\tif (!l->nr)\n \t\treturn;\n \n \twt_status_print_other_header(s, what, how);\n-- \n1.7.6.rc0.34.gc8c48c.dirty\n"},{"id":"169177","messageId":"20110602055700.GB28292@sigill.intra.peff.net","threadId":"27531","inReplyTo":"20110602055449.GA28292@sigill.intra.peff.net","subject":"Re: git status --ignored","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-06-02T05:57:00Z","receivedAt":"2011-06-02T05:57:00Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jun 02, 2011 at 01:54:49AM -0400, Jeff King wrote:\n\n> That meant that if we had ignored items to show, but no\n> untracked items, we would erroneously exit early and fail to\n> show the ignored items.\n\nBTW, we could probably use some tests for \"status --ignore\". I'll leave\nthat to you as penance for your bug, if you want them. :)\n\n-Peff\n"},{"id":"169203","messageId":"7vk4d4dxn1.fsf@alter.siamese.dyndns.org","threadId":"27531","inReplyTo":"20110602055449.GA28292@sigill.intra.peff.net","subject":"Re: git status --ignored","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-06-02T16:08:18Z","receivedAt":"2011-06-02T16:08:18Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> I can reproduce here. The faulty logic means the bug only shows when you\n> actually have no real untracked files. You should keep your git\n> directory cleaner. ;)\n\nOk.\n\n-- >8 --\nSubject: [PATCH] git status --ignored: tests and docs\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n Documentation/git-status.txt |    6 ++++\n t/t7508-status.sh            |   64 ++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 70 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/git-status.txt b/Documentation/git-status.txt\nindex 1cab91b..b663e51 100644\n--- a/Documentation/git-status.txt\n+++ b/Documentation/git-status.txt\n@@ -49,6 +49,9 @@ See linkgit:git-config[1] for configuration variable\n used to change the default for when the option is not\n specified.\n \n+--ignored::\n+\tShow ignored files as well.\n+\n -z::\n \tTerminate entries with NUL, instead of LF.  This implies\n \tthe `--porcelain` output format if no other format is given.\n@@ -80,6 +83,8 @@ shows the status of stage #3 (i.e. theirs).\n For entries that do not have conflicts, `X` shows the status of the index,\n and `Y` shows the status of the work tree.  For untracked paths, `XY` are\n `??`.\n+For ignored paths, `XY` are `!!`; they are shown only when the `--ignored`\n+option is in effect.\n \n     X          Y     Meaning\n     -------------------------------------------------\n@@ -102,6 +107,7 @@ and `Y` shows the status of the work tree.  For untracked paths, `XY` are\n     U           U    unmerged, both modified\n     -------------------------------------------------\n     ?           ?    untracked\n+    !           !    ignored\n     -------------------------------------------------\n \n \ndiff --git a/t/t7508-status.sh b/t/t7508-status.sh\nindex 556d0fa..b47aad8 100755\n--- a/t/t7508-status.sh\n+++ b/t/t7508-status.sh\n@@ -86,6 +86,70 @@ test_expect_success 'status -s (2)' '\n \n '\n \n+test_expect_success 'status with gitignore' '\n+\t{\n+\t\techo \".gitignore\" &&\n+\t\techo \"expect\" &&\n+\t\techo \"output\" &&\n+\t\techo \"untracked\"\n+\t} >.gitignore &&\n+\n+\tcat >expect <<-\\EOF &&\n+\t M dir1/modified\n+\tA  dir2/added\n+\t?? dir2/modified\n+\tEOF\n+\tgit status -s >output &&\n+\ttest_cmp expect output &&\n+\n+\tcat >expect <<-\\EOF &&\n+\t M dir1/modified\n+\tA  dir2/added\n+\t?? dir2/modified\n+\t!! .gitignore\n+\t!! dir1/untracked\n+\t!! dir2/untracked\n+\t!! expect\n+\t!! output\n+\t!! untracked\n+\tEOF\n+\tgit status -s --ignored >output &&\n+\ttest_cmp expect output\n+'\n+\n+test_expect_success 'status with gitignore' '\n+\t{\n+\t\techo \".gitignore\" &&\n+\t\techo \"expect\" &&\n+\t\techo \"dir2/modified\" &&\n+\t\techo \"output\" &&\n+\t\techo \"untracked\"\n+\t} >.gitignore &&\n+\n+\tcat >expect <<-\\EOF &&\n+\t M dir1/modified\n+\tA  dir2/added\n+\tEOF\n+\tgit status -s >output &&\n+\ttest_cmp expect output &&\n+\n+\tcat >expect <<-\\EOF &&\n+\t M dir1/modified\n+\tA  dir2/added\n+\t!! .gitignore\n+\t!! dir1/untracked\n+\t!! dir2/modified\n+\t!! dir2/untracked\n+\t!! expect\n+\t!! output\n+\t!! untracked\n+\tEOF\n+\tgit status -s --ignored >output &&\n+\ttest_cmp expect output\n+'\n+\n+rm -f .gitignore\n+\n cat >expect <<EOF\n # On branch master\n # Changes to be committed:\n-- \n1.7.6.rc0.98.gc12085\n"},{"id":"169208","messageId":"20110602172021.GB2928@sigill.intra.peff.net","threadId":"27531","inReplyTo":"7vk4d4dxn1.fsf@alter.siamese.dyndns.org","subject":"Re: git status --ignored","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-06-02T17:20:21Z","receivedAt":"2011-06-02T17:20:21Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jun 02, 2011 at 09:08:18AM -0700, Junio C Hamano wrote:\n\n> +\tcat >expect <<-\\EOF &&\n> +\t M dir1/modified\n> +\tA  dir2/added\n> +\t?? dir2/modified\n> +\t!! .gitignore\n> +\t!! dir1/untracked\n> +\t!! dir2/untracked\n> +\t!! expect\n> +\t!! output\n> +\t!! untracked\n> +\tEOF\n> +\tgit status -s --ignored >output &&\n> +\ttest_cmp expect output\n\nUnfortunately this does not actually show the bug, as the short format\ntakes a different code path that was not broken.\n\nI have mixed feelings about putting the whole long format in a test\nvector, as all of the human-readable bits are supposed to be allowed to\nchange. And I know that tests are only partially about demonstrating a\nparticular bug, and more about codifying the behavior we want so future\nchanges don't break it. But it is nice to exercise that code path, and\nit doesn't change all that much, so maybe it is worth doing. Squashable\npatch below. Throw it out if you don't agree.\n\n> +test_expect_success 'status with gitignore' '\n\nIt took me a minute to figure out what was different between the two\ntests with the same title. Maybe calling them \"status with gitignore\n(untracked files present)\" and \"status with gitignore (no untracked\nfiles)\" would help future readers.\n\n---\ndiff --git a/t/t7508-status.sh b/t/t7508-status.sh\nindex b47aad8..957c1e3 100755\n--- a/t/t7508-status.sh\n+++ b/t/t7508-status.sh\n@@ -115,6 +115,36 @@ test_expect_success 'status with gitignore' '\n \tEOF\n \tgit status -s --ignored >output &&\n \ttest_cmp expect output\n+\n+\tcat >expect <<-\\EOF &&\n+\t# On branch master\n+\t# Changes to be committed:\n+\t#   (use \"git reset HEAD <file>...\" to unstage)\n+\t#\n+\t#\tnew file:   dir2/added\n+\t#\n+\t# Changed but not updated:\n+\t#   (use \"git add <file>...\" to update what will be committed)\n+\t#   (use \"git checkout -- <file>...\" to discard changes in working directory)\n+\t#\n+\t#\tmodified:   dir1/modified\n+\t#\n+\t# Untracked files:\n+\t#   (use \"git add <file>...\" to include in what will be committed)\n+\t#\n+\t#\tdir2/modified\n+\t# Ignored files:\n+\t#   (use \"git add -f <file>...\" to include in what will be committed)\n+\t#\n+\t#\t.gitignore\n+\t#\tdir1/untracked\n+\t#\tdir2/untracked\n+\t#\texpect\n+\t#\toutput\n+\t#\tuntracked\n+\tEOF\n+\tgit status --ignored >output &&\n+\ttest_cmp expect output\n '\n \n test_expect_success 'status with gitignore' '\n@@ -146,6 +176,33 @@ test_expect_success 'status with gitignore' '\n \tEOF\n \tgit status -s --ignored >output &&\n \ttest_cmp expect output\n+\n+\tcat >expect <<-\\EOF &&\n+\t# On branch master\n+\t# Changes to be committed:\n+\t#   (use \"git reset HEAD <file>...\" to unstage)\n+\t#\n+\t#\tnew file:   dir2/added\n+\t#\n+\t# Changed but not updated:\n+\t#   (use \"git add <file>...\" to update what will be committed)\n+\t#   (use \"git checkout -- <file>...\" to discard changes in working directory)\n+\t#\n+\t#\tmodified:   dir1/modified\n+\t#\n+\t# Ignored files:\n+\t#   (use \"git add -f <file>...\" to include in what will be committed)\n+\t#\n+\t#\t.gitignore\n+\t#\tdir1/untracked\n+\t#\tdir2/modified\n+\t#\tdir2/untracked\n+\t#\texpect\n+\t#\toutput\n+\t#\tuntracked\n+\tEOF\n+\tgit status --ignored >output &&\n+\ttest_cmp expect output\n '\n \n rm -f .gitignore\n"},{"id":"169213","messageId":"7voc2gcche.fsf@alter.siamese.dyndns.org","threadId":"27531","inReplyTo":"20110602172021.GB2928@sigill.intra.peff.net","subject":"Re: git status --ignored","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-06-02T18:30:37Z","receivedAt":"2011-06-02T18:30:37Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> it doesn't change all that much, so maybe it is worth doing. Squashable\n> patch below.\n\nThanks.\n"}]}