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>
Patrick Steinhardt committed
Nov 17, 2022 at 06:46 UTC
05b9425960d005e83ccf8308fea9f25fbd0bd861
1 file changed
+26
-26
revision.c
+26
-26
@@ -1517,14 +1517,6 @@ static void add_rev_cmdline_list(struct rev_info *revs,
1517
}
1518
}
1519
1520
-struct all_refs_cb {
1521
- int all_flags;
1522
- int warned_bad_reflog;
1523
- struct rev_info *all_revs;
1524
- const char *name_for_errormsg;
1525
- struct worktree *wt;
1526
-};
1527
-
1520
int ref_excluded(struct string_list *ref_excludes, const char *path)
1521
{
1522
struct string_list_item *item;
@@ -1538,6 +1530,32 @@ int ref_excluded(struct string_list *ref_excludes, const char *path)
1530
return 0;
1531
}
1532
1533
+void clear_ref_exclusion(struct string_list **ref_excludes_p)
1534
+{
1535
+ if (*ref_excludes_p) {
1536
+ string_list_clear(*ref_excludes_p, 0);
1537
+ free(*ref_excludes_p);
1538
+ }
1539
+ *ref_excludes_p = NULL;
1540
+}
1541
+
1542
+void add_ref_exclusion(struct string_list **ref_excludes_p, const char *exclude)
1543
+{
1544
+ if (!*ref_excludes_p) {
1545
+ CALLOC_ARRAY(*ref_excludes_p, 1);
1546
+ (*ref_excludes_p)->strdup_strings = 1;
1547
+ }
1548
+ string_list_append(*ref_excludes_p, exclude);
1549
+}
1550
+
1551
+struct all_refs_cb {
1552
+ int all_flags;
1553
+ int warned_bad_reflog;
1554
+ struct rev_info *all_revs;
1555
+ const char *name_for_errormsg;
1556
+ struct worktree *wt;
1557
+};
1558
+
1559
static int handle_one_ref(const char *path, const struct object_id *oid,
1560
int flag UNUSED,
1561
void *cb_data)
@@ -1563,24 +1581,6 @@ static void init_all_refs_cb(struct all_refs_cb *cb, struct rev_info *revs,
1581
cb->wt = NULL;
1582
}
1583
1566
-void clear_ref_exclusion(struct string_list **ref_excludes_p)
1567
-{
1568
- if (*ref_excludes_p) {
1569
- string_list_clear(*ref_excludes_p, 0);
1570
- free(*ref_excludes_p);
1571
- }
1572
- *ref_excludes_p = NULL;
1573
-}
1574
-
1575
-void add_ref_exclusion(struct string_list **ref_excludes_p, const char *exclude)
1576
-{
1577
- if (!*ref_excludes_p) {
1578
- CALLOC_ARRAY(*ref_excludes_p, 1);
1579
- (*ref_excludes_p)->strdup_strings = 1;
1580
- }
1581
- string_list_append(*ref_excludes_p, exclude);
1582
-}
1583
-
1584
static void handle_refs(struct ref_store *refs,
1585
struct rev_info *revs, unsigned flags,
1586
int (*for_each)(struct ref_store *, each_ref_fn, void *))