git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git check-ignore returns included files

From
JCJulien Cretin <git@ia0.eu>
Date
Jun 3, 2016, 14:48 UTC
Message-ID
<loom.20160603T164532-641@post.gmane.org>
Hello,

Is it expected for check-ignore to output included files (using a "!" prefix)?

Steps to reproduce:
    git init foo
    cd foo
    touch bar
    echo '/bar\n!/bar' > .gitignore
    git add bar .gitignore
    git commit -mbar
    git check-ignore --verbose --no-index bar
Actual behavior:
    .gitignore:2:!/bar	bar
exit code = 0
Expected behavior:
no output
exit code = 1

I tested with the next branch, which is currently at 8a191e187a9dca3d786c0197f9610e627b4f4137.

The man page of check-ignore says: « For each pathname [...], check whether the file is excluded by .gitignore [...] and output the path if it is excluded. » and: « If the pattern contained a ! prefix or / suffix, it will be preserved in the output. »

The man page of gitignore says: « An optional prefix "!" which negates the pattern; any matching file excluded by a previous pattern will become included again. »

I am not sure how I should understand this situation.

Best regards, Julien

Message 1 of 1 in “git check-ignore returns included files”
  1. Julien CretinJun 3, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.