Skip to content

Commit b14f1df

Browse files
LemmingAvalanchegitster
authored andcommitted
branch: advice using git-help(1) instead of man(1)
8fbd903 (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f0ef5b6 commit b14f1df

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

branch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ int validate_branchname(const char *name, struct strbuf *ref)
375375
if (check_branch_ref(ref, name)) {
376376
int code = die_message(_("'%s' is not a valid branch name"), name);
377377
advise_if_enabled(ADVICE_REF_SYNTAX,
378-
_("See `man git check-ref-format`"));
378+
_("See 'git help check-ref-format'"));
379379
exit(code);
380380
}
381381

builtin/branch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ static void copy_or_rename_branch(const char *oldname, const char *newname, int
591591
else {
592592
int code = die_message(_("invalid branch name: '%s'"), oldname);
593593
advise_if_enabled(ADVICE_REF_SYNTAX,
594-
_("See `man git check-ref-format`"));
594+
_("See 'git help check-ref-format'"));
595595
exit(code);
596596
}
597597
}

t/t3200-branch.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,9 +1707,9 @@ test_expect_success '--track overrides branch.autoSetupMerge' '
17071707
'
17081708

17091709
test_expect_success 'errors if given a bad branch name' '
1710-
cat <<-\EOF >expect &&
1711-
fatal: '\''foo..bar'\'' is not a valid branch name
1712-
hint: See `man git check-ref-format`
1710+
cat <<-EOF >expect &&
1711+
fatal: ${SQ}foo..bar${SQ} is not a valid branch name
1712+
hint: See ${SQ}git help check-ref-format${SQ}
17131713
hint: Disable this message with "git config set advice.refSyntax false"
17141714
EOF
17151715
test_must_fail git branch foo..bar >actual 2>&1 &&

0 commit comments

Comments
 (0)