Merge branch 'kh/branch-ref-syntax-advice'

When git refuses to create a branch because the proposed branch
name is not a valid refname, an advice message is given to refer
the user to exact naming rules.

* kh/branch-ref-syntax-advice:
  branch: advise about ref syntax rules
  advice: use double quotes for regular quoting
  advice: use backticks for verbatim
  advice: make all entries stylistically consistent
  t3200: improve test style
This commit is contained in:
Junio C Hamano
2024-03-15 16:05:59 -07:00
6 changed files with 128 additions and 108 deletions

View File

@@ -582,8 +582,12 @@ static void copy_or_rename_branch(const char *oldname, const char *newname, int
*/
if (ref_exists(oldref.buf))
recovery = 1;
else
die(_("invalid branch name: '%s'"), oldname);
else {
int code = die_message(_("invalid branch name: '%s'"), oldname);
advise_if_enabled(ADVICE_REF_SYNTAX,
_("See `man git check-ref-format`"));
exit(code);
}
}
for (int i = 0; worktrees[i]; i++) {