mirror of
https://github.com/git/git.git
synced 2026-01-10 10:13:33 +00:00
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>
This commit is contained in:
committed by
Taylor Blau
parent
9b67eb6fbe
commit
05b9425960
52
revision.c
52
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)
|
int ref_excluded(struct string_list *ref_excludes, const char *path)
|
||||||
{
|
{
|
||||||
struct string_list_item *item;
|
struct string_list_item *item;
|
||||||
@@ -1538,6 +1530,32 @@ int ref_excluded(struct string_list *ref_excludes, const char *path)
|
|||||||
return 0;
|
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,
|
static int handle_one_ref(const char *path, const struct object_id *oid,
|
||||||
int flag UNUSED,
|
int flag UNUSED,
|
||||||
void *cb_data)
|
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;
|
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,
|
static void handle_refs(struct ref_store *refs,
|
||||||
struct rev_info *revs, unsigned flags,
|
struct rev_info *revs, unsigned flags,
|
||||||
int (*for_each)(struct ref_store *, each_ref_fn, void *))
|
int (*for_each)(struct ref_store *, each_ref_fn, void *))
|
||||||
|
|||||||
Reference in New Issue
Block a user