git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Guido Flohr <guido.flohr@cantanea.com>
To: git@vger.kernel.org
Subject: Discrepancy between git-check-ignore and git-status for negated pattern
Date: Thu, 26 Oct 2017 21:40:49 +0300	[thread overview]
Message-ID: <60C66671-B124-4933-AC91-31D9A202D11D@cantanea.com> (raw)

This .gitignore file does not work as expected with git-check-ignore:

    *.o
    !a.o

It seems that “git check-ignore a.o” ignores that “a.o” was re-included.  This is what happens:

    $ git --version
    git version 2.15.0.rc2.48.g4e40fb302
    $ mkdir repo
    $ cd repo
    $ git init
    Initialized empty Git repository in /path/to/repo/.git/
    $ echo '*.o' >.gitignore
    $ echo '!a.o' >>.gitignore
    $ >a.o
    $ >b.o
    $ git check-ignore a.o b.o
    a.o
    b.o
    $ git status --short
    ?? a.o

According to git-check-ignore, “a.o” is ignored.  According to git-status, it is not.

Is that a bug or did I miss something because of my limited search capabilities?

Tested on a Mac with current master from git.  The 2.13.4 binary from Mac Ports exhibits the same behavior. 

Thanks!

                 reply	other threads:[~2017-10-26 18:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=60C66671-B124-4933-AC91-31D9A202D11D@cantanea.com \
    --to=guido.flohr@cantanea.com \
    --cc=git@vger.kernel.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).