From patchwork Thu Jan 20 12:35:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ren=C3=A9_Scharfe?= X-Patchwork-Id: 12718580 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A08E8C433EF for ; Thu, 20 Jan 2022 12:36:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231229AbiATMgM (ORCPT ); Thu, 20 Jan 2022 07:36:12 -0500 Received: from mout.web.de ([212.227.17.12]:54501 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230448AbiATMgH (ORCPT ); Thu, 20 Jan 2022 07:36:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1642682155; bh=OR+/ZUHuStXtamf5fNKlzBq0hYK2NqqnfhXmzDRy1ts=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=KaOstnjcIgfG6tJHfrrQA/W2ngZViwK1nv736QzCxCX/mcxUe3bltTjikxXQeV1QQ 7h+vWhWO5NlvDvo0VMEyZIOCqbwS723LqCw3RCQhRQT5RU04utsXJa4wlquyy7jBj4 oZs8YaXr7lx8a4CcZa+Y8xALTEDR/tmarGJP6iTg= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from [192.168.178.29] ([79.203.22.121]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1Mt8gF-1mHKc60X17-00tTwd; Thu, 20 Jan 2022 13:35:55 +0100 Message-ID: Date: Thu, 20 Jan 2022 13:35:54 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: [PATCH] branch,checkout: fix --track documentation Content-Language: en-US To: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= , Josh Steadmon Cc: git@vger.kernel.org, chooglen@google.com, Junio C Hamano References: <9628d145881cb875f8e284967e10f587b9f686f9.1631126999.git.steadmon@google.com> <220111.86a6g3yqf9.gmgdl@evledraar.gmail.com> <55d5327a-9c6c-7fd8-b540-e710259c0694@web.de> <220120.864k5ymx55.gmgdl@evledraar.gmail.com> From: =?utf-8?q?Ren=C3=A9_Scharfe?= In-Reply-To: <220120.864k5ymx55.gmgdl@evledraar.gmail.com> X-Provags-ID: V03:K1:sNEbQa7J4WgRT9Ulahiv6/U3ysUqOfoemTtFqpEeJTk1yiT96nn +6v5W93aQv7nc6J5DUgDPP314OIKvwBmu4akrch1ZMf7JkulZ+aTHlBxxnfsUBvbiV8o37A +SHlt8Kam3xwRXyLx0XyRaJqsYyKwelZbuccWI3k2LdxnFccWA2HBEYgFpLaVlNjPBx/+ZO s7yZTT3hVny3VCa6Zrd/g== X-UI-Out-Filterresults: notjunk:1;V03:K0:q/2nqExjCWI=:U86nxNDSraWndTdkaNms4F douVk/7gTzaC1CSq0cNCSq1AlHjawZ/EBA0ZTllOyfRgx1anmlkQgFOZVfdk9/3/nYPwE12Rt 8BkKiG8cU4k6m7p1AWiYTw/Q1fUCWoZU3oqFBnKHlBXsUisJJ9h5T5rbCTk6HVU6VLv6hV0ln 6+FkNYCDs6lHPiOYxi5/g1r7ygqDeo373R2TtAm2sLjqAFnEqRRTpAR3rHNqIVVX/30clP0Fw Fkpk2GdIarq9VspR3YtwKH99sMN6VLQMOqxXFTxI3lgpCvZtonVD/8FqHSA12365tcpmsKzmV LhPsAdkzoMEfkxXuy8x5bXqnWuAEjvb0V+dtw831o3F+Oj2ByU6ZMxL1pl8ILdMT7zoiwnoLE 5IgegkHWAnxByOQ0b4NQKp7nUfGByoeFQyh8SzbnVM0syhfdBocJ7ZIXgGzniwTtxe5zJwoZo gGqNfu5ijx39zDMPLNkwezr2tB7OZcJyFvlOQQyjSrq2rBa84JQbysIQeA563kASkxnYspEzJ kaDuRdfmJTg71ZZIpcXNW7qANy7lPs+RcAVDhq54ooATHsSck5KLvfde+7hqKCAjGyvJC5xWh LrD6RvMUgZvNE+HtE/tjXoFy7Znj4QQQb2q8q/xhuBl6thZr7BAH8OxpyVQddz6B+x3oRTWrL yQm0hPaT6TTfT9O9ykMW41gwS296UL80OOt+KEKLprhgEBJnXzFi+z2EHFP7fn876nLUCr7e8 a+DC1bGR7RPjW3WujWBS2tjLwur7XlkL59VwhAn4wnrHa+ECtcfB6qbqd5jmFbMRlzXxgRGzE JxPiN+gqGJCLFDQOwGvmO+QCUGaea5/1M2RuMyfntfCNOtcvfZcJyNPb4t8Dbbl16dnq7VPTu UEOmnBd9L4jplgUajXnzFKzMOmxPFhrn4NOqF7eNnAYLBXP3kfOgdmrpeGGpSMPKst+U+9e46 TE0O7M4vNOJwGsKb3zOt5mLyaEdFn3lA5OrzKzqwlqB8K4XnJys5G9kdqKZxDpGAP+Q2agFFs ZRxGqOmo+tWauEDSJsUPrISoq6OnGLcoMXXG4GXj+Bdd0cV+1iXNC5l6954lGfafYEHVyNmH1 FYDUWUppfR4bCY= Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Document that the accepted variants of the --track option are --track, --track=direct, and --track=inherit. The equal sign in the latter two cannot be replaced with whitespace; in general optional arguments need to be attached firmly to their option. Put "direct" consistently before "inherit", if only for the reasons that the former is the default, explained first in the documentation, and comes before the latter alphabetically. Mention both modes in the short help so that readers don't have to look them up in the full documentation. They are literal strings and thus untranslatable. PARSE_OPT_LITERAL_ARGHELP is inferred due to the pipe and parenthesis characters, so we don't have to provide that flag explicitly. Mention that -t has the same effect as --track and --track=direct. There is no way to specify inherit mode using the short option, because short options generally don't accept optional arguments. Signed-off-by: René Scharfe --- Documentation/git-branch.txt | 12 ++++++------ Documentation/git-checkout.txt | 2 +- builtin/branch.c | 2 +- builtin/checkout.c | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) -- 2.34.1 diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt index 2d52ae396b..731e340cbc 100644 --- a/Documentation/git-branch.txt +++ b/Documentation/git-branch.txt @@ -16,7 +16,7 @@ SYNOPSIS [--points-at ] [--format=] [(-r | --remotes) | (-a | --all)] [--list] [...] -'git branch' [--track [direct|inherit] | --no-track] [-f] [] +'git branch' [--track[=(direct|inherit)] | --no-track] [-f] [] 'git branch' (--set-upstream-to= | -u ) [] 'git branch' --unset-upstream [] 'git branch' (-m | -M) [] @@ -206,7 +206,7 @@ This option is only applicable in non-verbose mode. Display the full sha1s in the output listing rather than abbreviating them. -t:: ---track [inherit|direct]:: +--track[=(direct|inherit)]:: When creating a new branch, set up `branch..remote` and `branch..merge` configuration entries to set "upstream" tracking configuration for the new branch. This @@ -216,11 +216,11 @@ This option is only applicable in non-verbose mode. upstream when the new branch is checked out. + The exact upstream branch is chosen depending on the optional argument: -`--track` or `--track direct` means to use the start-point branch itself as the -upstream; `--track inherit` means to copy the upstream configuration of the -start-point branch. +`-t`, `--track`, or `--track=direct` means to use the start-point branch +itself as the upstream; `--track=inherit` means to copy the upstream +configuration of the start-point branch. + -`--track direct` is the default when the start point is a remote-tracking branch. +`--track=direct` is the default when the start point is a remote-tracking branch. Set the branch.autoSetupMerge configuration variable to `false` if you want `git switch`, `git checkout` and `git branch` to always behave as if `--no-track` were given. Set it to `always` if you want this behavior when the diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index 2a90ea6cd0..9f37e22e13 100644 --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@ -156,7 +156,7 @@ of it"). linkgit:git-branch[1] for details. -t:: ---track [direct|inherit]:: +--track[=(direct|inherit)]:: When creating a new branch, set up "upstream" configuration. See "--track" in linkgit:git-branch[1] for details. + diff --git a/builtin/branch.c b/builtin/branch.c index 0c8d8a8827..4ce2a24754 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -638,7 +638,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix) OPT__VERBOSE(&filter.verbose, N_("show hash and subject, give twice for upstream branch")), OPT__QUIET(&quiet, N_("suppress informational messages")), - OPT_CALLBACK_F('t', "track", &track, N_("mode"), + OPT_CALLBACK_F('t', "track", &track, "(direct|inherit)", N_("set branch tracking configuration"), PARSE_OPT_OPTARG, parse_opt_tracking_mode), diff --git a/builtin/checkout.c b/builtin/checkout.c index 6a5dd2a2a2..0bc2e63510 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -1549,7 +1549,7 @@ static struct option *add_common_switch_branch_options( { struct option options[] = { OPT_BOOL('d', "detach", &opts->force_detach, N_("detach HEAD at named commit")), - OPT_CALLBACK_F('t', "track", &opts->track, N_("mode"), + OPT_CALLBACK_F('t', "track", &opts->track, "(direct|inherit)", N_("set branch tracking configuration"), PARSE_OPT_OPTARG, parse_opt_tracking_mode),