Re: [PATCH v14 05/13] ref-filter: add option to filter out tags, branches and remotes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Aug 29, 2015 at 10:12 AM, Karthik Nayak <karthik.188@xxxxxxxxx> wrote:
> Add a function called 'for_each_fullref_in()' to refs.{c,h} which
> iterates through each ref for the given path without trimming the path
> and also accounting for broken refs, if mentioned.
>
> Add 'filter_ref_kind()' in ref-filter.c to check the kind of ref being
> handled and return the kind to 'ref_filter_handler()', where we
> discard refs which we do not need and assign the kind to needed refs.
>
> Signed-off-by: Karthik Nayak <karthik.188@xxxxxxxxx>
> ---
> diff --git a/refs.c b/refs.c
> index 4e15f60..a9469c2 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -2108,6 +2108,15 @@ int for_each_ref_in(const char *prefix, each_ref_fn fn, void *cb_data)
>         return do_for_each_ref(&ref_cache, prefix, fn, strlen(prefix), 0, cb_data);
>  }
>
> +int for_each_fullref_in(const char *prefix, each_ref_fn fn, void *cb_data, unsigned int broken)

Booleans such as 'broken' are typically declared 'int' in this
codebase, rather than 'unsigned int'.

> +{
> +       unsigned int flag = 0;
> +
> +       if (broken)
> +               flag = DO_FOR_EACH_INCLUDE_BROKEN;
> +       return do_for_each_ref(&ref_cache, prefix, fn, 0, flag, cb_data);
> +}
> +
>  int for_each_ref_in_submodule(const char *submodule, const char *prefix,
>                 each_ref_fn fn, void *cb_data)
>  {
> diff --git a/refs.h b/refs.h
> index e9a5f32..6d30c98 100644
> --- a/refs.h
> +++ b/refs.h
> @@ -173,6 +173,7 @@ typedef int each_ref_fn(const char *refname,
>  extern int head_ref(each_ref_fn fn, void *cb_data);
>  extern int for_each_ref(each_ref_fn fn, void *cb_data);
>  extern int for_each_ref_in(const char *prefix, each_ref_fn fn, void *cb_data);
> +extern int for_each_fullref_in(const char *prefix, each_ref_fn fn, void *cb_data, unsigned int broken);
>  extern int for_each_tag_ref(each_ref_fn fn, void *cb_data);
>  extern int for_each_branch_ref(each_ref_fn fn, void *cb_data);
>  extern int for_each_remote_ref(each_ref_fn fn, void *cb_data);
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]