ref-filter: add option to filter out tags, branches and remotes
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. Mentored-by: Christian Couder <christian.couder@gmail.com> Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr> Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
ce59208293
commit
5b4f28510f
13
ref-filter.h
13
ref-filter.h
@ -13,8 +13,15 @@
|
||||
#define QUOTE_PYTHON 4
|
||||
#define QUOTE_TCL 8
|
||||
|
||||
#define FILTER_REFS_INCLUDE_BROKEN 0x1
|
||||
#define FILTER_REFS_ALL 0x2
|
||||
#define FILTER_REFS_INCLUDE_BROKEN 0x0001
|
||||
#define FILTER_REFS_TAGS 0x0002
|
||||
#define FILTER_REFS_BRANCHES 0x0004
|
||||
#define FILTER_REFS_REMOTES 0x0008
|
||||
#define FILTER_REFS_OTHERS 0x0010
|
||||
#define FILTER_REFS_ALL (FILTER_REFS_TAGS | FILTER_REFS_BRANCHES | \
|
||||
FILTER_REFS_REMOTES | FILTER_REFS_OTHERS)
|
||||
#define FILTER_REFS_DETACHED_HEAD 0x0020
|
||||
#define FILTER_REFS_KIND_MASK (FILTER_REFS_ALL | FILTER_REFS_DETACHED_HEAD)
|
||||
|
||||
struct atom_value;
|
||||
|
||||
@ -27,6 +34,7 @@ struct ref_sorting {
|
||||
struct ref_array_item {
|
||||
unsigned char objectname[20];
|
||||
int flag;
|
||||
unsigned int kind;
|
||||
const char *symref;
|
||||
struct commit *commit;
|
||||
struct atom_value *value;
|
||||
@ -51,6 +59,7 @@ struct ref_filter {
|
||||
struct commit *merge_commit;
|
||||
|
||||
unsigned int with_commit_tag_algo : 1;
|
||||
unsigned int kind;
|
||||
};
|
||||
|
||||
struct ref_filter_cbdata {
|
||||
|
Reference in New Issue
Block a user