summaryrefslogtreecommitdiff
path: root/ref-filter.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-10-05 19:30:02 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-10-05 19:30:03 (GMT)
commit9958dd8685a0a8b3d6ecdd07e35d8ecb22b304a7 (patch)
tree33890dd97b16e432a06810ee92b7fd25da71dfe1 /ref-filter.h
parentbe08dee9738eaaa0423885ed189c2b6ad8368cf0 (diff)
parent4a71109aa442ba1a7045d36f6b148113c95ffc48 (diff)
downloadgit-9958dd8685a0a8b3d6ecdd07e35d8ecb22b304a7.zip
git-9958dd8685a0a8b3d6ecdd07e35d8ecb22b304a7.tar.gz
git-9958dd8685a0a8b3d6ecdd07e35d8ecb22b304a7.tar.bz2
Merge branch 'kn/for-each-tag-branch'
Some features from "git tag -l" and "git branch -l" have been made available to "git for-each-ref" so that eventually the unified implementation can be shared across all three, in a follow-up series or two. * kn/for-each-tag-branch: for-each-ref: add '--contains' option ref-filter: implement '--contains' option parse-options.h: add macros for '--contains' option parse-option: rename parse_opt_with_commit() for-each-ref: add '--merged' and '--no-merged' options ref-filter: implement '--merged' and '--no-merged' options ref-filter: add parse_opt_merge_filter() for-each-ref: add '--points-at' option ref-filter: implement '--points-at' option tag: libify parse_opt_points_at() t6302: for-each-ref tests for ref-filter APIs
Diffstat (limited to 'ref-filter.h')
-rw-r--r--ref-filter.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/ref-filter.h b/ref-filter.h
index 6997984..6bf27d8 100644
--- a/ref-filter.h
+++ b/ref-filter.h
@@ -31,6 +31,7 @@ struct ref_array_item {
unsigned char objectname[20];
int flag;
const char *symref;
+ struct commit *commit;
struct atom_value *value;
char refname[FLEX_ARRAY];
};
@@ -42,6 +43,17 @@ struct ref_array {
struct ref_filter {
const char **name_patterns;
+ struct sha1_array points_at;
+ struct commit_list *with_commit;
+
+ enum {
+ REF_FILTER_MERGED_NONE = 0,
+ REF_FILTER_MERGED_INCLUDE,
+ REF_FILTER_MERGED_OMIT
+ } merge;
+ struct commit *merge_commit;
+
+ unsigned int with_commit_tag_algo : 1;
};
struct ref_filter_cbdata {
@@ -49,6 +61,15 @@ struct ref_filter_cbdata {
struct ref_filter *filter;
};
+/* Macros for checking --merged and --no-merged options */
+#define _OPT_MERGED_NO_MERGED(option, filter, h) \
+ { OPTION_CALLBACK, 0, option, (filter), N_("commit"), (h), \
+ PARSE_OPT_LASTARG_DEFAULT | PARSE_OPT_NONEG, \
+ parse_opt_merge_filter, (intptr_t) "HEAD" \
+ }
+#define OPT_MERGED(f, h) _OPT_MERGED_NO_MERGED("merged", f, h)
+#define OPT_NO_MERGED(f, h) _OPT_MERGED_NO_MERGED("no-merged", f, h)
+
/*
* API for filtering a set of refs. Based on the type of refs the user
* has requested, we iterate through those refs and apply filters
@@ -70,5 +91,7 @@ void show_ref_array_item(struct ref_array_item *info, const char *format, int qu
int parse_opt_ref_sorting(const struct option *opt, const char *arg, int unset);
/* Default sort option based on refname */
struct ref_sorting *ref_default_sorting(void);
+/* Function to parse --merged and --no-merged options */
+int parse_opt_merge_filter(const struct option *opt, const char *arg, int unset);
#endif /* REF_FILTER_H */