aboutsummaryrefslogtreecommitdiffstats
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-03-15 16:05:59 -0700
committerJunio C Hamano <gitster@pobox.com>2024-03-15 16:05:59 -0700
commitb09a8839a4a09ab5bea79bcfe892b2591097319a (patch)
treeaf4aacfc4fdedf2d58eeaba10b75b316e7b21130 /builtin
parent4f9b731bdeccffa1b13e5edf4bc0428b8d49704e (diff)
parent8fbd903e58503cbdd1f1c816dd0c6c3c4d591b13 (diff)
downloadgit-b09a8839a4a09ab5bea79bcfe892b2591097319a.tar.gz
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
Diffstat (limited to 'builtin')
-rw-r--r--builtin/branch.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/builtin/branch.c b/builtin/branch.c
index b3cbb7fd44..8c2305ad2c 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -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++) {