From patchwork Fri May 3 07:17:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Liu X-Patchwork-Id: 13652468 Received: from wfout5-smtp.messagingengine.com (wfout5-smtp.messagingengine.com [64.147.123.148]) (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 37B9B146A71 for ; Fri, 3 May 2024 07:17:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.148 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714720645; cv=none; b=b2Scp+9CzVtTxb7uopfj4DW+RgSjWpqA7OE1ENjmx/X/Y+CDolusr/P9MFBON1iEyDDqJAAMg/2NTwLWppLHZamEpuaQbWBJKTeCntr8eJ8uIGas2MkLaUe71ZQzlRLzdtysf8OP4LspAQ/U7lffgGQqHTaxLFEDubeEBGLfQu0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714720645; c=relaxed/simple; bh=y2HHKlW41zd5Hy3zJfgQ5oeTJUJ40WfxSr5v0vcEsjY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Gp+y2Yz0ecjPFjS8i68Vbls2tDJUCn2sS5Ew/ftQugphMIWnTzAC8xblIRIHZaFBJtiLXBpDlN4BgePS/VQFPtLAMYPuu2uWmjMSVV1QWXnqolv/25cSGkx7apK1E08bASKy2T1FnVLuUTSr4Bef147jAKxeL/S2FC2mVp2ihl4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=jamesliu.io; spf=pass smtp.mailfrom=jamesliu.io; dkim=pass (2048-bit key) header.d=jamesliu.io header.i=@jamesliu.io header.b=CxoFGsPe; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=DaBaiG8S; arc=none smtp.client-ip=64.147.123.148 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=jamesliu.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=jamesliu.io Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=jamesliu.io header.i=@jamesliu.io header.b="CxoFGsPe"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="DaBaiG8S" Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfout.west.internal (Postfix) with ESMTP id 792F71C00138; Fri, 3 May 2024 03:17:22 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Fri, 03 May 2024 03:17:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jamesliu.io; h= cc:cc:content-transfer-encoding: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=1714720642; x= 1714807042; bh=SHa5u2GLUjmNQVCpSrO7f0MYHrjmi2GKHlTAusN9ufM=; b=C xoFGsPefoCqyG5CwYkTrc53bSIKns8suLD1eHyrDRFUQ0VC0yeKGp8YpqFVK/u2y WEBnqOmOZw6iquBgJMKhmgJAW8/fxifV1QVpbaZdEBJVLXdMV568tMqB2hVB/TSR nt1gvyfWvt8pJXbEvsSwWRDC9ny7osZlpEsi+csv/gVz9S7w4MUeTtSFhW8Lw336 z7FH7u2V9Kg6RKNnthSq2hv7530sn5EgwRBraRphaOIV/RqiKHvI1YMUz4E4A6l4 ZBbMA3MlJXVKHJDirsvjBcEgLLThaEiIBzR5l8C3EU2oCELz1BwxAAjz1uYq+siH Syiu6Y4CnQhUV7CyREwGw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :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=fm3; t=1714720642; x= 1714807042; bh=SHa5u2GLUjmNQVCpSrO7f0MYHrjmi2GKHlTAusN9ufM=; b=D aBaiG8SI5FwmM5fg/WtRLBEBncRd2nold92yD6V6voTHiu2Q+pAwmKcog9D5EB6N qeFbKyPgtt7tyqyKOwqR51a75d3J77z3iIuWUqFq2uV/dh3odkdcFnjqNJG/4DRP 5VWeYoLCAP+ZNcUN6c8vE2yBGrVr8WdxbbK5oxsOIqZKpE7GnftBjK/XySbbXgDk 6RrcTvuMwzixxV7Cu0/QFo+MUPt2yXB8kUSZArPXPr1r/dTi2JjcBHKpc11U9T8q LdIVdj3wIVT9g5k8A2CJ1L6Jz2w3xucAgKofteIdJX0BwQPpExAXZKA1t1ELSS8v 20jHtCkY3OZAl5ZLs1tPQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdduledguddtgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvvefufffkofgjfhgggfestd ekredtredttdenucfhrhhomheplfgrmhgvshcunfhiuhcuoehjrghmvghssehjrghmvghs lhhiuhdrihhoqeenucggtffrrghtthgvrhhnpeeljedtuedugfetgeefieduheelueetvd fhueeuueehveeljeekleetteefvefhjeenucevlhhushhtvghrufhiiigvpedtnecurfgr rhgrmhepmhgrihhlfhhrohhmpehjrghmvghssehjrghmvghslhhiuhdrihho X-ME-Proxy: Feedback-ID: i93f149ec:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 3 May 2024 03:17:20 -0400 (EDT) From: James Liu To: git@vger.kernel.org Cc: James Liu Subject: [PATCH v4 1/3] doc: clean up usage documentation for --no-* opts Date: Fri, 3 May 2024 17:17:04 +1000 Message-ID: <20240503071706.78109-2-james@jamesliu.io> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240503071706.78109-1-james@jamesliu.io> References: <20240430014724.83813-1-james@jamesliu.io> <20240503071706.78109-1-james@jamesliu.io> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 We'll be adding another option to the --no-* class of options soon. Clean up the existing options by grouping them together in the OPTIONS section, and adding missing ones to the SYNOPSIS. Signed-off-by: James Liu --- Documentation/git.txt | 14 +++++++------- git.c | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Documentation/git.txt b/Documentation/git.txt index 7a1b112a3e..7fa75350b2 100644 --- a/Documentation/git.txt +++ b/Documentation/git.txt @@ -11,9 +11,9 @@ SYNOPSIS [verse] 'git' [-v | --version] [-h | --help] [-C ] [-c =] [--exec-path[=]] [--html-path] [--man-path] [--info-path] - [-p|--paginate|-P|--no-pager] [--no-replace-objects] [--bare] - [--git-dir=] [--work-tree=] [--namespace=] - [--config-env==] [] + [-p|--paginate|-P|--no-pager] [--no-replace-objects] [--no-lazy-fetch] + [--no-optional-locks] [--bare] [--git-dir=] [--work-tree=] + [--namespace=] [--config-env==] [] DESCRIPTION ----------- @@ -186,6 +186,10 @@ If you just want to run git as if it was started in `` then use This is equivalent to setting the `GIT_NO_LAZY_FETCH` environment variable to `1`. +--no-optional-locks:: + Do not perform optional operations that require locks. This is + equivalent to setting the `GIT_OPTIONAL_LOCKS` to `0`. + --literal-pathspecs:: Treat pathspecs literally (i.e. no globbing, no pathspec magic). This is equivalent to setting the `GIT_LITERAL_PATHSPECS` environment @@ -207,10 +211,6 @@ If you just want to run git as if it was started in `` then use Add "icase" magic to all pathspec. This is equivalent to setting the `GIT_ICASE_PATHSPECS` environment variable to `1`. ---no-optional-locks:: - Do not perform optional operations that require locks. This is - equivalent to setting the `GIT_OPTIONAL_LOCKS` to `0`. - --list-cmds=[,...]:: List commands by group. This is an internal/experimental option and may change or be removed in the future. Supported diff --git a/git.c b/git.c index 654d615a18..7654571b75 100644 --- a/git.c +++ b/git.c @@ -36,9 +36,9 @@ struct cmd_struct { const char git_usage_string[] = N_("git [-v | --version] [-h | --help] [-C ] [-c =]\n" " [--exec-path[=]] [--html-path] [--man-path] [--info-path]\n" - " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]\n" - " [--git-dir=] [--work-tree=] [--namespace=]\n" - " [--config-env==] []"); + " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--no-lazy-fetch]\n" + " [--no-optional-locks] [--bare] [--git-dir=] [--work-tree=]\n" + " [--namespace=] [--config-env==] []"); const char git_more_info_string[] = N_("'git help -a' and 'git help -g' list available subcommands and some\n" From patchwork Fri May 3 07:17:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Liu X-Patchwork-Id: 13652469 Received: from wfhigh7-smtp.messagingengine.com (wfhigh7-smtp.messagingengine.com [64.147.123.158]) (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 2E6DF1474CF for ; Fri, 3 May 2024 07:17:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.158 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714720647; cv=none; b=iS4jUd6KEYVNIYXlEv71JPdQTJzQenS+N6uH/OTUeQugG8Jt7WrkWCHn+vhe1UA6qNKsGXVhHNwXCxfHv7j8SUTuW4EyWDDwkzgjBJOmouHeZdlDrB2/cxJ31X4UBzVb+WvJPbyf2UT1Meh6Cwk/u9O9t7HhcqoaQHx73SWI86I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714720647; c=relaxed/simple; bh=8aq8j9dHFTPw45R3gZvPZHxSI7ZpEbpJ6dBqzCFP3HY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cAZbEPpsbL+uzdG/HNsUiU01MgPpA3E+1QccGCiAzFTcg7s9k1ZxGt3VKR75IU8Gt9h+4Uh4raty5+N+YIMBfMDdvrr1XnDc9OBYkYJomYqP2W+Sl0gPYRtyg/vJm/NH7HWLQvcH8+iEBR/sMqwRHMHr5PulUK6/UnRIlXi+E28= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=jamesliu.io; spf=pass smtp.mailfrom=jamesliu.io; dkim=pass (2048-bit key) header.d=jamesliu.io header.i=@jamesliu.io header.b=V2TBDMl8; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=GQWZUxmB; arc=none smtp.client-ip=64.147.123.158 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=jamesliu.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=jamesliu.io Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=jamesliu.io header.i=@jamesliu.io header.b="V2TBDMl8"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="GQWZUxmB" Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfhigh.west.internal (Postfix) with ESMTP id 1E93B1800142; Fri, 3 May 2024 03:17:25 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Fri, 03 May 2024 03:17:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jamesliu.io; h= cc:cc:content-transfer-encoding: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=1714720644; x= 1714807044; bh=uia4eDtX5HWa1+DC9nuPCGaC1YrEbp9Mjeqh6D0Yeog=; b=V 2TBDMl8gPIVUg55iy2azbiDaJkWdi4ELfru1scNB6ZuKzEVi3DA5w3r2rbMmzhOs 6Wc41LMrj/71YptiCzzrWlzHqQ2qv7QSSaBM0FscqHwa9mjtZE8Ba/ahEexeWhJl Sb0cYpwczk6waWu+gIXM+KzZzaookx+Dtr93MgaWXQ6esqhN82r5MdYKx/TBseJB eLU6sMxNqjbpuYDfZ60HXDZhnUzqOsVZoTbbXPvc4Wx3ed0GaipQPujqalTAzHi/ iYkcwZ0SWHrevl8ckFO4qQE7EMhVDWSKN5zo1FLlfUme84zK5l1b6sB7RRsu7yy+ Ef6QS7ROxw/RW1F0NNFhg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :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=fm3; t=1714720644; x= 1714807044; bh=uia4eDtX5HWa1+DC9nuPCGaC1YrEbp9Mjeqh6D0Yeog=; b=G QWZUxmBQ0f0b0CI0nOys/JOQ9qVRqZTHDSC31ztFr0O3f+Vyka0SZTCXnj6sEgVS N9aBn2CxTvQr3ECUwQUR6xy76JG7OaQOuCFgkAJsksxUMe7sLNghugPGZQJ2Enbi LbSw9OwuxZu0iaQGYnJm3qluv97BqUbq7piOb8S9Z0poUDTBCi2Eagzyd/Mzo3y0 aK00JCjh8a0ZRiWIwQ11MUikP3Dg5Pul8UiYcKL+D2QR/Gf05/Sad0kc+Djp+9uX AyqZjy+VfUad8iakgJ+Fk8skRVg8PtLmyTKHFrvrrv6g6sYpzmvVkWRABrqp3Qqv 79Wb75xe05UU2ZJT5s3GQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdduledguddtgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvvefufffkofgjfhgggfestd ekredtredttdenucfhrhhomheplfgrmhgvshcunfhiuhcuoehjrghmvghssehjrghmvghs lhhiuhdrihhoqeenucggtffrrghtthgvrhhnpeeljedtuedugfetgeefieduheelueetvd fhueeuueehveeljeekleetteefvefhjeenucevlhhushhtvghrufhiiigvpedunecurfgr rhgrmhepmhgrihhlfhhrohhmpehjrghmvghssehjrghmvghslhhiuhdrihho X-ME-Proxy: Feedback-ID: i93f149ec:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 3 May 2024 03:17:23 -0400 (EDT) From: James Liu To: git@vger.kernel.org Cc: James Liu Subject: [PATCH v4 2/3] doc: add spacing around paginate options Date: Fri, 3 May 2024 17:17:05 +1000 Message-ID: <20240503071706.78109-3-james@jamesliu.io> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240503071706.78109-1-james@jamesliu.io> References: <20240430014724.83813-1-james@jamesliu.io> <20240503071706.78109-1-james@jamesliu.io> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Make the documentation page consistent with the usage string printed by git.c Signed-off-by: James Liu --- Documentation/git.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/git.txt b/Documentation/git.txt index 7fa75350b2..d11d3d0c86 100644 --- a/Documentation/git.txt +++ b/Documentation/git.txt @@ -11,7 +11,7 @@ SYNOPSIS [verse] 'git' [-v | --version] [-h | --help] [-C ] [-c =] [--exec-path[=]] [--html-path] [--man-path] [--info-path] - [-p|--paginate|-P|--no-pager] [--no-replace-objects] [--no-lazy-fetch] + [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--no-lazy-fetch] [--no-optional-locks] [--bare] [--git-dir=] [--work-tree=] [--namespace=] [--config-env==] [] From patchwork Fri May 3 07:17:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Liu X-Patchwork-Id: 13652470 Received: from wfout5-smtp.messagingengine.com (wfout5-smtp.messagingengine.com [64.147.123.148]) (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 6FC20146A77 for ; Fri, 3 May 2024 07:17:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.148 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714720650; cv=none; b=KtHlAuGEs9ftkKVRTWUpsm8UuQq9dPtHvLPdGZsiy3A/4gmgoijNKfJ8/Cfd2Hyafn6Rn/4Z6+bUL/1zk7v8LxLK6ZA4neS6jZ2pnhHH74PVReY6YKDUoWu1zUDqN+drV6uNaz1h1cG0p5hH49URnRA1TGP0z2wyVQ2UooO8YZs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714720650; c=relaxed/simple; bh=TH0yiIgX2hbPFEGwJUVBkXTBUqoU94ZCTXUDc0S4PJY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZLDSCiKkMj22i16iUE+vtRueJMGHP2D8/vKmJx3TIFsnxlpEPECSVmOtc/PQIV9ok1TxjPtP4BpPk6ErpGjAr90Jp+loftPX9Zj9P72WeJODPZKx6W23WI1zHuM+4O+t0uqBnlWSNMtY5CHNZuruq9XN+X/yiK+xIUL+URPyBLk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=jamesliu.io; spf=pass smtp.mailfrom=jamesliu.io; dkim=pass (2048-bit key) header.d=jamesliu.io header.i=@jamesliu.io header.b=aiFUk96B; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=iOstiBap; arc=none smtp.client-ip=64.147.123.148 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=jamesliu.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=jamesliu.io Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=jamesliu.io header.i=@jamesliu.io header.b="aiFUk96B"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="iOstiBap" Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfout.west.internal (Postfix) with ESMTP id C59D61C00144; Fri, 3 May 2024 03:17:27 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Fri, 03 May 2024 03:17:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jamesliu.io; h= cc:cc:content-transfer-encoding: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=1714720647; x= 1714807047; bh=Mfr/qf/tHPPGBXgn+q0tywRHIYWQSzIiYseU9fvXhZc=; b=a iFUk96ByPwiiVlh5sN6nGAvq+yNTvw1r1hQWmw49hDvMEKDDmApnlTe5xSExrPyB Ffd0zLF5c5giyzMw204WtVjrisyNb07F+ESCQebS656l4igIGqTgGx7sbjaHCl2J 8tNlTvzSz/9YtBijakDJz1QOJ9XB4iJjZe1RbhEa/Nqo0vZvhsiyv2kxC/Oicw28 EcHfHi12YWkSupth5RYNsL/aR8C2xFjEYIxSPwLILhmK24cm8cYyrWV4gG5QtvbF Rthj3ybXJFg22IhKJtRJar38Ws6MynyVpB1RhOmJ3NFc9UBmkI2/iBlc3lmdYx1S MNDMxOlXhX8ZCN13EmW2g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :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=fm3; t=1714720647; x= 1714807047; bh=Mfr/qf/tHPPGBXgn+q0tywRHIYWQSzIiYseU9fvXhZc=; b=i OstiBapB9iMlqckIZNN+O3kG7ZJpI5AhgwuEdATtIh5r/2jriGhj3yQ7CyP/6GmR Vdn2DpWGpsPHwhzwnhXJBLi2tWzZV6l+LE1v+iOkhBmTfVkPqif8Gen++Tpn8yXo fKOk6UD+s+drS+IxoXSwttuuq7FVXkRRgB7s3SdBYXfEodxRH6ZwMBHEiOrvYoFV h3Jc3EOOST1mu2zt6lI3NTvKEJueW0cCYJutsLXW6KjtmTY60SUvyvauY4J6S26z CidUQ2p+okPMHbKZG1290KxF9u3myt96gNkRNioeMEJrTQq/n6My+L0jplNu5Swk glvuPumwhpVhQ98niM1dQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdduledguddtgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvvefufffkofgjfhgggfestd ekredtredttdenucfhrhhomheplfgrmhgvshcunfhiuhcuoehjrghmvghssehjrghmvghs lhhiuhdrihhoqeenucggtffrrghtthgvrhhnpeeljedtuedugfetgeefieduheelueetvd fhueeuueehveeljeekleetteefvefhjeenucevlhhushhtvghrufhiiigvpedtnecurfgr rhgrmhepmhgrihhlfhhrohhmpehjrghmvghssehjrghmvghslhhiuhdrihho X-ME-Proxy: Feedback-ID: i93f149ec:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 3 May 2024 03:17:25 -0400 (EDT) From: James Liu To: git@vger.kernel.org Cc: James Liu Subject: [PATCH v4 3/3] advice: add --no-advice global option Date: Fri, 3 May 2024 17:17:06 +1000 Message-ID: <20240503071706.78109-4-james@jamesliu.io> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240503071706.78109-1-james@jamesliu.io> References: <20240430014724.83813-1-james@jamesliu.io> <20240503071706.78109-1-james@jamesliu.io> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Advice hints must be disabled individually by setting the relevant advice.* variables to false in the Git configuration. For server-side and scripted usages of Git where hints can be a hindrance, it can be cumbersome to maintain configuration to ensure all advice hints are disabled in perpetuity. This is a particular concern in tests, where new or changed hints can result in failed assertions. Add a --no-advice global option to disable all advice hints from being displayed. This is independent of the toggles for individual advice hints. Use an internal environment variable (GIT_ADVICE) to ensure this configuration is propagated to the usage site, even if it executes in a subprocess. Signed-off-by: James Liu --- Documentation/git.txt | 8 +++-- advice.c | 7 +++++ environment.h | 7 +++++ git.c | 9 ++++-- t/t0018-advice.sh | 68 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 95 insertions(+), 4 deletions(-) diff --git a/Documentation/git.txt b/Documentation/git.txt index d11d3d0c86..a0c07f1db8 100644 --- a/Documentation/git.txt +++ b/Documentation/git.txt @@ -12,8 +12,9 @@ SYNOPSIS 'git' [-v | --version] [-h | --help] [-C ] [-c =] [--exec-path[=]] [--html-path] [--man-path] [--info-path] [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--no-lazy-fetch] - [--no-optional-locks] [--bare] [--git-dir=] [--work-tree=] - [--namespace=] [--config-env==] [] + [--no-optional-locks] [--no-advice] [--bare] [--git-dir=] + [--work-tree=] [--namespace=] [--config-env==] + [] DESCRIPTION ----------- @@ -190,6 +191,9 @@ If you just want to run git as if it was started in `` then use Do not perform optional operations that require locks. This is equivalent to setting the `GIT_OPTIONAL_LOCKS` to `0`. +--no-advice:: + Disable all advice hints from being printed. + --literal-pathspecs:: Treat pathspecs literally (i.e. no globbing, no pathspec magic). This is equivalent to setting the `GIT_LITERAL_PATHSPECS` environment diff --git a/advice.c b/advice.c index 75111191ad..0a122c2020 100644 --- a/advice.c +++ b/advice.c @@ -2,6 +2,7 @@ #include "advice.h" #include "config.h" #include "color.h" +#include "environment.h" #include "gettext.h" #include "help.h" #include "string-list.h" @@ -127,6 +128,12 @@ void advise(const char *advice, ...) int advice_enabled(enum advice_type type) { int enabled = advice_setting[type].level != ADVICE_LEVEL_DISABLED; + static int globally_enabled = -1; + + if (globally_enabled < 0) + globally_enabled = git_env_bool(GIT_ADVICE_ENVIRONMENT, 1); + if (!globally_enabled) + return 0; if (type == ADVICE_PUSH_UPDATE_REJECTED) return enabled && diff --git a/environment.h b/environment.h index 05fd94d7be..0b2d457f07 100644 --- a/environment.h +++ b/environment.h @@ -57,6 +57,13 @@ const char *getenv_safe(struct strvec *argv, const char *name); #define GIT_TEXT_DOMAIN_DIR_ENVIRONMENT "GIT_TEXTDOMAINDIR" #define GIT_ATTR_SOURCE_ENVIRONMENT "GIT_ATTR_SOURCE" +/* + * Environment variable used to propagate the --no-advice global option to the + * advice_enabled() helper, even when run in a subprocess. + * This is an internal variable that should not be set by the user. + */ +#define GIT_ADVICE_ENVIRONMENT "GIT_ADVICE" + /* * Environment variable used in handshaking the wire protocol. * Contains a colon ':' separated list of keys with optional values diff --git a/git.c b/git.c index 7654571b75..637c61ca9c 100644 --- a/git.c +++ b/git.c @@ -37,8 +37,9 @@ const char git_usage_string[] = N_("git [-v | --version] [-h | --help] [-C ] [-c =]\n" " [--exec-path[=]] [--html-path] [--man-path] [--info-path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--no-lazy-fetch]\n" - " [--no-optional-locks] [--bare] [--git-dir=] [--work-tree=]\n" - " [--namespace=] [--config-env==] []"); + " [--no-optional-locks] [--no-advice] [--bare] [--git-dir=]\n" + " [--work-tree=] [--namespace=] [--config-env==]\n" + " []"); const char git_more_info_string[] = N_("'git help -a' and 'git help -g' list available subcommands and some\n" @@ -337,6 +338,10 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) setenv(GIT_ATTR_SOURCE_ENVIRONMENT, cmd, 1); if (envchanged) *envchanged = 1; + } else if (!strcmp(cmd, "--no-advice")) { + setenv(GIT_ADVICE_ENVIRONMENT, "0", 1); + if (envchanged) + *envchanged = 1; } else { fprintf(stderr, _("unknown option: %s\n"), cmd); usage(git_usage_string); diff --git a/t/t0018-advice.sh b/t/t0018-advice.sh index 0dcfb760a2..b02448ea16 100755 --- a/t/t0018-advice.sh +++ b/t/t0018-advice.sh @@ -29,4 +29,72 @@ test_expect_success 'advice should not be printed when config variable is set to test_must_be_empty actual ' +test_expect_success 'advice should not be printed when --no-advice is used' ' + q_to_tab >expect <<-\EOF && +On branch master + +No commits yet + +Untracked files: +QREADME + +nothing added to commit but untracked files present +EOF + + test_when_finished "rm -fr advice-test" && + git init advice-test && + ( + cd advice-test && + >README && + git --no-advice status + ) >actual && + test_cmp expect actual +' + +test_expect_success 'advice should not be printed when GIT_ADVICE is set to false' ' + q_to_tab >expect <<-\EOF && +On branch master + +No commits yet + +Untracked files: +QREADME + +nothing added to commit but untracked files present +EOF + + test_when_finished "rm -fr advice-test" && + git init advice-test && + ( + cd advice-test && + >README && + GIT_ADVICE=false git status + ) >actual && + test_cmp expect actual +' + +test_expect_success 'advice should be printed when GIT_ADVICE is set to true' ' + q_to_tab >expect <<-\EOF && +On branch master + +No commits yet + +Untracked files: + (use "git add ..." to include in what will be committed) +QREADME + +nothing added to commit but untracked files present (use "git add" to track) +EOF + + test_when_finished "rm -fr advice-test" && + git init advice-test && + ( + cd advice-test && + >README && + GIT_ADVICE=true git status + ) >actual && + cat actual > /tmp/actual && + test_cmp expect actual +' + test_done From patchwork Wed May 8 00:40:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Junio C Hamano X-Patchwork-Id: 13657990 Received: from pb-smtp2.pobox.com (pb-smtp2.pobox.com [64.147.108.71]) (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 DD103387 for ; Wed, 8 May 2024 00:40:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.108.71 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715128861; cv=none; b=M+k7cvpdk8EoMHDOoF+vStbe/7neEVVzDJu6HmM18zvzPGmSDG1RDpFOZOs9zh1CzMsn+8jkloV7+SqBbA0UTbnZ9f0trAwmIhhSoAfBfwoD7OZKimIX0N+VryMX+Y2Ps3Py6gv/pXWLXKy02XCy2doFmo+DO1SpiNmH8qKnYsg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715128861; c=relaxed/simple; bh=7JX+u3SwqeVVeLvKu+oQM068BL20hEMz1QlRvFZAbDQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=ZV5yz8e5Bg73I2vaEeLjBKqhgNwH6fHZ+aNSYQsHkhoWjl87eE52ILH0pivGz6pE+71DIBlZK5FOQggmNiw/dVpsclaDhC6lpwW1PC9UyGxmJrQUX+djogg49G6tQ4VT4Phe0JEdo6Q/fLO7nQDGr6FuFOeLnUcWJ/hNEnl5uE8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass (1024-bit key) header.d=pobox.com header.i=@pobox.com header.b=xw9YDO2r; arc=none smtp.client-ip=64.147.108.71 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=pobox.com header.i=@pobox.com header.b="xw9YDO2r" Received: from pb-smtp2.pobox.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 5F67322649; Tue, 7 May 2024 20:40:53 -0400 (EDT) (envelope-from junio@pobox.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=from:to:cc :subject:in-reply-to:references:date:message-id:mime-version :content-type; s=sasl; bh=7JX+u3SwqeVVeLvKu+oQM068BL20hEMz1QlRvF ZAbDQ=; b=xw9YDO2rlU2WDltbdbQuFGXLlYo5+Ds6BqkDDKpZomZsR2LXQxph8a upTMuzhiyD2FEBXZNw32pZ/8lPYi50HQfFsfw1LCwmNZAYz4ln29e+jHALpSZRMz J/BWt3GHKFY5fetZ1K8NcE3rJiQdsjlDytTU3udguDkNqsKYuYS74= Received: from pb-smtp2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 581D322648; Tue, 7 May 2024 20:40:53 -0400 (EDT) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [34.125.153.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp2.pobox.com (Postfix) with ESMTPSA id BDD4922647; Tue, 7 May 2024 20:40:52 -0400 (EDT) (envelope-from junio@pobox.com) From: Junio C Hamano To: git@vger.kernel.org Cc: James Liu Subject: [PATCH v4 4/3] t0018: two small fixes In-Reply-To: <20240503071706.78109-4-james@jamesliu.io> (James Liu's message of "Fri, 3 May 2024 17:17:06 +1000") References: <20240430014724.83813-1-james@jamesliu.io> <20240503071706.78109-1-james@jamesliu.io> <20240503071706.78109-4-james@jamesliu.io> Date: Tue, 07 May 2024 17:40:51 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Pobox-Relay-ID: 9FA6F142-0CD3-11EF-A276-25B3960A682E-77302942!pb-smtp2.pobox.com Even though the three tests that were recently added started their here-doc with "<<-\EOF", it did not take advantage of that and instead wrote the here-doc payload abut to the left edge. Use a tabs to indent these lines. More importantly, because these all hardcode the expected output, which contains the current branch name, they break the CI job that uses 'main' as the default branch name. Use GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=trunk export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME between the test_description line and ". ./test-lib.sh" line to force the initial branch name to 'trunk' and expect it to show in the output. Signed-off-by: Junio C Hamano --- * I should have noticed these before merging the series to 'next', so here is a fix-up patch on top of the three patches. t/t0018-advice.sh | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git c/t/t0018-advice.sh w/t/t0018-advice.sh index b02448ea16..29306b367c 100755 --- c/t/t0018-advice.sh +++ w/t/t0018-advice.sh @@ -2,6 +2,9 @@ test_description='Test advise_if_enabled functionality' +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=trunk +export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME + TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh @@ -31,15 +34,15 @@ test_expect_success 'advice should not be printed when config variable is set to test_expect_success 'advice should not be printed when --no-advice is used' ' q_to_tab >expect <<-\EOF && -On branch master + On branch trunk -No commits yet + No commits yet -Untracked files: -QREADME + Untracked files: + QREADME -nothing added to commit but untracked files present -EOF + nothing added to commit but untracked files present + EOF test_when_finished "rm -fr advice-test" && git init advice-test && @@ -53,15 +56,15 @@ EOF test_expect_success 'advice should not be printed when GIT_ADVICE is set to false' ' q_to_tab >expect <<-\EOF && -On branch master + On branch trunk -No commits yet + No commits yet -Untracked files: -QREADME + Untracked files: + QREADME -nothing added to commit but untracked files present -EOF + nothing added to commit but untracked files present + EOF test_when_finished "rm -fr advice-test" && git init advice-test && @@ -75,16 +78,16 @@ EOF test_expect_success 'advice should be printed when GIT_ADVICE is set to true' ' q_to_tab >expect <<-\EOF && -On branch master + On branch trunk -No commits yet + No commits yet -Untracked files: - (use "git add ..." to include in what will be committed) -QREADME + Untracked files: + (use "git add ..." to include in what will be committed) + QREADME -nothing added to commit but untracked files present (use "git add" to track) -EOF + nothing added to commit but untracked files present (use "git add" to track) + EOF test_when_finished "rm -fr advice-test" && git init advice-test &&