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

Re: [PATCH] git-check-ignore.txt: Clarify exit codes

From
Florian Hassanen <florian.hassanen@gmail.com>
Date
Dec 11, 2014, 23:16 UTC
Message-ID
<CAMAJHBYVMy-tc_aCjyeN7=VMG=k7gjWh9evL6bcJLzYfQcf6yg@mail.gmail.com>
In-Reply-To
<xmqqiohhdc5j.fsf@gitster.dls.corp.google.com>
Show 22 quoted lines
>> check-ignore disregards whether a path is matched by a
>> positive or negative pattern. Thus for a file that is _not_
>> ignored, but is captured by negative pattern in .gitignore,
>> the exit code is 0. The docs suggested otherwise.
>
> I am not sure that is the actual behaviour of the command.  Given
> this .gitignore file:
>
>     $ cat .gitignore; echo END
>     !vendor.o
>     *.o
>     END
>
> which is designed to allow binary-only blob "vendor.o" supplied by
> the vendor to be tracked, but to ignore all the other usual build
> artifacts, you see this:
>
>     $ for o in a.o vendor.o; do git check-ignore $o >/dev/null; echo $?; done
>     0
>     1
>
> Puzzled...
Maybe your global ignore file gets in the way?
on both of my machines (cygwin + git 2.1.1, linux + git @master) I have:
  $ cat > .gitignore << EOF
  !vendor.o
  *.o
  EOF
  for o in a.o vendor.o; do git check-ignore $o >/dev/null; echo $?; done
  0
  0
which corresponds to how I understand the command so far :)

is one of a.o and vendor.o already in your index? there is a --no-index as well (which enables yet another different behavior)

Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 5 in “git-check-ignore.txt: Clarify exit codes”
  1. git-check-ignore.txt: Clarify exit codesFlorian Hassanen, Dec 11, 2014
  2. Junio C HamanoDec 11, 2014
  3. Florian HassanenDec 11, 2014
  4. Junio C HamanoDec 11, 2014
  5. Florian HassanenDec 11, 2014

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.