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)