strbuf_branchname: add docstring
This function and its companion, strbuf_check_branch_ref(), did not have their purpose or semantics explained. Let's do so. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Mar 2, 2017 at 03:21 UTC
0705fe202dd30009e2033e96a17cb12299bf5ab3
1 file changed
+15
strbuf.h
+15
@@ -562,7 +562,22 @@ static inline void strbuf_complete_line(struct strbuf *sb)
562
strbuf_complete(sb, '\n');
563
}
564
565
+/*
566
+ * Copy "name" to "sb", expanding any special @-marks as handled by
567
+ * interpret_branch_name(). The result is a non-qualified branch name
568
+ * (so "foo" or "origin/master" instead of "refs/heads/foo" or
569
+ * "refs/remotes/origin/master").
570
+ *
571
+ * Note that the resulting name may not be a syntactically valid refname.
572
+ */
573
extern void strbuf_branchname(struct strbuf *sb, const char *name);
574
+
575
+/*
576
+ * Like strbuf_branchname() above, but confirm that the result is
577
+ * syntactically valid to be used as a local branch name in refs/heads/.
578
+ *
579
+ * The return value is "0" if the result is valid, and "-1" otherwise.
580
+ */
581
extern int strbuf_check_branch_ref(struct strbuf *sb, const char *name);
582
583
extern void strbuf_addstr_urlencode(struct strbuf *, const char *,