]> git.ipfire.org Git - thirdparty/git.git/commitdiff
revision: move together exclusion-related functions
authorPatrick Steinhardt <ps@pks.im>
Thu, 17 Nov 2022 05:46:47 +0000 (06:46 +0100)
committerTaylor Blau <me@ttaylorr.com>
Thu, 17 Nov 2022 21:22:51 +0000 (16:22 -0500)
Move together the definitions of functions that handle exclusions of
refs so that related functionality sits in a single place, only.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
revision.c

index 0760e78936e4f147fc3170d4a7ba75b7e6e88ab5..be755670e22c16d96bc35a01a335903a69e6f398 100644 (file)
@@ -1517,14 +1517,6 @@ static void add_rev_cmdline_list(struct rev_info *revs,
        }
 }
 
-struct all_refs_cb {
-       int all_flags;
-       int warned_bad_reflog;
-       struct rev_info *all_revs;
-       const char *name_for_errormsg;
-       struct worktree *wt;
-};
-
 int ref_excluded(struct string_list *ref_excludes, const char *path)
 {
        struct string_list_item *item;
@@ -1538,6 +1530,32 @@ int ref_excluded(struct string_list *ref_excludes, const char *path)
        return 0;
 }
 
+void clear_ref_exclusion(struct string_list **ref_excludes_p)
+{
+       if (*ref_excludes_p) {
+               string_list_clear(*ref_excludes_p, 0);
+               free(*ref_excludes_p);
+       }
+       *ref_excludes_p = NULL;
+}
+
+void add_ref_exclusion(struct string_list **ref_excludes_p, const char *exclude)
+{
+       if (!*ref_excludes_p) {
+               CALLOC_ARRAY(*ref_excludes_p, 1);
+               (*ref_excludes_p)->strdup_strings = 1;
+       }
+       string_list_append(*ref_excludes_p, exclude);
+}
+
+struct all_refs_cb {
+       int all_flags;
+       int warned_bad_reflog;
+       struct rev_info *all_revs;
+       const char *name_for_errormsg;
+       struct worktree *wt;
+};
+
 static int handle_one_ref(const char *path, const struct object_id *oid,
                          int flag UNUSED,
                          void *cb_data)
@@ -1563,24 +1581,6 @@ static void init_all_refs_cb(struct all_refs_cb *cb, struct rev_info *revs,
        cb->wt = NULL;
 }
 
-void clear_ref_exclusion(struct string_list **ref_excludes_p)
-{
-       if (*ref_excludes_p) {
-               string_list_clear(*ref_excludes_p, 0);
-               free(*ref_excludes_p);
-       }
-       *ref_excludes_p = NULL;
-}
-
-void add_ref_exclusion(struct string_list **ref_excludes_p, const char *exclude)
-{
-       if (!*ref_excludes_p) {
-               CALLOC_ARRAY(*ref_excludes_p, 1);
-               (*ref_excludes_p)->strdup_strings = 1;
-       }
-       string_list_append(*ref_excludes_p, exclude);
-}
-
 static void handle_refs(struct ref_store *refs,
                        struct rev_info *revs, unsigned flags,
                        int (*for_each)(struct ref_store *, each_ref_fn, void *))