summaryrefslogtreecommitdiffstats
path: root/refs.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-12-16 02:54:26 +0100
committerJunio C Hamano <gitster@pobox.com>2024-12-16 02:54:26 +0100
commitab738b2f1f35fbc3658ac107e1ad55b21c1e0fbc (patch)
tree8eb63219f3a49d742357586e6b924254a5adb834 /refs.h
parentMerge branch 'jk/describe-perf' (diff)
parenttag: "git tag" refuses to use HEAD as a tagname (diff)
downloadgit-ab738b2f1f35fbc3658ac107e1ad55b21c1e0fbc.tar.xz
git-ab738b2f1f35fbc3658ac107e1ad55b21c1e0fbc.zip
Merge branch 'jc/forbid-head-as-tagname'
"git tag" has been taught to refuse to create refs/tags/HEAD as such a tag will be confusing in the context of UI provided by the Git Porcelain commands. * jc/forbid-head-as-tagname: tag: "git tag" refuses to use HEAD as a tagname t5604: do not expect that HEAD can be a valid tagname refs: drop strbuf_ prefix from helpers refs: move ref name helpers around
Diffstat (limited to 'refs.h')
-rw-r--r--refs.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/refs.h b/refs.h
index a5bedf48cf..e15a31ac80 100644
--- a/refs.h
+++ b/refs.h
@@ -184,6 +184,35 @@ int repo_dwim_log(struct repository *r, const char *str, int len, struct object_
char *repo_default_branch_name(struct repository *r, int quiet);
/*
+ * Copy "name" to "sb", expanding any special @-marks as handled by
+ * repo_interpret_branch_name(). The result is a non-qualified branch name
+ * (so "foo" or "origin/master" instead of "refs/heads/foo" or
+ * "refs/remotes/origin/master").
+ *
+ * Note that the resulting name may not be a syntactically valid refname.
+ *
+ * If "allowed" is non-zero, restrict the set of allowed expansions. See
+ * repo_interpret_branch_name() for details.
+ */
+void copy_branchname(struct strbuf *sb, const char *name,
+ unsigned allowed);
+
+/*
+ * Like copy_branchname() above, but confirm that the result is
+ * syntactically valid to be used as a local branch name in refs/heads/.
+ *
+ * The return value is "0" if the result is valid, and "-1" otherwise.
+ */
+int check_branch_ref(struct strbuf *sb, const char *name);
+
+/*
+ * Similar for a tag name in refs/tags/.
+ *
+ * The return value is "0" if the result is valid, and "-1" otherwise.
+ */
+int check_tag_ref(struct strbuf *sb, const char *name);
+
+/*
* A ref_transaction represents a collection of reference updates that
* should succeed or fail together.
*