From: Junio C Hamano Date: Thu, 13 Jun 2019 20:19:40 +0000 (-0700) Subject: Merge branch 'nd/worktree-name-sanitization' X-Git-Tag: v2.23.0-rc0~138 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/0d107b19890db191c9281bff67180389fb53df24 Merge branch 'nd/worktree-name-sanitization' In recent versions of Git, per-worktree refs are exposed in refs/worktrees// hierarchy, which means that worktree names must be a valid refname component. The code now sanitizes the names given to worktrees, to make sure these refs are well-formed. * nd/worktree-name-sanitization: worktree add: sanitize worktree names --- 0d107b19890db191c9281bff67180389fb53df24 diff --cc refs.h index 2727405b61,4d8c5465c3..730d05ad91 --- a/refs.h +++ b/refs.h @@@ -463,10 -460,14 +463,16 @@@ int for_each_reflog(each_ref_fn fn, voi */ int check_refname_format(const char *refname, int flags); + /* + * Apply the rules from check_refname_format, but mutate the result until it + * is acceptable, and place the result in "out". + */ + void sanitize_refname_component(const char *refname, struct strbuf *out); + const char *prettify_refname(const char *refname); +char *refs_shorten_unambiguous_ref(struct ref_store *refs, + const char *refname, int strict); char *shorten_unambiguous_ref(const char *refname, int strict); /** rename ref, return 0 on success **/