Merge branch 'nd/worktree-name-sanitization'

In recent versions of Git, per-worktree refs are exposed in
refs/worktrees/<wtname>/ 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
This commit is contained in:
Junio C Hamano
2019-06-13 13:19:40 -07:00
4 changed files with 110 additions and 21 deletions

6
refs.h
View File

@@ -463,6 +463,12 @@ int for_each_reflog(each_ref_fn fn, void *cb_data);
*/
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,