From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH 1/2] refs: move is_pseudoref_syntax() earlier in the file
Date: Thu, 10 Dec 2020 13:53:20 +0100 [thread overview]
Message-ID: <20201210125321.19456-1-avarab@gmail.com> (raw)
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 --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))
--
2.29.2.222.g5d2a92d10f8
next reply other threads:[~2020-12-10 12:54 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-10 12:53 Ævar Arnfjörð Bjarmason [this message]
2020-12-10 12:53 ` [PATCH 2/2] refs: warn on non-pseudoref looking .git/<file> refs Ævar Arnfjörð Bjarmason
2020-12-10 14:39 ` Eric Sunshine
2020-12-10 20:28 ` Ævar Arnfjörð Bjarmason
2020-12-10 20:47 ` Eric Sunshine
2020-12-10 22:17 ` Ævar Arnfjörð Bjarmason
2020-12-14 19:16 ` [PATCH v2 0/2] " Ævar Arnfjörð Bjarmason
2020-12-14 19:16 ` [PATCH v2 1/2] refs: move is_pseudoref_syntax() earlier in the file Ævar Arnfjörð Bjarmason
2020-12-14 19:17 ` [PATCH v2 2/2] refs: warn on non-pseudoref looking .git/<file> refs Ævar Arnfjörð Bjarmason
2020-12-14 19:56 ` Eric Sunshine
2020-12-14 22:44 ` Junio C Hamano
2020-12-15 23:07 ` Ævar Arnfjörð Bjarmason
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201210125321.19456-1-avarab@gmail.com \
--to=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).