From patchwork Tue Mar 5 20:29:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kristoffer Haugsbakk X-Patchwork-Id: 13582993 Received: from fhigh2-smtp.messagingengine.com (fhigh2-smtp.messagingengine.com [103.168.172.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 44AE618EB0 for ; Tue, 5 Mar 2024 20:31:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.153 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709670668; cv=none; b=U1a4RMeLi0Hxsl90aziOlToMUmv12k3975CZTdtIj1EnYOxM3A7IcI9djg9D+7OnMv0ALuwAde9wqXrRsWR4Mufu0WqLsScchoSXcgRHTJyYz23Vtkjy4UInMk4QwaSuHNE3oJX0tNxzbhIrCIus3i7e+1PM+jrHDZcI5ZFDz4s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709670668; c=relaxed/simple; bh=W2NhHCd1tqUsbO4AGYGV35qXH3fJa2n/XvrRAh/1taQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=c6r+Jt42Joxok3gMqhYVfOCBu2pZJlPRPGFJeNutbRje0cq63slyDYlvoB08mtWGOTaWNNEHajpahWeBJOYuo3SbM3PJFeLZ21dz4vBOFvrx13KKsG46XzGIRfcyMzRwXvl0thrTBo5K59wnHXCjjRfqX3baHfG2wwwrfkC+h9g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=khaugsbakk.name; spf=pass smtp.mailfrom=khaugsbakk.name; dkim=pass (2048-bit key) header.d=khaugsbakk.name header.i=@khaugsbakk.name header.b=bJSrKDLG; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=VmycGahS; arc=none smtp.client-ip=103.168.172.153 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=khaugsbakk.name Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=khaugsbakk.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=khaugsbakk.name header.i=@khaugsbakk.name header.b="bJSrKDLG"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="VmycGahS" Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 42DA811401BA; Tue, 5 Mar 2024 15:31:05 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 05 Mar 2024 15:31:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=khaugsbakk.name; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm3; t=1709670665; x=1709757065; bh=iFIZNsfW3s5RrBSpyA2jYrK/ufx7DF7+ FD5H6dUY8e8=; b=bJSrKDLGcUtd/G0+NGZfThfHhEi/4OmcmOLzZMXBTHfR0v00 KVMgWijjeITGdaTFND6B7nnSlQxD5NMLwNvvYCxnvQ1ll3isASmGBzklxCTQD/dN lEqJFnOxJ3jIOzLsGiAga8L7iHADkq78/Hql7LqCoVlzSq+/QmLFNUsaNqhkX6tF /LfmAimi/sBvIenVhcQxytOt27XVSa9J7gb0pgVZT2535taizHBG12Dp0LfqUxIo hLGkjhGXwS/y5x3TbW98XV9weT+efcqRuiQ0w+tUizEoHzlNp5OWssVVmRusKACi Kr4c5MYa/m4NVyG0Slrg/kUzx6HsSL2aGlPhng== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1709670665; x= 1709757065; bh=iFIZNsfW3s5RrBSpyA2jYrK/ufx7DF7+FD5H6dUY8e8=; b=V mycGahS+c4zFSijAlP6BbvogU1Ew2KONlR3g2bsNphes/9lRmz9VWbxHN2dzxIGN XbQrshUzuSFbW8Mh1t0c/VhRe6HsevdkIKUxywp/jVWu04mO97qbXXOsi/lRC6p+ eOZZCa/kn9dEEd69Q65BHzsgK3Dz9X0/5EKfELgxIIuJtEt3OEC289F0XN/m2vsQ QlJknvixEek1gvnFq/Z8CPVHmmVq71fY1lOtfJDAlGaZRDAXlZ1FpUGjaw2g36FR jm1XKC2vrGfjxqrn/pz9CuYYYzDR5qPb6xD4ET39T0pDp4dTwFX/oTkTW4w/NBkW UUOkV0zcUL6AoqoKVoFCQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrheelgddufeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfgggtgfesth ekredtredtjeenucfhrhhomhepmfhrihhsthhofhhfvghrucfjrghughhssggrkhhkuceo tghouggvsehkhhgruhhgshgsrghkkhdrnhgrmhgvqeenucggtffrrghtthgvrhhnpeevgf elveeikeegjeeikeeuvefhleeiuddvleegfeekjedtkeevtdetgfffveettdenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegtohguvgeskhhhrg hughhssggrkhhkrdhnrghmvg X-ME-Proxy: Feedback-ID: i2671468f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 5 Mar 2024 15:31:04 -0500 (EST) From: Kristoffer Haugsbakk To: git@vger.kernel.org Cc: Kristoffer Haugsbakk , Junio C Hamano Subject: [PATCH v4 1/5] t3200: improve test style Date: Tue, 5 Mar 2024 21:29:39 +0100 Message-ID: X-Mailer: git-send-email 2.44.0.64.g52b67adbeb2 In-Reply-To: References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Commit-Hash: ad101c72a60295c6e008bccf9f5f56c4ca6fab75 X-Previous-Commits: e6a2628ce57668aa17101e73edaead0ef34d8a8c Some tests use a preliminary heredoc for `expect` or have setup and teardown commands before and after, respectively. It is however preferred to keep all the logic in the test itself. Let’s move these into the tests. Also: • Remove a now-irrelevant comment about test placement and switch back to `main` post-test • Prefer indented literal heredocs (`-\EOF`) except for a block which says that this is intentional Helped-by: Junio C Hamano Signed-off-by: Kristoffer Haugsbakk --- Notes (series): v4: • Drop `(setup)` change • Drop superflouos bullet point • Don’t use period to end bullet point t/t3200-branch.sh | 113 ++++++++++++++++++++++------------------------ 1 file changed, 55 insertions(+), 58 deletions(-) diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index de7d3014e4f..060b27097e8 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -75,13 +75,13 @@ test_expect_success 'git branch HEAD should fail' ' test_must_fail git branch HEAD ' -cat >expect <expect <<-EOF && + $HEAD refs/heads/d/e/f@{0}: branch: Created from main + EOF git reflog show --no-abbrev-commit refs/heads/d/e/f >actual && test_cmp expect actual ' @@ -440,10 +440,10 @@ test_expect_success 'git branch --list -v with --abbrev' ' test_expect_success 'git branch --column' ' COLUMNS=81 git branch --column=column >actual && - cat >expect <<\EOF && - a/b/c bam foo l * main n o/p r - abc bar j/k m/m mb o/o q topic -EOF + cat >expect <<-\EOF && + a/b/c bam foo l * main n o/p r + abc bar j/k m/m mb o/o q topic + EOF test_cmp expect actual ' @@ -453,25 +453,25 @@ test_expect_success 'git branch --column with an extremely long branch name' ' test_when_finished "git branch -d $long" && git branch $long && COLUMNS=80 git branch --column=column >actual && - cat >expect <expect <<-EOF && + a/b/c + abc + bam + bar + foo + j/k + l + m/m + * main + mb + n + o/o + o/p + q + r + topic + $long + EOF test_cmp expect actual ' @@ -481,10 +481,10 @@ test_expect_success 'git branch with column.*' ' COLUMNS=80 git branch >actual && git config --unset column.branch && git config --unset column.ui && - cat >expect <<\EOF && - a/b/c bam foo l * main n o/p r - abc bar j/k m/m mb o/o q topic -EOF + cat >expect <<-\EOF && + a/b/c bam foo l * main n o/p r + abc bar j/k m/m mb o/o q topic + EOF test_cmp expect actual ' @@ -496,39 +496,36 @@ test_expect_success 'git branch -v with column.ui ignored' ' git config column.ui column && COLUMNS=80 git branch -v | cut -c -8 | sed "s/ *$//" >actual && git config --unset column.ui && - cat >expect <<\EOF && - a/b/c - abc - bam - bar - foo - j/k - l - m/m -* main - mb - n - o/o - o/p - q - r - topic -EOF + cat >expect <<-\EOF && + a/b/c + abc + bam + bar + foo + j/k + l + m/m + * main + mb + n + o/o + o/p + q + r + topic + EOF test_cmp expect actual ' -mv .git/config .git/config-saved - test_expect_success DEFAULT_REPO_FORMAT 'git branch -m q q2 without config should succeed' ' + test_when_finished mv .git/config-saved .git/config && + mv .git/config .git/config-saved && git branch -m q q2 && git branch -m q2 q ' -mv .git/config-saved .git/config - -git config branch.s/s.dummy Hello - test_expect_success 'git branch -m s/s s should work when s/t is deleted' ' + git config branch.s/s.dummy Hello && git branch --create-reflog s/s && git reflog exists refs/heads/s/s && git branch --create-reflog s/t && @@ -1141,14 +1138,14 @@ test_expect_success '--set-upstream-to notices an error to set branch as own ups test_cmp expect actual " -# Keep this test last, as it changes the current branch -cat >expect <expect <<-EOF && + $HEAD refs/heads/g/h/i@{0}: branch: Created from main + EOF git reflog show --no-abbrev-commit refs/heads/g/h/i >actual && test_cmp expect actual ' From patchwork Tue Mar 5 20:29:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kristoffer Haugsbakk X-Patchwork-Id: 13582994 Received: from fout8-smtp.messagingengine.com (fout8-smtp.messagingengine.com [103.168.172.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D07913AEE for ; Tue, 5 Mar 2024 20:31:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.151 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709670669; cv=none; b=kIY8w5Iyvy98pJRv10Dh4NInU+pgeC36pzdnOsNbdYxx404IIZFCYI+pEJ8xvhJQoov6qzZ4WYDU+WhBptJrNqzz8LNAkZjBj55pwIvgUCuKLKNSjI8AYettGCl3lyqanJzQoY6s8FF492mBu6o687T7qe9BbLi2qg8R7oPjws0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709670669; c=relaxed/simple; bh=FfgfCI9WPjP5TBKurj/YNllHNEDfCnhMc1AJFjCNoas=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Ew9s0QYbmhL1HwdTdkLOBP66bTfAAYHwW06iXrdDBISdN0U48S2p4e+vPWWhj4EuADjb4sLMoAcHCT1Ik3McwiS/6VGGEHpy6huVtYhpa4WYwy8esDO3EMhHAMdo2VbhXvhaspHE6BVfGaprYWWC2gh9DzKdD1aUnjnCsDFZjog= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=khaugsbakk.name; spf=pass smtp.mailfrom=khaugsbakk.name; dkim=pass (2048-bit key) header.d=khaugsbakk.name header.i=@khaugsbakk.name header.b=ynvozkD3; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=d4YoigxZ; arc=none smtp.client-ip=103.168.172.151 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=khaugsbakk.name Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=khaugsbakk.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=khaugsbakk.name header.i=@khaugsbakk.name header.b="ynvozkD3"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="d4YoigxZ" Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfout.nyi.internal (Postfix) with ESMTP id 54C821380157; Tue, 5 Mar 2024 15:31:06 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 05 Mar 2024 15:31:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=khaugsbakk.name; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm3; t=1709670666; x=1709757066; bh=smTu+nKf9yy3eaePT/50ftaKWvg77rUX Wpb4w6osiZY=; b=ynvozkD3tuLhGJ3Tl4ocqk600uDgk9a/DAozB8xHxXwocJZy qEgRdaaO+/2/mchFnrgDnoGGjoREzedD1QnSfhtacUbutBIxOlwgWX5xvMLSI1/Q /cdhpOmBLOWbMImhrIVF1i5lFNGL9nVhvvIF/1vknefrhW1inA/0Re/hTmlT4D1I Uxip7Y/lnL9YD2cEC16xThjxL9M8Bw9aL/Y1J+u0FPyQkKlvPlU6L51qmBcp90da uyuiqctG3iEJ9euL1Mh3fn2ftmNrqA02XW54KkJyA/rgvgPs1D0JRrzXRqOrGZ9b +CM94QAJzJUBun6RpX4T6uEXGS28uJWF2kHnlw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1709670666; x= 1709757066; bh=smTu+nKf9yy3eaePT/50ftaKWvg77rUXWpb4w6osiZY=; b=d 4YoigxZGXDt97XVE4y9SdZWOcgBZgRk6oPDc9QoGPJ2mdqqTplW1j/bvdVJzELtF eHuBGZYySMDPAEbrMekwefEWpq6ElkYbJNvzUngAOwpugMFUE6aDwO3TRMebpgYz l/aRRNiJ0ucxvkZ4HL+79byr+eIVsoHxvRsokZM7Q4npD2+iX/CFsaHE1z36s75E eaDQwWmsHR3+uX0g1i5d5pkoFEXYXwuPbx7j8HH2ViaC+J69lFAEziY5vNtD4ldy YkA/ca30Y4zW9ZyiAJwq3QxerWqWam99FNzYOyYUXPgqWl422WKppbvyWm1SGkr3 2XzJRS4Yo2XhYDJF3xu2Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrheelgddufeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfgggtgfesth ekredtredtjeenucfhrhhomhepmfhrihhsthhofhhfvghrucfjrghughhssggrkhhkuceo tghouggvsehkhhgruhhgshgsrghkkhdrnhgrmhgvqeenucggtffrrghtthgvrhhnpeevgf elveeikeegjeeikeeuvefhleeiuddvleegfeekjedtkeevtdetgfffveettdenucevlhhu shhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpegtohguvgeskhhhrg hughhssggrkhhkrdhnrghmvg X-ME-Proxy: Feedback-ID: i2671468f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 5 Mar 2024 15:31:05 -0500 (EST) From: Kristoffer Haugsbakk To: git@vger.kernel.org Cc: Kristoffer Haugsbakk Subject: [PATCH v4 2/5] advice: make all entries stylistically consistent Date: Tue, 5 Mar 2024 21:29:40 +0100 Message-ID: <7017ff3fff773412e8c472d8e59a132b0e8faae7.1709670287.git.code@khaugsbakk.name> X-Mailer: git-send-email 2.44.0.64.g52b67adbeb2 In-Reply-To: References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Commit-Hash: 7017ff3fff773412e8c472d8e59a132b0e8faae7 X-Previous-Commits: d48b4719c275ef06da014b6d22983db9ae484db2 In general, rewrite entries to the following form: 1. Clause or sentence describing when the advice is shown 2. Optional “to ” clause which says what the advice is about (e.g. for resetNoRefresh: tell the user that they can use `--no-refresh`) Concretely: 1. Use “shown” instead of “advice shown” • “advice” is implied and a bit repetitive 2. Use “when” instead of “if” 3. Lead with “Shown when” and end the entry with the effect it has, where applicable 4. Use “the user” instead of “a user” or “you” 5. implicitIdentity: rewrite description in order to lead with *when* the advice is shown (see point (3)) 6. Prefer the present tense (with the exception of pushNonFFMatching) 7. waitingForEditor: give example of relevance in this new context 8. pushUpdateRejected: exception to the above principles Signed-off-by: Kristoffer Haugsbakk --- Notes (series): v4: • Drop trailer since this took on a life of its own • Drop uses of colons and semicolons in favor of a “to ” clause (mostly “to tell”) • Simplify some of the “effect clauses” by using “to tell” instead of verbs like “instruct” v3: • Comment: Maybe the style that we eventually agree on should be documented outside the commit log? Documentation/config/advice.txt | 82 ++++++++++++++++----------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/Documentation/config/advice.txt b/Documentation/config/advice.txt index c7ea70f2e2e..72cd9f9e9d9 100644 --- a/Documentation/config/advice.txt +++ b/Documentation/config/advice.txt @@ -6,23 +6,23 @@ advice.*:: + -- addEmbeddedRepo:: - Advice on what to do when you've accidentally added one + Shown when the user accidentally adds one git repo inside of another. addEmptyPathspec:: - Advice shown if a user runs the add command without providing + Shown when the user runs the add command without providing the pathspec parameter. addIgnoredFile:: - Advice shown if a user attempts to add an ignored file to + Shown when the user attempts to add an ignored file to the index. amWorkDir:: - Advice that shows the location of the patch file when - linkgit:git-am[1] fails to apply it. + Shown when linkgit:git-am[1] fails to apply a patch + file, to tell the user the location of the file. ambiguousFetchRefspec:: - Advice shown when a fetch refspec for multiple remotes maps to + Shown when a fetch refspec for multiple remotes maps to the same remote-tracking branch namespace and causes branch tracking set-up to fail. checkoutAmbiguousRemoteBranchName:: - Advice shown when the argument to + Shown when the argument to linkgit:git-checkout[1] and linkgit:git-switch[1] ambiguously resolves to a remote tracking branch on more than one remote in @@ -33,31 +33,31 @@ advice.*:: to be used by default in some situations where this advice would be printed. commitBeforeMerge:: - Advice shown when linkgit:git-merge[1] refuses to + Shown when linkgit:git-merge[1] refuses to merge to avoid overwriting local changes. detachedHead:: - Advice shown when you used + Shown when the user uses linkgit:git-switch[1] or linkgit:git-checkout[1] - to move to the detached HEAD state, to instruct how to - create a local branch after the fact. + to move to the detached HEAD state, to tell the user how + to create a local branch after the fact. diverging:: - Advice shown when a fast-forward is not possible. + Shown when a fast-forward is not possible. fetchShowForcedUpdates:: - Advice shown when linkgit:git-fetch[1] takes a long time + Shown when linkgit:git-fetch[1] takes a long time to calculate forced updates after ref updates, or to warn that the check is disabled. forceDeleteBranch:: - Advice shown when a user tries to delete a not fully merged + Shown when the user tries to delete a not fully merged branch without the force option set. ignoredHook:: - Advice shown if a hook is ignored because the hook is not + Shown when a hook is ignored because the hook is not set as executable. implicitIdentity:: - Advice on how to set your identity configuration when - your information is guessed from the system username and - domain name. + Shown when the user's information is guessed from the + system username and domain name, to tell the user how to + set their identity configuration. nestedTag:: - Advice shown if a user attempts to recursively tag a tag object. + Shown when a user attempts to recursively tag a tag object. pushAlreadyExists:: Shown when linkgit:git-push[1] rejects an update that does not qualify for fast-forwarding (e.g., a tag.) @@ -71,12 +71,12 @@ advice.*:: object that is not a commit-ish, or make the remote ref point at an object that is not a commit-ish. pushNonFFCurrent:: - Advice shown when linkgit:git-push[1] fails due to a + Shown when linkgit:git-push[1] fails due to a non-fast-forward update to the current branch. pushNonFFMatching:: - Advice shown when you ran linkgit:git-push[1] and pushed - 'matching refs' explicitly (i.e. you used ':', or - specified a refspec that isn't your current branch) and + Shown when the user ran linkgit:git-push[1] and pushed + 'matching refs' explicitly (i.e. used ':', or + specified a refspec that isn't the current branch) and it resulted in a non-fast-forward error. pushRefNeedsUpdate:: Shown when linkgit:git-push[1] rejects a forced update of @@ -95,17 +95,17 @@ advice.*:: 'pushFetchFirst', 'pushNeedsForce', and 'pushRefNeedsUpdate' simultaneously. resetNoRefresh:: - Advice to consider using the `--no-refresh` option to - linkgit:git-reset[1] when the command takes more than 2 seconds - to refresh the index after reset. + Shown when linkgit:git-reset[1] takes more than 2 + seconds to refresh the index after reset, to tell the user + that they can use the `--no-refresh` option. resolveConflict:: - Advice shown by various commands when conflicts + Shown by various commands when conflicts prevent the operation from being performed. rmHints:: - In case of failure in the output of linkgit:git-rm[1], - show directions on how to proceed from the current state. + Shown on failure in the output of linkgit:git-rm[1], to + give directions on how to proceed from the current state. sequencerInUse:: - Advice shown when a sequencer command is already in progress. + Shown when a sequencer command is already in progress. skippedCherryPicks:: Shown when linkgit:git-rebase[1] skips a commit that has already been cherry-picked onto the upstream branch. @@ -123,27 +123,27 @@ advice.*:: by linkgit:git-switch[1] or linkgit:git-checkout[1] when switching branches. statusUoption:: - Advise to consider using the `-u` option to linkgit:git-status[1] - when the command takes more than 2 seconds to enumerate untracked - files. + Shown when linkgit:git-status[1] takes more than 2 + seconds to enumerate untracked files, to tell the user that + they can use the `-u` option. submoduleAlternateErrorStrategyDie:: - Advice shown when a submodule.alternateErrorStrategy option + Shown when a submodule.alternateErrorStrategy option configured to "die" causes a fatal error. submodulesNotUpdated:: - Advice shown when a user runs a submodule command that fails + Shown when a user runs a submodule command that fails because `git submodule update --init` was not run. suggestDetachingHead:: - Advice shown when linkgit:git-switch[1] refuses to detach HEAD + Shown when linkgit:git-switch[1] refuses to detach HEAD without the explicit `--detach` option. updateSparsePath:: - Advice shown when either linkgit:git-add[1] or linkgit:git-rm[1] + Shown when either linkgit:git-add[1] or linkgit:git-rm[1] is asked to update index entries outside the current sparse checkout. waitingForEditor:: - Print a message to the terminal whenever Git is waiting for - editor input from the user. + Shown when Git is waiting for editor input. Relevant + when e.g. the editor is not launched inside the terminal. worktreeAddOrphan:: - Advice shown when a user tries to create a worktree from an - invalid reference, to instruct how to create a new unborn + Shown when the user tries to create a worktree from an + invalid reference, to tell the user how to create a new unborn branch instead. -- From patchwork Tue Mar 5 20:29:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kristoffer Haugsbakk X-Patchwork-Id: 13582995 Received: from fhigh2-smtp.messagingengine.com (fhigh2-smtp.messagingengine.com [103.168.172.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7247E129A99 for ; Tue, 5 Mar 2024 20:31:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.153 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709670670; cv=none; b=J0LD1URU0tY/q0WXOpvDe+EhfrMWIQkFMmzoilEIxPyodEJY1D3bANA3j2IPKRkUrrZDbxbpeInNBhTug+A7R2BklQYXmcsRPmfDIdogmeAsZskWc3uNG6Plepli5ztKDmEGU4HcPV/wSRr9dVocl7ZmLaOwUC+Ie5TRSXLQt+s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709670670; c=relaxed/simple; bh=Yx2YipxWX7fBtKj+buRu38MfIXhKfyLrF2/hCMIgVa4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TvdAeFZ/3Nkstg80BwTJneggQf/7Mpv4MuvAF7M8CvQfbasAxliz2Rc/k4OhINzSwRIKEVuNRwthRt4QBBYOt84WUjpkWl55Ny6xD4WmCpWqLNxhKRXwyAwkjQEOmUilA+WkUWz64/rMDBMsvCtT7Jlh8oI79fGyt2lKwmBxtjA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=khaugsbakk.name; spf=pass smtp.mailfrom=khaugsbakk.name; dkim=pass (2048-bit key) header.d=khaugsbakk.name header.i=@khaugsbakk.name header.b=ZGgAn98T; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=ropEc/Bq; arc=none smtp.client-ip=103.168.172.153 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=khaugsbakk.name Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=khaugsbakk.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=khaugsbakk.name header.i=@khaugsbakk.name header.b="ZGgAn98T"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="ropEc/Bq" Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 9D75311400C8; Tue, 5 Mar 2024 15:31:07 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 05 Mar 2024 15:31:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=khaugsbakk.name; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm3; t=1709670667; x=1709757067; bh=82xlosMH+pVTC04ksJ0OIv+RlFeWutP/ lEcRRauy9Cw=; b=ZGgAn98TGth7r/ji68je0BIEk0AJM46TFB5U3azbXGYlzP5N lDxmji0nx/1A8qpXuEp3cLtuTZ/2T/KTRiRolU3PTYoSv7qxvJPtjxSaUC73BjOF BMvUzoVdMxpRgn6niln1lpq8BCOBj25GiHHRwFnTOdqpdO/OLS+RKetX2sL1sOm5 H+FwFPZeIPieBeH0Mjxc7SdnjpLm3x3+4pSaWU4FH+R62C3WpnWxoJCrhNLrLlKV bw/sYB3oJCaEmB/uDk9fpN8Ewsb49YzOxcuXGoKyOgWkSlpTXKzpqYLEUKqBWnuq l2wjPjTxNX6DA4Ftc1t5Pmoj2TgVIXUUR5Qd0A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1709670667; x= 1709757067; bh=82xlosMH+pVTC04ksJ0OIv+RlFeWutP/lEcRRauy9Cw=; b=r opEc/BqHZ4tOOIP1qru4s/AE/PsnRyAVRPrWptuZpAIpwPgBDaatoCKykEDG2G+y l6LISFnz8Dh+nvk5E7I5RIV8kREq8NUZlI0/V6tHmOXJUWwvhkWWugE0l0WBUBX6 a4D48wVyAcLQ22bT2mE5YgIQxest5lFdZGJABaJ2qMHjp8PjDYGhGIXK4/Wz6qcQ 6Z2moMkiphlXD6PPkJYFakhNU20fb6EiF+ZKa3B8G47eiIiQhIPiy4hyf0R3tUsD cSAcjyDSOclSPZnauY/40v4NrW/TjnQw82wOjq5v40k4kjZpIKSdmnBHoC4FIhHo OH1gQNXlqUeU11uhGUZjw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrheelgddufeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfgggtgfesth ekredtredtjeenucfhrhhomhepmfhrihhsthhofhhfvghrucfjrghughhssggrkhhkuceo tghouggvsehkhhgruhhgshgsrghkkhdrnhgrmhgvqeenucggtffrrghtthgvrhhnpeevgf elveeikeegjeeikeeuvefhleeiuddvleegfeekjedtkeevtdetgfffveettdenucevlhhu shhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpegtohguvgeskhhhrg hughhssggrkhhkrdhnrghmvg X-ME-Proxy: Feedback-ID: i2671468f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 5 Mar 2024 15:31:06 -0500 (EST) From: Kristoffer Haugsbakk To: git@vger.kernel.org Cc: Kristoffer Haugsbakk Subject: [PATCH v4 3/5] advice: use backticks for verbatim Date: Tue, 5 Mar 2024 21:29:41 +0100 Message-ID: X-Mailer: git-send-email 2.44.0.64.g52b67adbeb2 In-Reply-To: References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Commit-Hash: df9b872afd16257acc935180dc27b105e17d6e16 X-Previous-Commits: 30d662a04c75b80166db9ef94f95e8a841994fb5 Use backticks for inline-verbatim rather than single quotes. Also quote the unquoted ref globs. Also replace “the add command” with “`git add`”. Signed-off-by: Kristoffer Haugsbakk --- Notes (series): v4: • Also quote ref globs Documentation/config/advice.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Documentation/config/advice.txt b/Documentation/config/advice.txt index 72cd9f9e9d9..c8d6c625f2a 100644 --- a/Documentation/config/advice.txt +++ b/Documentation/config/advice.txt @@ -2,14 +2,14 @@ advice.*:: These variables control various optional help messages designed to aid new users. When left unconfigured, Git will give the message alongside instructions on how to squelch it. You can tell Git - that you do not need the help message by setting these to 'false': + that you do not need the help message by setting these to `false`: + -- addEmbeddedRepo:: Shown when the user accidentally adds one git repo inside of another. addEmptyPathspec:: - Shown when the user runs the add command without providing + Shown when the user runs `git add` without providing the pathspec parameter. addIgnoredFile:: Shown when the user attempts to add an ignored file to @@ -75,7 +75,7 @@ advice.*:: non-fast-forward update to the current branch. pushNonFFMatching:: Shown when the user ran linkgit:git-push[1] and pushed - 'matching refs' explicitly (i.e. used ':', or + 'matching refs' explicitly (i.e. used `:`, or specified a refspec that isn't the current branch) and it resulted in a non-fast-forward error. pushRefNeedsUpdate:: @@ -87,12 +87,12 @@ advice.*:: guess based on the source and destination refs what remote ref namespace the source belongs in, but where we can still suggest that the user push to either - refs/heads/* or refs/tags/* based on the type of the + `refs/heads/*` or `refs/tags/*` based on the type of the source object. pushUpdateRejected:: - Set this variable to 'false' if you want to disable - 'pushNonFFCurrent', 'pushNonFFMatching', 'pushAlreadyExists', - 'pushFetchFirst', 'pushNeedsForce', and 'pushRefNeedsUpdate' + Set this variable to `false` if you want to disable + `pushNonFFCurrent`, `pushNonFFMatching`, `pushAlreadyExists`, + `pushFetchFirst`, `pushNeedsForce`, and `pushRefNeedsUpdate` simultaneously. resetNoRefresh:: Shown when linkgit:git-reset[1] takes more than 2 From patchwork Tue Mar 5 20:29:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kristoffer Haugsbakk X-Patchwork-Id: 13582996 Received: from fhigh2-smtp.messagingengine.com (fhigh2-smtp.messagingengine.com [103.168.172.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0EFE12AAE7 for ; Tue, 5 Mar 2024 20:31:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.153 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709670671; cv=none; b=p1s3n01Jf+cr4j/xs3PqxUg/nGdSYtidRQJCkMShm8QEhtEWPWZtiLq1XFkUooLB6ojibOn5MExh/eXS/nTk2rK796SeXbUdGcVFINFotoEU7rYT6fDhoCjtEp9ppqW+teRLDqYRa8le0BAP/Fv88RQV5d0rGWCtuztrzTp77n0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709670671; c=relaxed/simple; bh=OPuHY3s8S3g7HkDyC8ZNshvcrAeKJBfiuK1kJ4+7vSA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=V0yotBUi6H//EdmHQdqqgc/vecq73nELW6hU8mJG3ntLpVtvxY/Yps24IzB5HQMIzWASP6Qm45kxhwFo7j/pKqcNnugUzmbvnn2rUQ5TWBCCYhI4xXLCd4CF4Ke/YBUxxgGbFv8oba8ZvBeRWWZhQveCPaSSPu1Zn2peuxaqFOA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=khaugsbakk.name; spf=pass smtp.mailfrom=khaugsbakk.name; dkim=pass (2048-bit key) header.d=khaugsbakk.name header.i=@khaugsbakk.name header.b=Sr47Re5r; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=ZQqwjA+J; arc=none smtp.client-ip=103.168.172.153 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=khaugsbakk.name Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=khaugsbakk.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=khaugsbakk.name header.i=@khaugsbakk.name header.b="Sr47Re5r"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="ZQqwjA+J" Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfhigh.nyi.internal (Postfix) with ESMTP id B629811401BA; Tue, 5 Mar 2024 15:31:08 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Tue, 05 Mar 2024 15:31:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=khaugsbakk.name; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm3; t=1709670668; x=1709757068; bh=1M6zcF2NpvZ2AC1gD4/ZT/EA5A/b/k9S IfK3liD0N+4=; b=Sr47Re5rsURbWJrkBjdCOmv/ugLwzJB3uB4HahsBNWEV34G6 63yD3zNdQSHBI6ULgPLqSgxOLdaEzzlrnwayvk26lCgfi9ZgTLbDYpQWHRfsDYv0 LFUNWNVhAUFLAQlVysCvO8lrN9KN7gj8/ArXPbBF84ct7oGigZt1Rt/376ljzDEz E9yZXIr0SEbL7uz++aKMamwK+bm/N2bv9tmzZzqw4UK/NshrlZWKXkb1ZrQd53o8 x8l8EtoD4m42llcOOpIH/QV+IiIL92QmlfJoh8eJu7fTanN28r/XnEdg92bPDhyd GfUfFXPtm6QiszWknESGp8KeHdOle8JABMlamw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1709670668; x= 1709757068; bh=1M6zcF2NpvZ2AC1gD4/ZT/EA5A/b/k9SIfK3liD0N+4=; b=Z QqwjA+J23s2rrSkqXehh7WWFzgapTCrmsVm6ugA1TG2vCs6bFSVP0HTDRoVQl9jn XIxR6jvXG7XhxVRnXjyOc0GrSwwgvGCvtQz0cks0rW1LvVbPXwI/BZP90CmxWyiK EXu/SZ1F4WsmjmR/rUS1Zoh6rTcWmMkLMSpvkl7Rpzjd1rSuivbzdCWtvrF4iDIb 8wSDJdmOzGfER/m8lI9SWAHOjK1LzYPKdu/cUvtnsQatSe29p9TV7J0m+Tf12MzW jz5s8e6rPo7eFqYQWtgXjtWMiAIjNlb6DFTL8Gan84/d+uNInE/XGf5TD70QjXM3 Xc7fZoC/HiBCQNsL7YT5g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrheelgddufeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfgggtgfesth ekredtredtjeenucfhrhhomhepmfhrihhsthhofhhfvghrucfjrghughhssggrkhhkuceo tghouggvsehkhhgruhhgshgsrghkkhdrnhgrmhgvqeenucggtffrrghtthgvrhhnpeevgf elveeikeegjeeikeeuvefhleeiuddvleegfeekjedtkeevtdetgfffveettdenucevlhhu shhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpegtohguvgeskhhhrg hughhssggrkhhkrdhnrghmvg X-ME-Proxy: Feedback-ID: i2671468f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 5 Mar 2024 15:31:07 -0500 (EST) From: Kristoffer Haugsbakk To: git@vger.kernel.org Cc: Kristoffer Haugsbakk Subject: [PATCH v4 4/5] advice: use double quotes for regular quoting Date: Tue, 5 Mar 2024 21:29:42 +0100 Message-ID: <15594b2a3a89203461c3791fdbe8816945f86740.1709670287.git.code@khaugsbakk.name> X-Mailer: git-send-email 2.44.0.64.g52b67adbeb2 In-Reply-To: References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Commit-Hash: 15594b2a3a89203461c3791fdbe8816945f86740 X-Previous-Commits: 3028713357ff77f33c1f96b05b566279683808ac Use double quotes like we use for “die” in this document. Signed-off-by: Kristoffer Haugsbakk --- Documentation/config/advice.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/config/advice.txt b/Documentation/config/advice.txt index c8d6c625f2a..dd52041bc94 100644 --- a/Documentation/config/advice.txt +++ b/Documentation/config/advice.txt @@ -75,7 +75,7 @@ advice.*:: non-fast-forward update to the current branch. pushNonFFMatching:: Shown when the user ran linkgit:git-push[1] and pushed - 'matching refs' explicitly (i.e. used `:`, or + "matching refs" explicitly (i.e. used `:`, or specified a refspec that isn't the current branch) and it resulted in a non-fast-forward error. pushRefNeedsUpdate:: From patchwork Tue Mar 5 20:29:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kristoffer Haugsbakk X-Patchwork-Id: 13582997 Received: from fhigh2-smtp.messagingengine.com (fhigh2-smtp.messagingengine.com [103.168.172.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 964AF12BE98 for ; Tue, 5 Mar 2024 20:31:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.153 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709670673; cv=none; b=uICzfrCYT4dUcWOctBX5AAhvGxud0qx129mqGbego2Ue4MxKvi+Hvq4e/XZWRJx68Tac6DFFIyKUMR9/Fx0paXLjCU+EsbdybwILAWmdKPgLc7BV/WLu9seEaoeh/6y5o9yF6GwgdyO3gygcZxSsUfG3djnZTRKBekR2H99TLDE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709670673; c=relaxed/simple; bh=CAu2Cznz8dj54jHCkSOS5VkPWVqfpjEDPFniAcMcTOc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tKYqpog7871kk/fhtrJyxS337TO98dFAx1xJbNhLTl83gjRsR9AVNX41rZP2hjo6Vr10f5a22DbkkYA0OAi3sKxKE2t/1ORC7r2i75oG4G4YxyPEhGOeiMaPBhpwVfhbY5f/CF2jkfFayxg+51G9tPcyyhmFtyelS+6g4h62Has= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=khaugsbakk.name; spf=pass smtp.mailfrom=khaugsbakk.name; dkim=pass (2048-bit key) header.d=khaugsbakk.name header.i=@khaugsbakk.name header.b=01wC+cSJ; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=AW0mSPmZ; arc=none smtp.client-ip=103.168.172.153 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=khaugsbakk.name Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=khaugsbakk.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=khaugsbakk.name header.i=@khaugsbakk.name header.b="01wC+cSJ"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="AW0mSPmZ" Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 23E4F11401B3; Tue, 5 Mar 2024 15:31:10 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 05 Mar 2024 15:31:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=khaugsbakk.name; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm3; t=1709670670; x=1709757070; bh=E4kE6309FcVAHRwre8io7X/pNfglQE+5 qkNyheEtu/I=; b=01wC+cSJwKK0n6Y9te/fGY7uhWtCUhqU6zAraTvUJAfaAawZ ezf6g8xaiWaFAp/9kYmu9j3E3Xgzkt6hE5RE+PIF2I9eJ7n5/sd/kWYbjWFa7heh ebCvnWat0HWKhp0//g40J205APrO+TR4yhqzXg8bGJi0FbOaK8I5zS283k6tEf7y K4m/Le1eJ9/8oFicRMij42bMge6S6iv1i3ASdTv145QxZVF1Qc+V+mFSju+LN0aS 39OeNfulpHGBDkcBBbIFy7sJ1hv+pWE1Dv6IurGqaL1UsLcIPhgzHAE9idNgRHrl bEz9+1gGPlAYWOFU23V6rKk5W840GhELJ1t3LA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1709670670; x= 1709757070; bh=E4kE6309FcVAHRwre8io7X/pNfglQE+5qkNyheEtu/I=; b=A W0mSPmZ2jmY+/+WfSPvgrsWh0w+JkawVOb7fNftfEye3YLdTVhnsDtrgZhkAqfGq 3BhBQBJ2WHNowe3HN8+Jyt6vdP2Pm/dYv+wKmh0ie4F0WD3DPE1lZgUfVMhmI1GM rJQHCWSAOR1b3Az93v+s2YwC63KzsFEm0SrDriloVwO3nMgdgGxreYUYZ0StY4kE kmIacLxABT28nhmsUZdVjIUAmd8Q3qF4CWCI0U9HAKS1m69/zLNRH5wl4GaDZvIW a1JlFxvMhYfKxu+Woo2hBvvIic0NWXf0BjKJ4dIS46yo5t5Rsh/NRZjSPvyBccNx H74RgmRU/swLcKrQVevRQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrheelgddufeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfgggtgfesth ekredtredtjeenucfhrhhomhepmfhrihhsthhofhhfvghrucfjrghughhssggrkhhkuceo tghouggvsehkhhgruhhgshgsrghkkhdrnhgrmhgvqeenucggtffrrghtthgvrhhnpeevgf elveeikeegjeeikeeuvefhleeiuddvleegfeekjedtkeevtdetgfffveettdenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegtohguvgeskhhhrg hughhssggrkhhkrdhnrghmvg X-ME-Proxy: Feedback-ID: i2671468f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 5 Mar 2024 15:31:08 -0500 (EST) From: Kristoffer Haugsbakk To: git@vger.kernel.org Cc: Kristoffer Haugsbakk Subject: [PATCH v4 5/5] branch: advise about ref syntax rules Date: Tue, 5 Mar 2024 21:29:43 +0100 Message-ID: <97b53c04894578b23d0c650f69885f734699afc7.1709670287.git.code@khaugsbakk.name> X-Mailer: git-send-email 2.44.0.64.g52b67adbeb2 In-Reply-To: References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Commit-Hash: 97b53c04894578b23d0c650f69885f734699afc7 X-Previous-Commits: 4ad5d4190649dcb5f26c73a6f15ab731891b9dfd d275d1d179b90592ddd7b5da2ae4573b3f7a37b7 402b7937951073466bf4527caffd38175391c7da git-branch(1) will error out if you give it a bad ref name. But the user might not understand why or what part of the name is illegal. The user might know that there are some limitations based on the *loose ref* format (filenames), but there are also further rules for easier integration with shell-based tools, pathname expansion, and playing well with reference name expressions. The man page for git-check-ref-format(1) contains these rules. Let’s advise about it since that is not a command that you just happen upon. Also make this advise configurable since you might not want to be reminded every time you make a little typo. Signed-off-by: Kristoffer Haugsbakk --- Notes (series): v4: • Update refSyntax entry for consistency with the rest of the entries 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)` • Flesh out commit message a bit Documentation/config/advice.txt | 3 +++ advice.c | 1 + advice.h | 1 + branch.c | 8 ++++++-- builtin/branch.c | 8 ++++++-- t/t3200-branch.sh | 10 ++++++++++ 6 files changed, 27 insertions(+), 4 deletions(-) diff --git a/Documentation/config/advice.txt b/Documentation/config/advice.txt index dd52041bc94..06c754899c5 100644 --- a/Documentation/config/advice.txt +++ b/Documentation/config/advice.txt @@ -94,6 +94,9 @@ advice.*:: `pushNonFFCurrent`, `pushNonFFMatching`, `pushAlreadyExists`, `pushFetchFirst`, `pushNeedsForce`, and `pushRefNeedsUpdate` simultaneously. + refSyntax:: + Shown when the user provides an illegal ref name, to + tell the user about the ref syntax documentation. resetNoRefresh:: Shown when linkgit:git-reset[1] takes more than 2 seconds to refresh the index after reset, to tell the user diff --git a/advice.c b/advice.c index 6e9098ff089..550c2968908 100644 --- a/advice.c +++ b/advice.c @@ -68,6 +68,7 @@ static struct { [ADVICE_PUSH_UNQUALIFIED_REF_NAME] = { "pushUnqualifiedRefName" }, [ADVICE_PUSH_UPDATE_REJECTED] = { "pushUpdateRejected" }, [ADVICE_PUSH_UPDATE_REJECTED_ALIAS] = { "pushNonFastForward" }, /* backwards compatibility */ + [ADVICE_REF_SYNTAX] = { "refSyntax" }, [ADVICE_RESET_NO_REFRESH_WARNING] = { "resetNoRefresh" }, [ADVICE_RESOLVE_CONFLICT] = { "resolveConflict" }, [ADVICE_RM_HINTS] = { "rmHints" }, diff --git a/advice.h b/advice.h index 9d4f49ae38b..d15fe2351ab 100644 --- a/advice.h +++ b/advice.h @@ -36,6 +36,7 @@ enum advice_type { ADVICE_PUSH_UNQUALIFIED_REF_NAME, ADVICE_PUSH_UPDATE_REJECTED, ADVICE_PUSH_UPDATE_REJECTED_ALIAS, + ADVICE_REF_SYNTAX, ADVICE_RESET_NO_REFRESH_WARNING, ADVICE_RESOLVE_CONFLICT, ADVICE_RM_HINTS, diff --git a/branch.c b/branch.c index 6719a181bd1..621019fcf4b 100644 --- a/branch.c +++ b/branch.c @@ -370,8 +370,12 @@ int read_branch_desc(struct strbuf *buf, const char *branch_name) */ int validate_branchname(const char *name, struct strbuf *ref) { - if (strbuf_check_branch_ref(ref, name)) - die(_("'%s' is not a valid branch name"), name); + if (strbuf_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`")); + exit(code); + } return ref_exists(ref->buf); } diff --git a/builtin/branch.c b/builtin/branch.c index cfb63cce5fb..1c122ee8a7b 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -576,8 +576,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++) { diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index 060b27097e8..dd7525d1b8c 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -1722,4 +1722,14 @@ test_expect_success '--track overrides branch.autoSetupMerge' ' test_cmp_config "" --default "" branch.foo5.merge ' +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 +' + test_done