git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Andrew Spiers <aspiers@vpac.org>, git@vger.kernel.org
Subject: Re: git status --ignored
Date: Thu, 2 Jun 2011 01:54:49 -0400	[thread overview]
Message-ID: <20110602055449.GA28292@sigill.intra.peff.net> (raw)
In-Reply-To: <7vr57cerxo.fsf@alter.siamese.dyndns.org>

On Wed, Jun 01, 2011 at 10:13:55PM -0700, Junio C Hamano wrote:

> Andrew Spiers <aspiers@vpac.org> writes:
> 
> > This looks like a bug in git 1.7.4.1.
> >
> > git status --ignored does not show my ignored files and
> > directories. git status -h suggests it should.
> > git status --ignored -h does show my ignored files and directories.
> 
> Does not reproduce for me. With --ignored (with or without -s), I see all
> the dot-o files that are ignored by .gitignore rules that are usually
> omitted from status output without --ignored.
> 
>   $ make >/dev/null 2>&1
>   $ rungit v1.7.3 status | grep -F git.o
>   $ rungit v1.7.3 status --ignored | grep -F git.o
>   #       git.o
>   $ rungit v1.7.3 status -s --ignored | grep -F git.o
>   !! git.o

I can reproduce here. The faulty logic means the bug only shows when you
actually have no real untracked files. You should keep your git
directory cleaner. ;)

-- >8 --
Subject: [PATCH] status: fix bug with missing --ignore files

Commit 1b908b6 (wt-status: rename and restructure
status-print-untracked, 2010-04-10) converted the
wt_status_print_untracked function into
wt_status_print_other, taking a string_list of either
untracked or ignored items to print. However, the "nothing
to show" early return still checked the wt_status->untracked
list instead of the passed-in list.

That meant that if we had ignored items to show, but no
untracked items, we would erroneously exit early and fail to
show the ignored items.

Signed-off-by: Jeff King <peff@peff.net>
---
 wt-status.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/wt-status.c b/wt-status.c
index 9f4e0ba..0237772 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -642,7 +642,7 @@ static void wt_status_print_other(struct wt_status *s,
 	int i;
 	struct strbuf buf = STRBUF_INIT;
 
-	if (!s->untracked.nr)
+	if (!l->nr)
 		return;
 
 	wt_status_print_other_header(s, what, how);
-- 
1.7.6.rc0.34.gc8c48c.dirty

  reply	other threads:[~2011-06-02  5:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-02  4:34 git status --ignored Andrew Spiers
2011-06-02  5:13 ` Junio C Hamano
2011-06-02  5:54   ` Jeff King [this message]
2011-06-02  5:57     ` Jeff King
2011-06-02 16:08     ` Junio C Hamano
2011-06-02 17:20       ` Jeff King
2011-06-02 18:30         ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2011-06-02  4:43 Andrew Spiers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110602055449.GA28292@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=aspiers@vpac.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).