config.mak.uname: set FREAD_READS_DIRECTORIES for Linux and FreeBSD
[gitweb.git] / ref-filter.h
index 6bf27d8bc4a0b32c0c457b34b3a36e457f89b029..c20167aa3c785f0060147204d963537f58617570 100644 (file)
 #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 {
-       const char *s;
-       unsigned long ul; /* used for sorting when not FIELD_STR */
-};
+struct atom_value;
 
 struct ref_sorting {
        struct ref_sorting *next;
        int atom; /* index into used_atom array (internal) */
-       unsigned reverse : 1;
+       unsigned reverse : 1,
+               ignore_case : 1,
+               version : 1;
 };
 
 struct ref_array_item {
        unsigned char objectname[20];
        int flag;
+       unsigned int kind;
        const char *symref;
        struct commit *commit;
        struct atom_value *value;
@@ -39,12 +46,14 @@ struct ref_array_item {
 struct ref_array {
        int nr, alloc;
        struct ref_array_item **items;
+       struct rev_info *revs;
 };
 
 struct ref_filter {
        const char **name_patterns;
-       struct sha1_array points_at;
+       struct oid_array points_at;
        struct commit_list *with_commit;
+       struct commit_list *no_commit;
 
        enum {
                REF_FILTER_MERGED_NONE = 0,
@@ -53,12 +62,14 @@ struct ref_filter {
        } merge;
        struct commit *merge_commit;
 
-       unsigned int with_commit_tag_algo : 1;
-};
-
-struct ref_filter_cbdata {
-       struct ref_array *array;
-       struct ref_filter *filter;
+       unsigned int with_commit_tag_algo : 1,
+               match_as_path : 1,
+               ignore_case : 1,
+               detached : 1;
+       unsigned int kind,
+               lines;
+       int abbrev,
+               verbose;
 };
 
 /*  Macros for checking --merged and --no-merged options */
@@ -85,6 +96,9 @@ int parse_ref_filter_atom(const char *atom, const char *ep);
 int verify_ref_format(const char *format);
 /*  Sort the given ref_array as per the ref_sorting provided */
 void ref_array_sort(struct ref_sorting *sort, struct ref_array *array);
+/*  Based on the given format and quote_style, fill the strbuf */
+void format_ref_array_item(struct ref_array_item *info, const char *format,
+                          int quote_style, struct strbuf *final_buf);
 /*  Print the ref using the given format and quote_style */
 void show_ref_array_item(struct ref_array_item *info, const char *format, int quote_style);
 /*  Callback function for parsing the sort option */
@@ -93,5 +107,16 @@ int parse_opt_ref_sorting(const struct option *opt, const char *arg, int unset);
 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);
+/*  Get the current HEAD's description */
+char *get_head_description(void);
+/*  Set up translated strings in the output. */
+void setup_ref_filter_porcelain_msg(void);
+
+/*
+ * Print a single ref, outside of any ref-filter. Note that the
+ * name must be a fully qualified refname.
+ */
+void pretty_print_ref(const char *name, const unsigned char *sha1,
+               const char *format);
 
 #endif /*  REF_FILTER_H  */