On Sun, Sep 2, 2012 at 7:12 AM, Adam Spiers <g...@adamspiers.org> wrote:
> This works in a similar manner to git-check-attr.  Some code
> was reused from add.c by refactoring out into pathspec.c.

Thanks, comments from a quick glance. First of all, can we make it
work (or share code) with .gitattributes? We may need to debug
.gitattributes as well as .gitignore. A common command would be nice.

> +--------
> +[verse]
> +'git check-ignore' pathname...
> +'git check-ignore' --stdin [-z] < <list-of-paths>

Also --quiet option, where check-ignore returns 0 if the given path is
ignored, 1 otherwise?

> +------
> +
> +The output is a series of lines of the form:
> +
> +<path> COLON SP <type> SP <pattern> SP <source> SP <position> LF
> +
> +<path> is the path of a file being queried, <type> is either
> +'excluded' or 'included' (for patterns prefixed with '!'), <pattern>
> +is the matching pattern, <source> is the pattern's source file (either
> +as an absolute path or relative to the repository root), and
> +<position> is the position of the pattern within that source.

I think we should have a few levels of verbosity.

 - The --quiet I already mention above.
 - If many paths are given, then perhaps we could print ignored paths
(no extra info).
 - Going to the next level, we could print path and the the location
of the final exclude/include rule (file and line number).
 - For debugging, given one path, we print all the rules that are
applied to it, which may help understand how/why it goes wrong.

> @@ -338,6 +338,7 @@ static void handle_internal_command(int argc, const char 
> **argv)
>                 { "bundle", cmd_bundle, RUN_SETUP_GENTLY },
>                 { "cat-file", cmd_cat_file, RUN_SETUP },
>                 { "check-attr", cmd_check_attr, RUN_SETUP },
> +               { "check-ignore", cmd_check_ignore, RUN_SETUP | 
>                 { "check-ref-format", cmd_check_ref_format },
>                 { "checkout", cmd_checkout, RUN_SETUP | NEED_WORK_TREE },
>                 { "checkout-index", cmd_checkout_index,

I don't think we really need NEED_WORK_TREE here. .gitignore can be
read from index only.
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to