From: Kristoffer Haugsbakk Date: Tue, 2 Dec 2025 15:56:51 +0000 (+0100) Subject: branch: advice using git-help(1) instead of man(1) X-Git-Url: https://git.feebdaed.xyz/?a=commitdiff_plain;h=b14f1df9f26cf87856cf6767847ccb4a5b31499b;p=0xmirror%2Fgit.git branch: advice using git-help(1) instead of man(1) 8fbd903e (branch: advise about ref syntax rules, 2024-03-05) added an advice about checking git-check-ref-format(1) for the ref syntax rules. The advice uses man(1). But git(1) is a multi-platform tool and man(1) may not be available on some platforms. It might also be slightly jarring to see a suggestion for running a command which is not from the Git suite. Let’s instead use git-help(1) in order to stay inside the land of git(1). This also means that `help.format` (for `man`, `html` or other formats) will be used if set. Also change to using single quotes (') to quote the command since that is more conventional. While here let’s also update the test to use `{SQ}`, which is more readable and easier to edit. Signed-off-by: Kristoffer Haugsbakk Signed-off-by: Junio C Hamano --- diff --git a/branch.c b/branch.c index 26be358347..243db7d0fc 100644 --- a/branch.c +++ b/branch.c @@ -375,7 +375,7 @@ int validate_branchname(const char *name, struct strbuf *ref) if (check_branch_ref(ref, name)) { int code = die_message(_("'%s' is not a valid branch name"), name); advise_if_enabled(ADVICE_REF_SYNTAX, - _("See `man git check-ref-format`")); + _("See 'git help check-ref-format'")); exit(code); } diff --git a/builtin/branch.c b/builtin/branch.c index 9fcf04bebb..c577b5d20f 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -591,7 +591,7 @@ static void copy_or_rename_branch(const char *oldname, const char *newname, int else { int code = die_message(_("invalid branch name: '%s'"), oldname); advise_if_enabled(ADVICE_REF_SYNTAX, - _("See `man git check-ref-format`")); + _("See 'git help check-ref-format'")); exit(code); } } diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index f3e720dc10..c58e505c43 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -1707,9 +1707,9 @@ test_expect_success '--track overrides branch.autoSetupMerge' ' ' test_expect_success 'errors if given a bad branch name' ' - cat <<-\EOF >expect && - fatal: '\''foo..bar'\'' is not a valid branch name - hint: See `man git check-ref-format` + cat <<-EOF >expect && + fatal: ${SQ}foo..bar${SQ} is not a valid branch name + hint: See ${SQ}git help check-ref-format${SQ} hint: Disable this message with "git config set advice.refSyntax false" EOF test_must_fail git branch foo..bar >actual 2>&1 &&