@@ -630,6 +630,25 @@ int repo_dwim_ref(struct repository *r, const char *str, int len,
return refs_found;
}
+static int is_pseudoref_syntax(const char *refname)
+{
+ const char *c;
+
+ for (c = refname; *c; c++) {
+ if (!isupper(*c) && *c != '-' && *c != '_')
+ return 0;
+ }
+
+ return 1;
+}
+
+static int is_main_pseudoref_syntax(const char *refname)
+{
+ return skip_prefix(refname, "main-worktree/", &refname) &&
+ *refname &&
+ is_pseudoref_syntax(refname);
+}
+
int expand_ref(struct repository *repo, const char *str, int len,
struct object_id *oid, char **ref)
{
@@ -716,25 +735,6 @@ static 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;
- }
-
- return 1;
-}
-
-static int is_main_pseudoref_syntax(const char *refname)
-{
- return skip_prefix(refname, "main-worktree/", &refname) &&
- *refname &&
- is_pseudoref_syntax(refname);
-}
-
static int is_other_pseudoref_syntax(const char *refname)
{
if (!skip_prefix(refname, "worktrees/", &refname))
This move is needed by a subsequent change to the expand_ref() function, which will make use of these functions. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- refs.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-)