diff mbox series

[1/2] refs: move is_pseudoref_syntax() earlier in the file

Message ID 20201210125321.19456-1-avarab@gmail.com (mailing list archive)
State Superseded
Headers show
Series [1/2] refs: move is_pseudoref_syntax() earlier in the file | expand

Commit Message

Ævar Arnfjörð Bjarmason Dec. 10, 2020, 12:53 p.m. UTC
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(-)
diff mbox series

Patch

diff --git a/refs.c b/refs.c
index 392f0bbf68b..3ec5dcba0be 100644
--- a/refs.c
+++ b/refs.c
@@ -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))