On Tue, May 17, 2016 at 2:08 PM, Junio C Hamano <[email protected]> wrote:
> Junio C Hamano <[email protected]> writes:
>
>> Given that one of the two expected callers, namely, "check-attr" and
>> Stefan's pathspec label magic, of this "alloc and then append" side
>> of the API wants to have an access to git_attr(name), I think
>> the function signature for this one should be updated to take not
>> "const char *name" but instead take "struct git_attr *attr", i.e.
>
> Perhaps this can be squashed into 12/12 to update the tutorial part
> to cover this less often used form.
That would be great!
Thanks,
Stefan
>
> Documentation/technical/api-gitattributes.txt | 22 +++++++++++++++++++++-
> 1 file changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/technical/api-gitattributes.txt
> b/Documentation/technical/api-gitattributes.txt
> index 6f13f94..92fc32a 100644
> --- a/Documentation/technical/api-gitattributes.txt
> +++ b/Documentation/technical/api-gitattributes.txt
> @@ -55,7 +55,11 @@ Querying Specific Attributes
>
> * Prepare `struct git_attr_check` using git_attr_check_initl()
> function, enumerating the names of attributes whose values you are
> - interested in, terminated with a NULL pointer.
> + interested in, terminated with a NULL pointer. Alternatively, an
> + empty `struct git_attr_check` can be prepared by calling
> + `git_attr_check_alloc()` function and then attributes you want to
> + ask about can be added to it with `git_attr_check_append()`
> + function.
>
> * Call `git_check_attr()` to check the attributes for the path.
>
> @@ -112,6 +116,22 @@ static void setup_check(void)
> }
> ------------
>
> +To see how attributes in argv[] are set for different paths, only
> +the first step in the above would be different.
> +
> +------------
> +static struct git_attr_check *check;
> +static void setup_check(const char **argv)
> +{
> + check = git_attr_check_alloc();
> + while (*argv) {
> + struct git_attr *attr = git_attr(*argv);
> + git_attr_check_append(check, attr);
> + argv++;
> + }
> +}
> +------------
> +
>
> Querying All Attributes
> -----------------------
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html