From patchwork Mon Mar 4 22:07:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kristoffer Haugsbakk X-Patchwork-Id: 13581301 Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (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 7AA487C0B0 for ; Mon, 4 Mar 2024 22:08:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.111.4.26 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709590112; cv=none; b=Aib0rAol64W5WC3Ss4XkMA6ZrTagkDtFEkB+PO7BTZangSf66oNSQ+RzgnvkrowPF4OyZFr7I9kjS7tS4mSXLe2P0Wyq7+08HKrY88fHZbo6W2kNC0FZTTDXkd2GhdW96IVsafYSq4IQ/PgClsEo4VArUC/WhZzDDCbmvqg6dqE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709590112; c=relaxed/simple; bh=wzPw/I6sGyRC+OMyPtxLXx0NCWSg6ZQzYJY3enUxDs4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pdbVCg55eKlWQNXg1TLv487rjkZ0fQesGVVdoK50xKhI2Ec3T7Uuf67if/jovFoxJbtPRJtYTQPyUXBl2gqrIRRzmwDGx+ykIZRXqum5BvDmlQRO5AtvTOVsGnQcoLm7jmkqlAu0Gr5LaReWC0bBS1gNf7lWbD200PnwEeuRaYs= 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=OpSLdezo; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=gnQEeEi/; arc=none smtp.client-ip=66.111.4.26 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="OpSLdezo"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="gnQEeEi/" Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 6746F5C008B; Mon, 4 Mar 2024 17:08:29 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Mon, 04 Mar 2024 17:08:29 -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=1709590109; x=1709676509; bh=y5ycGiW57wBjFT056vXcMZJ7xbNUMqXU VTzE40JYqxY=; b=OpSLdezotcUU//7P158H7rCZWxvMX59Y6zCn60cdulpZtz4h Kdm7oB1wKkeHuWrX3L0u041i7KXusIA0KaDLi7kPmIhQf3pGrDoZ/FeL9xRy0qfJ qP9BE28CbJGXlqM86M8VZ3Fv7oQD0muaRJr4FI6thxlSm519e9IUyPJImYXtBGXJ AIW2dZ3VCQECOUqtDe1K8p2/o3PHFsXzejlOS3g4gX/eJB7nXvdcdNiLQSy2YHyt KqS5BocWQJ9C0L9dvFyb0ABSP3C/gTkd9WqDrIMMhpiGNOHSb45Cb4OUFCm5T1Ja aXrECZn7ufkfqAsfoAP+Ba1lfwCXPj30nNFRvw== 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=1709590109; x= 1709676509; bh=y5ycGiW57wBjFT056vXcMZJ7xbNUMqXUVTzE40JYqxY=; b=g nQEeEi/FftAtiiTiI2Pt7RZil8PJK3D2wzifuoOFBDOCwc81ZKD+G78cDMzPMEg2 BXYDqkQid3tv+wyoxOr8tYxsAWJpbnBaEmd+wxqZXf4112nrrIfD7yD+hteMZZmS KLkic6ZHoI7gcHj9Wml9QBFkuiMCLxSxsgZNSvYiobeom8VWTApYZNt1KcI6dejZ wJipI4C9RdDI8B7y90NkC8pgIo5eQ5Ru6zqZPF/Co77vzLoDE+o4adgqM27jLHn/ kDVLO8yewpPwWyW7ypgQZc/icJWqIRW2fyyy4YhfUWjCkzkjHvXUg2/K26ENQboj ibHNQS6T5R62bb9b58k6A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrheejgdduheehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfgggtgfesth ekredtredtjeenucfhrhhomhepmfhrihhsthhofhhfvghrucfjrghughhssggrkhhkuceo tghouggvsehkhhgruhhgshgsrghkkhdrnhgrmhgvqeenucggtffrrghtthgvrhhnpeevgf elveeikeegjeeikeeuvefhleeiuddvleegfeekjedtkeevtdetgfffveettdenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegtohguvgeskhhhrg hughhssggrkhhkrdhnrghmvg X-ME-Proxy: Feedback-ID: i2671468f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 4 Mar 2024 17:08:28 -0500 (EST) From: Kristoffer Haugsbakk To: git@vger.kernel.org Cc: Kristoffer Haugsbakk , Junio C Hamano Subject: [PATCH v3 1/5] t3200: improve test style Date: Mon, 4 Mar 2024 23:07:26 +0100 Message-ID: X-Mailer: git-send-email 2.44.0.64.g52b67adbeb2 In-Reply-To: References: <4ad5d4190649dcb5f26c73a6f15ab731891b9dfd.1709491818.git.code@khaugsbakk.name> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Commit-Hash: 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 • Move a `git config` command into the test and mark it as `setup` since the next test depends on it Helped-by: Junio C Hamano Signed-off-by: Kristoffer Haugsbakk --- t/t3200-branch.sh | 115 ++++++++++++++++++++++------------------------ 1 file changed, 56 insertions(+), 59 deletions(-) diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index de7d3014e4f..273a57a72d8 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' ' +test_expect_success '(setup) 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 Mon Mar 4 22:07:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kristoffer Haugsbakk X-Patchwork-Id: 13581302 Received: from fout2-smtp.messagingengine.com (fout2-smtp.messagingengine.com [103.168.172.145]) (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 0A2847CF1F for ; Mon, 4 Mar 2024 22:08:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.145 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709590114; cv=none; b=Psrj/gnn8YMTsBonVtwOjregC51DGUMREAlldHRhKxiD0e02EXjS+O8UvhVawkRWxTVQWPZ2dpH1tYIEOGVy/TJu3F40EVO+XWs+cCEsA3aVAwXvJJAAgxSdt56yC17+cGY5WgxTFI15UYGYVA80loj/np2r2pkgvtpdj6Y5nbI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709590114; c=relaxed/simple; bh=YRvOwAZ2ttdsEoS3wi4Ds1ch9PxQWz5LT07Ui6DkUUo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sWPfrVY7A1Q0+TuY5X39yYKR25BAndRmm1NGe7t1YixzYMHOwe3fo/w0Kkcka19RKBvnMHg5tvr6Qud5Fe9lYyzupEWi1WtVA/6xA2AUVYrQ6JLJxt/9gcb1BZQDX1ThlolzhqBsk3CoKB6U9ITQnkrTjxADjqF4z/0WjPdz820= 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=QJhgxLV6; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=CfwcmZHE; arc=none smtp.client-ip=103.168.172.145 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="QJhgxLV6"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="CfwcmZHE" Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfout.nyi.internal (Postfix) with ESMTP id 01D7613800DB; Mon, 4 Mar 2024 17:08:31 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 04 Mar 2024 17:08:31 -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=1709590110; x=1709676510; bh=N5U5Gldpudyii+FiklxfsUqBOnEVbbyi 5H+udzI0X3Y=; b=QJhgxLV6yU4AgQdCRu6E8qf1RTWX6iEVvq4xNt+NKB25Flmg oB3kzdWXf6H/6UN+mHdfNLjRYlqjnZqsuR8qcEWQCLwlk1v4VDuC8iBI0K0kmk5r gkiQgJii3OE6B/N46DFEIiDeanSj02vkenuNaMhQPcdNGJjZmVsAYfQalnOwgIOu k+cuV+HpAzHqj5ccLkadiA2bxy4gw0v+/z7oGudTnqBU4O07H9Wsu9ZnDQhksVRX rU+sg0Lq+eNJcs/IC4HxhXd6MlMeXqWq4Xnat5OmXj2qJX29GZf90a8xZIB6dnfr lHSQMEG1OjIuSaKIF+HzmmXjEBBlq7mPUAw1lg== 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=1709590110; x= 1709676510; bh=N5U5Gldpudyii+FiklxfsUqBOnEVbbyi5H+udzI0X3Y=; b=C fwcmZHEtxFr2x0jrMAas3bWWe6DxDOXcLXGLXFDxaBaJzuPFoBlo8qDFZHmkMXhQ Zss5SXh43F4cnlmyT1tRc8KvhPjaUD3JOF8eUnfaUgQU1p3TMdtO0NuUszuRdOp/ Ovp0GugQKWBmklWkS09MMWCL86CB1myDHW2YWH8b9AbHZNssj88F+7P67S+2FtGu lTjaEHW9nVIFDt0f8hgQ3Qeewt0v1vRqB+nBRUkLapNVc9l+0flUCczYEfQAq31j 20Ryb5GoJlu11LtJXl+XQPOo4ITKwnJupUde81ZtrUqDNPW+EfIE8G9phbYVBxzP CSvX5Ces03mdFBu1c06XA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrheejgdduheehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfgggtgfesth ekredtredtjeenucfhrhhomhepmfhrihhsthhofhhfvghrucfjrghughhssggrkhhkuceo tghouggvsehkhhgruhhgshgsrghkkhdrnhgrmhgvqeenucggtffrrghtthgvrhhnpeevgf elveeikeegjeeikeeuvefhleeiuddvleegfeekjedtkeevtdetgfffveettdenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegtohguvgeskhhhrg hughhssggrkhhkrdhnrghmvg X-ME-Proxy: Feedback-ID: i2671468f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 4 Mar 2024 17:08:29 -0500 (EST) From: Kristoffer Haugsbakk To: git@vger.kernel.org Cc: Kristoffer Haugsbakk , Junio C Hamano Subject: [PATCH v3 2/5] advice: make all entries stylistically consistent Date: Mon, 4 Mar 2024 23:07:27 +0100 Message-ID: X-Mailer: git-send-email 2.44.0.64.g52b67adbeb2 In-Reply-To: References: <4ad5d4190649dcb5f26c73a6f15ab731891b9dfd.1709491818.git.code@khaugsbakk.name> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Commit-Hash: d48b4719c275ef06da014b6d22983db9ae484db2 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. detachedHead: connect clause with a semicolon to make the sentence flow better in this new context 6. implicitIdentity: rewrite description in order to lead with *when* the advice is shown (see point (3)) 7. Prefer the present tense (with the exception of pushNonFFMatching) 8. Use a colon to connect the last clause instead of a comma 9. waitingForEditor: give example of relevance in this new context 10. pushUpdateRejected: exception to the above principles Suggested-by: Junio C Hamano Signed-off-by: Kristoffer Haugsbakk --- Notes (series): Maybe the style that we eventually agree on should be documented outside the commit log? Documentation/config/advice.txt | 80 ++++++++++++++++----------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/Documentation/config/advice.txt b/Documentation/config/advice.txt index c7ea70f2e2e..cfca87a6aa2 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: tell 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 + to move to the detached HEAD state; instruct 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: 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: 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]: + 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: consider using 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: instruct how to create a new unborn branch instead. -- From patchwork Mon Mar 4 22:07:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kristoffer Haugsbakk X-Patchwork-Id: 13581303 Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (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 9383C7D09D for ; Mon, 4 Mar 2024 22:08:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.111.4.26 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709590115; cv=none; b=EAlJeZa9w0CwWWNY0Jsamu5CFElk46V8lxmB8PBQ61O4bfFxHZjyAo7kgGn9n7g7R82LMF11Tf/TdQOoYEDAhTrgS33ZwqT+44RGenXWecjnYkLNB29i2hcO8jOEq47eX8pXeU+6aS9sVKOfZazF/Fp8eZIAwMfqvA7OFwu6Edw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709590115; c=relaxed/simple; bh=aEGRJDsDr/QvOgPnMYYoUbwUkEVdUgVmUPbtIGsDsBQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Z1hLBiLNbxpJ+Ki0IXCf6JL2IBNM5xh6KJHBhBxV0TTf0YWDUYBSaCmeu2NvOQz9HZ1mjR1sUupct2pPwd1U/zdqZu5rIwe5+91cXo88ihJlOS72sayXXj/YZ3BPID2ZvXQEsc0gIOsNwymb9VE+llps+PQjS7kUUCLb3m/cfns= 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=VHn8zOjz; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=AWMKXuUU; arc=none smtp.client-ip=66.111.4.26 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="VHn8zOjz"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="AWMKXuUU" Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 53DE85C008E; Mon, 4 Mar 2024 17:08:32 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 04 Mar 2024 17:08:32 -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=1709590112; x=1709676512; bh=UFvKzgrv2Po1QFhJzcdWMT/lVoDh/GHS XH49+jaOxw4=; b=VHn8zOjzqX3uBNhplHY4z3HohB1zeh1weBptR1yMHoBr/RLy cvIU00zAAzshWMOaBGAEzY/Xo16gDhmyjj7IOzJnZXL6UYdJqhSHoylN7n4fADXL qeodHuIGU7PaPjL4p/qpzVQFfFQahl3rxM082KukKxq1dwZB2x43X+NKt9+vUDBj A7h6G4sMvv+mrBcrdvyHqHaT767F74G4gB9/uvaYKPZSvIeBf74UO7Ayt4exeUqs 8uoyFISrZiS7TibloJ3iN5jE9is8wMjIqueo1vNzm8Nb8gwF2gyCjNLS7FDx/V9V z+zQ9gO14pTDbPyB7lWjux1YDutLwwTaltZk1w== 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=1709590112; x= 1709676512; bh=UFvKzgrv2Po1QFhJzcdWMT/lVoDh/GHSXH49+jaOxw4=; b=A WMKXuUUDZS8mFAcpDd4WGEe9XTz9DTrhBdNtRJglZTiBkt/yk+lWpPigGXqH/OpM y5lERNNNhj1dOBfTryA7scIZIJKtBu7shCwIQTR1gfEDM95MCUHZGsN3K444RuJZ ViTi3GYYSuK/CyDwJU8mYGKZOI01bA4iglvUiLHYpKBYVFsjnN44GW2qlVCaPkMu D6/857R/N/mxjhcI70nWsZgsLRneI6J/d1QTc+R4bS9TlGbZ0uZ54MOdtG8CYP82 or0FNxVxVlIaAXItxPVh8PsMIlVlFJW1JLX/IevpFr43jhXPiO4YleuBAx46j8lR mD4KiwNBaNFET358RZ76A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrheejgdduheehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfgggtgfesth ekredtredtjeenucfhrhhomhepmfhrihhsthhofhhfvghrucfjrghughhssggrkhhkuceo tghouggvsehkhhgruhhgshgsrghkkhdrnhgrmhgvqeenucggtffrrghtthgvrhhnpeevgf elveeikeegjeeikeeuvefhleeiuddvleegfeekjedtkeevtdetgfffveettdenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegtohguvgeskhhhrg hughhssggrkhhkrdhnrghmvg X-ME-Proxy: Feedback-ID: i2671468f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 4 Mar 2024 17:08:31 -0500 (EST) From: Kristoffer Haugsbakk To: git@vger.kernel.org Cc: Kristoffer Haugsbakk Subject: [PATCH v3 3/5] advice: use backticks for code Date: Mon, 4 Mar 2024 23:07:28 +0100 Message-ID: <30d662a04c75b80166db9ef94f95e8a841994fb5.1709590037.git.code@khaugsbakk.name> X-Mailer: git-send-email 2.44.0.64.g52b67adbeb2 In-Reply-To: References: <4ad5d4190649dcb5f26c73a6f15ab731891b9dfd.1709491818.git.code@khaugsbakk.name> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Commit-Hash: 30d662a04c75b80166db9ef94f95e8a841994fb5 Use backticks for quoting code rather than single quotes. Also replace “the add command” with “`git add`”. Signed-off-by: Kristoffer Haugsbakk --- Documentation/config/advice.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Documentation/config/advice.txt b/Documentation/config/advice.txt index cfca87a6aa2..df447dd5d14 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:: @@ -90,9 +90,9 @@ advice.*:: 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 Mon Mar 4 22:07:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kristoffer Haugsbakk X-Patchwork-Id: 13581304 Received: from fout2-smtp.messagingengine.com (fout2-smtp.messagingengine.com [103.168.172.145]) (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 A0B9E7D40B for ; Mon, 4 Mar 2024 22:08:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.145 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709590116; cv=none; b=c2jTK42FmHCR6Mm1S/uTbzKf5r0Z2EkKMZB/E33FgeVH5+PEp18k9VRGo7WfOaGgRP5WOggU0Uz4pMpkvigcp2r5pp6QzX96hzN0qHvreKB4X/wJocfEIboaWHHcjg8pSoAhogxP+iZmg6lb6sL8F//VvDBxmnLcnaT5cPnwipc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709590116; c=relaxed/simple; bh=2gPOh2QvE5IUf1qUFFwPGhCA+cP4UYNeqNuhREF6ryA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZcK42mdtQJmdSrvnfyfMyvr3JA27gZhna9ObVH348fUEvAQcRLE05eS/3eO4JEsh7djP8kDpu47FuNQP/AYahD2l+fwqs4Nn+Ag3Tk4IiP6tv3gYEOxwr1ASg+DvixU9ta1t2SVD2CNQU8M9Wj/qBa5HmQRVwyOXUyFsv3Id1jQ= 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=mwKheV6d; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=NAJDMymo; arc=none smtp.client-ip=103.168.172.145 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="mwKheV6d"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="NAJDMymo" Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfout.nyi.internal (Postfix) with ESMTP id 95431138011E; Mon, 4 Mar 2024 17:08:33 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Mon, 04 Mar 2024 17:08:33 -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=1709590113; x=1709676513; bh=vw92IaMYn2wXd7hk3Gx+nyuNAmRZc01E 5u+E9eaL9P0=; b=mwKheV6dl8wkSN4IhB23UPLdl2/HAhrIrgSfqD7N7aRP7xVs xF4a+jaJF1UX7cxaVzKyLRrQosWrPbZ4W59rZXcr/nvuIG7jY+G82+P7OLrsEDbU UBfBC3Ev5eeyrNK7hCLqb8pSH5KuRdWlkCreEkUwZNwMrf+lo7k9Oh2PyKydAcEz b0QwALhTFb/50BOM0j8s8rp8vs4KYm6OnePBaaKysJfeYP1GF+AGheEa84LkuFza Jeai7Wj/rhRN5k4ZO7ZpdiNSPgoXOSGVZa+UM/tehjwg4RDUHtTbuxpwZlC2NrZM AOg96H8kfZWw1bLDJE/NCbng0QXAJmNH0XC/LA== 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=1709590113; x= 1709676513; bh=vw92IaMYn2wXd7hk3Gx+nyuNAmRZc01E5u+E9eaL9P0=; b=N AJDMymo9GBMzzSWxrwDCxdWq7dTX5gYGekJfwJugzlmEt93axOxRusRd0Ew7pGIK iFvAiHNfI7TKZB5GX2c949UXNr53Mcz1KHSz2YZsMd992AVNn1Jham1SAMHYJ7O6 mA1GouMFfRtb+gq8zOE1G1/SlgZJUerFh6dAbvXWgSSuba1bHvz+IjtRklxg70ph O0VwJcDOvh4YBN/nIIYytTqnF9wyJfzVSNJZcrMW5QCJVy9F4TdCjww+0GYhM5QE K9nvtfHS30o2w5Yl9YVuHXv4k3CLjUBXPtQp8vtTQxR/H7DFiv/6myivmBI9xtni BZQ+qdON1im9PXG+mv2og== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrheejgdduheehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfgggtgfesth ekredtredtjeenucfhrhhomhepmfhrihhsthhofhhfvghrucfjrghughhssggrkhhkuceo tghouggvsehkhhgruhhgshgsrghkkhdrnhgrmhgvqeenucggtffrrghtthgvrhhnpeevgf elveeikeegjeeikeeuvefhleeiuddvleegfeekjedtkeevtdetgfffveettdenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegtohguvgeskhhhrg hughhssggrkhhkrdhnrghmvg X-ME-Proxy: Feedback-ID: i2671468f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 4 Mar 2024 17:08:32 -0500 (EST) From: Kristoffer Haugsbakk To: git@vger.kernel.org Cc: Kristoffer Haugsbakk Subject: [PATCH v3 4/5] advice: use double quotes for regular quoting Date: Mon, 4 Mar 2024 23:07:29 +0100 Message-ID: <3028713357ff77f33c1f96b05b566279683808ac.1709590037.git.code@khaugsbakk.name> X-Mailer: git-send-email 2.44.0.64.g52b67adbeb2 In-Reply-To: References: <4ad5d4190649dcb5f26c73a6f15ab731891b9dfd.1709491818.git.code@khaugsbakk.name> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Commit-Hash: 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 df447dd5d14..c5d3d6790a5 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 Mon Mar 4 22:07:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kristoffer Haugsbakk X-Patchwork-Id: 13581305 Received: from fout2-smtp.messagingengine.com (fout2-smtp.messagingengine.com [103.168.172.145]) (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 C8B487E11D for ; Mon, 4 Mar 2024 22:08:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.145 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709590117; cv=none; b=MMWw5HUYK9eKOcMXEf06295bKDZ15toBqSTTw3tIjJC2lSNcfDXx+7ItPs0vgJTHzNHy/2TFpAom0BwG/chiMhnlQm5AQB4y7FmXg1FNSBGYXtJbTUGKbRshRCTZkEWYnsmEgaAbSEu/qvK4Cm4NwONsRi6oUx/U0YAYVbguUgE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709590117; c=relaxed/simple; bh=HnbXe2UVLy6qJAiR0tFF/Hh75W/26mzREOjkWr0Q/qE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GEQHwb9CHJOjX56MaJrXiYihhwRu7MM4yziq1ng2dkYKeHoJbCGL3B21xDQcq3mvveEhDinurtYlrTq5ZpFyN/xT7RivLJDEvJUvHxeIFcCWd7/kJj+AthI6vBX45t6S9+OnTb55cggKv2nHgH1toX6ix0cj8fWFgpN6KgEFhAU= 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=0fu+AcGq; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=r/E8SA5e; arc=none smtp.client-ip=103.168.172.145 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="0fu+AcGq"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="r/E8SA5e" Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfout.nyi.internal (Postfix) with ESMTP id ED33413800DB; Mon, 4 Mar 2024 17:08:34 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Mon, 04 Mar 2024 17:08:34 -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=1709590114; x=1709676514; bh=F0BXsr6dHsAh5t9TealuDWJRv6Ozc+VU M9yjSOg0dG4=; b=0fu+AcGqV/DGg68FmkINuhW6LRjd9OfZh9xg/yyYWpgxDQi2 clo1n7puk1HlVJaJegA6Wdak7zCKxC5IADp2MDE6iH3GSd+PIlFLdGwQXLmmV1fT lp++tOj9GxiQR4Qm1Exk3VF436lF0CvVwmwU8gj8TOKCgBKa1rZucAAel5t8bGsb 7N4QEg3tonc0HLAGOuwMr5sZOcpLa3U6OP5L7sTtS6sMGp/yr+WAiWYIUo/CuWJA PjEIbel06KWzqVAfne3DoZS40B/J4op2K110O4W2D4ty3bsAuqN5nVN9OyN7ZNaQ g143JOlTq9M2JGA9WpKqAPsLiitayBqzuncKXw== 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=1709590114; x= 1709676514; bh=F0BXsr6dHsAh5t9TealuDWJRv6Ozc+VUM9yjSOg0dG4=; b=r /E8SA5eSzoiBX8RNKMwGEQL2VGpBY6oWaJLu8KizRZruy6hS5Cke/iUaX/BKX/9B PGSDU54WsBMyvyY5A/jgAWu27+vy4LFeGs9l/nw3kz5Gws322DSSlBNgZb+nSiux lkMKTZ1DENZgI/YQKNy5ZnlHv5pqAJDPWfFOdKpUlSgueNquAzYp2hK9CKXi53Eg G7TtcmXnHZLwmXcCQ6LJmd6OPjUIVkrFmAKIVGatqqR/4Q3aJBlUZHjCZCL6LvZz UtVAl3oAvm2w9AHbK5UfJKSLfgSLNIB6K5BctGTT7xCxogZAaO5raPPAYAdE04oU Y5OtDoSm+lLnCYF4qYL5Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrheejgdduheehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfgggtgfesth ekredtredtjeenucfhrhhomhepmfhrihhsthhofhhfvghrucfjrghughhssggrkhhkuceo tghouggvsehkhhgruhhgshgsrghkkhdrnhgrmhgvqeenucggtffrrghtthgvrhhnpeevgf elveeikeegjeeikeeuvefhleeiuddvleegfeekjedtkeevtdetgfffveettdenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegtohguvgeskhhhrg hughhssggrkhhkrdhnrghmvg X-ME-Proxy: Feedback-ID: i2671468f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 4 Mar 2024 17:08:33 -0500 (EST) From: Kristoffer Haugsbakk To: git@vger.kernel.org Cc: Kristoffer Haugsbakk Subject: [PATCH v3 5/5] branch: advise about ref syntax rules Date: Mon, 4 Mar 2024 23:07:30 +0100 Message-ID: <402b7937951073466bf4527caffd38175391c7da.1709590037.git.code@khaugsbakk.name> X-Mailer: git-send-email 2.44.0.64.g52b67adbeb2 In-Reply-To: References: <4ad5d4190649dcb5f26c73a6f15ab731891b9dfd.1709491818.git.code@khaugsbakk.name> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Commit-Hash: 402b7937951073466bf4527caffd38175391c7da X-Previous-Commits: 4ad5d4190649dcb5f26c73a6f15ab731891b9dfd d275d1d179b90592ddd7b5da2ae4573b3f7a37b7 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): 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 c5d3d6790a5..06a3a3cc9b5 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: point + towards the ref syntax documentation. resetNoRefresh:: Shown when linkgit:git-reset[1] takes more than 2 seconds to refresh the index after reset: 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 273a57a72d8..30a97e3776e 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