From: Junio C Hamano <gitster@pobox.com>
To: Florian Hassanen <florian.hassanen@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] git-check-ignore.txt: Clarify exit codes
Date: Thu, 11 Dec 2014 15:01:12 -0800 [thread overview]
Message-ID: <xmqqiohhdc5j.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1418323355-23935-1-git-send-email-florian.hassanen@gmail.com> (Florian Hassanen's message of "Thu, 11 Dec 2014 19:42:35 +0100")
Florian Hassanen <florian.hassanen@gmail.com> writes:
> 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...
>
> Clarify docs to explain that only the match matters, not
> whether the path is actually ignored or not.
>
> Signed-off-by: Florian Hassanen <florian.hassanen@gmail.com>
> ---
> Today when working with the check-ignore command, I misunderstood
> the docs into thinking, that I could use check-ignore's exit code
> to determine, whether a file is ignored or not - but this is not
> how the exit code works :(
> Here is a suggestion, on how to update the docs to describe the
> exit code's behavior more clearly.
>
> Documentation/git-check-ignore.txt | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/git-check-ignore.txt b/Documentation/git-check-ignore.txt
> index ee2e091..bdd8b7c 100644
> --- a/Documentation/git-check-ignore.txt
> +++ b/Documentation/git-check-ignore.txt
> @@ -97,10 +97,11 @@ EXIT STATUS
> -----------
>
> 0::
> - One or more of the provided paths is ignored.
> + At least one of the provided paths matches some (possibly negative)
> + pattern.
>
> 1::
> - None of the provided paths are ignored.
> + None of the provided paths match any pattern.
>
> 128::
> A fatal error was encountered.
next prev parent reply other threads:[~2014-12-11 23:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-11 18:42 [PATCH] git-check-ignore.txt: Clarify exit codes Florian Hassanen
2014-12-11 23:01 ` Junio C Hamano [this message]
2014-12-11 23:16 ` Florian Hassanen
2014-12-11 23:21 ` Junio C Hamano
2014-12-11 23:40 ` Florian Hassanen
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=xmqqiohhdc5j.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=florian.hassanen@gmail.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.
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).