From: Kristoffer Haugsbakk <code@khaugsbakk.name>
To: git@vger.kernel.org
Cc: "Kristoffer Haugsbakk" <code@khaugsbakk.name>,
"Elijah Newren" <newren@gmail.com>,
"Jean-Noël Avila" <avila.jn@gmail.com>
Subject: [PATCH v3 0/5] advise about ref syntax rules
Date: Mon, 4 Mar 2024 23:07:25 +0100 [thread overview]
Message-ID: <cover.1709590037.git.code@khaugsbakk.name> (raw)
In-Reply-To: <4ad5d4190649dcb5f26c73a6f15ab731891b9dfd.1709491818.git.code@khaugsbakk.name>
Point the user towards the ref/branch name syntax rules if they give an
invalid name.
Also make some spatially-appropriate improvements:
• Test style
• `advice.txt`
§ git-replace(1)
(see previous cover letter)
§ Alternatives (to this change)
While working on this I also thought that it might be nice to have a
man page `gitrefsyntax`. That one could use a lot of the content from
`man git check-ref-format` verbatim. Then the hint could point towards
that man page. And it seems that AsciiDoc supports _includes_ which
means that the rules don’t have to be duplicated between the two man
pages.
§ CC
For changes to `advice.txt`:
Cc: Elijah Newren <newren@gmail.com>
Cc: Jean-Noël Avila <avila.jn@gmail.com>
§ Changes in v3
• New preliminary patches 1–4
• Fix test style
• Improvements to `advice.txt` (style consistency and other)
• Patch 5/5:
• Tweak advice doc for the new entry
• Better test style
Kristoffer Haugsbakk (5):
t3200: improve test style
advice: make all entries stylistically consistent
advice: use backticks for code
advice: use double quotes for regular quoting
branch: advise about ref syntax rules
Documentation/config/advice.txt | 91 ++++++++++++-----------
advice.c | 1 +
advice.h | 1 +
branch.c | 8 +-
builtin/branch.c | 8 +-
t/t3200-branch.sh | 125 +++++++++++++++++---------------
6 files changed, 127 insertions(+), 107 deletions(-)
Range-diff against v2:
-: ----------- > 1: e6a2628ce57 t3200: improve test style
-: ----------- > 2: d48b4719c27 advice: make all entries stylistically consistent
-: ----------- > 3: 30d662a04c7 advice: use backticks for code
-: ----------- > 4: 3028713357f advice: use double quotes for regular quoting
1: 4ad5d419064 ! 5: 402b7937951 branch: advise about ref syntax rules
@@ Commit message
## Notes (series) ##
+ v3:
+ • Tweak advice doc for the new entry
+ • Better test style
v2:
• Make the advise optional via configuration
• Propagate error properly with `die_message(…)` instead of `exit(1)`
@@ Notes (series)
## Documentation/config/advice.txt ##
@@ Documentation/config/advice.txt: advice.*::
- 'pushNonFFCurrent', 'pushNonFFMatching', 'pushAlreadyExists',
- 'pushFetchFirst', 'pushNeedsForce', and 'pushRefNeedsUpdate'
+ `pushNonFFCurrent`, `pushNonFFMatching`, `pushAlreadyExists`,
+ `pushFetchFirst`, `pushNeedsForce`, and `pushRefNeedsUpdate`
simultaneously.
+ refSyntax::
-+ Point the user towards the ref syntax documentation if
-+ they give an invalid ref name.
++ Shown when the user provides an illegal ref name: point
++ towards the ref syntax documentation.
resetNoRefresh::
- Advice to consider using the `--no-refresh` option to
- linkgit:git-reset[1] when the command takes more than 2 seconds
+ Shown when linkgit:git-reset[1] takes more than 2
+ seconds to refresh the index after reset: tell the user
## advice.c ##
@@ advice.c: static struct {
@@ t/t3200-branch.sh: test_expect_success '--track overrides branch.autoSetupMerge'
test_cmp_config "" --default "" branch.foo5.merge
'
-+cat <<\EOF >expect
-+fatal: 'foo..bar' is not a valid branch name
-+hint: See `man git check-ref-format`
-+hint: Disable this message with "git config advice.refSyntax false"
-+EOF
-+
+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`
++ hint: Disable this message with "git config advice.refSyntax false"
++ EOF
+ test_must_fail git branch foo..bar >actual 2>&1 &&
+ test_cmp expect actual
+'
--
2.44.0.64.g52b67adbeb2
next prev parent reply other threads:[~2024-03-04 22:08 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-01 15:38 [PATCH] branch: advise about ref syntax rules Kristoffer Haugsbakk
2024-03-01 18:06 ` Junio C Hamano
2024-03-01 18:13 ` Kristoffer Haugsbakk
2024-03-01 18:32 ` Junio C Hamano
2024-03-03 18:58 ` [PATCH v2 0/1] " Kristoffer Haugsbakk
2024-03-03 18:58 ` [PATCH v2 1/1] branch: " Kristoffer Haugsbakk
2024-03-03 22:42 ` Junio C Hamano
2024-03-03 22:58 ` Kristoffer Haugsbakk
2024-03-04 22:07 ` Kristoffer Haugsbakk [this message]
2024-03-04 22:07 ` [PATCH v3 1/5] t3200: improve test style Kristoffer Haugsbakk
2024-03-05 1:25 ` Junio C Hamano
2024-03-05 10:27 ` Kristoffer Haugsbakk
2024-03-05 16:02 ` Junio C Hamano
2024-03-04 22:07 ` [PATCH v3 2/5] advice: make all entries stylistically consistent Kristoffer Haugsbakk
2024-03-04 23:52 ` Junio C Hamano
2024-03-05 10:36 ` Kristoffer Haugsbakk
2024-03-04 22:07 ` [PATCH v3 3/5] advice: use backticks for code Kristoffer Haugsbakk
2024-03-04 23:54 ` Junio C Hamano
2024-03-05 10:29 ` Kristoffer Haugsbakk
2024-03-04 22:07 ` [PATCH v3 4/5] advice: use double quotes for regular quoting Kristoffer Haugsbakk
2024-03-04 22:07 ` [PATCH v3 5/5] branch: advise about ref syntax rules Kristoffer Haugsbakk
2024-03-05 20:29 ` [PATCH v4 0/5] " Kristoffer Haugsbakk
2024-03-05 20:29 ` [PATCH v4 1/5] t3200: improve test style Kristoffer Haugsbakk
2024-03-05 20:29 ` [PATCH v4 2/5] advice: make all entries stylistically consistent Kristoffer Haugsbakk
2024-03-05 20:29 ` [PATCH v4 3/5] advice: use backticks for verbatim Kristoffer Haugsbakk
2024-03-05 20:29 ` [PATCH v4 4/5] advice: use double quotes for regular quoting Kristoffer Haugsbakk
2024-03-05 20:29 ` [PATCH v4 5/5] branch: advise about ref syntax rules Kristoffer Haugsbakk
2024-03-03 19:10 ` [PATCH v2 0/1] " Kristoffer Haugsbakk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1709590037.git.code@khaugsbakk.name \
--to=code@khaugsbakk.name \
--cc=avila.jn@gmail.com \
--cc=git@vger.kernel.org \
--cc=newren@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).