summaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2022-11-17 05:46:47 (GMT)
committerTaylor Blau <me@ttaylorr.com>2022-11-17 21:22:51 (GMT)
commit05b9425960d005e83ccf8308fea9f25fbd0bd861 (patch)
tree77d789234f621730301a73c1646ae90b7163e637 /revision.c
parent9b67eb6fbeb9666640f34cccf401cfea22f7bd22 (diff)
downloadgit-05b9425960d005e83ccf8308fea9f25fbd0bd861.zip
git-05b9425960d005e83ccf8308fea9f25fbd0bd861.tar.gz
git-05b9425960d005e83ccf8308fea9f25fbd0bd861.tar.bz2
revision: move together exclusion-related functions
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>
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/revision.c b/revision.c
index 0760e78..be75567 100644
--- a/revision.c
+++ b/revision.c
@@ -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 *))