@@ -164,6 +164,22 @@ void update_ref_namespace(enum ref_namespace namespace, char *ref)
info->ref_updated = 1;
}
+static int is_pseudoref_syntax(const char *refname)
+{
+ const char *c;
+
+ for (c = refname; *c; c++) {
+ if (!isupper(*c) && *c != '-' && *c != '_')
+ return 0;
+ }
+
+ /*
+ * HEAD is not a pseudoref, but it certainly uses the
+ * pseudoref syntax.
+ */
+ return 1;
+}
+
/*
* Try to read one refname component from the front of refname.
* Return the length of the component found, or -1 if the component is
@@ -844,22 +860,6 @@ int is_per_worktree_ref(const char *refname)
starts_with(refname, "refs/rewritten/");
}
-static int is_pseudoref_syntax(const char *refname)
-{
- const char *c;
-
- for (c = refname; *c; c++) {
- if (!isupper(*c) && *c != '-' && *c != '_')
- return 0;
- }
-
- /*
- * HEAD is not a pseudoref, but it certainly uses the
- * pseudoref syntax.
- */
- return 1;
-}
-
int is_pseudoref(struct ref_store *refs, const char *refname)
{
static const char *const irregular_pseudorefs[] = {
We have a static local function is_pseudoref_syntax(), used by is_pseudoref(). The difference being that the former checks only syntax, whereas the latter actually looks at the on-disk refs. There are a few other places in the file where we care about the pseudoref syntax and could make use of this function. Let's move it earlier in the file, so it can be used more extensively without having to forward declare it. Signed-off-by: Jeff King <peff@peff.net> --- refs.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)