From: Glen Choo Date: Tue, 23 Nov 2021 18:42:21 GMT Subject: Re: [PATCH 3/4] branch: add --dry-run option to branch Message-ID: In-Reply-To: <211123.86zgpvup6m.gmgdl@evledraar.gmail.com> Ævar Arnfjörð Bjarmason writes: > On Mon, Nov 22 2021, Glen Choo wrote: > >> Add a --dry-run option to branch creation that can check whether or not >> a branch name and start point would be valid for a repository without >> creating a branch. Refactor cmd_branch() to make the chosen action more >> obvious. >> [...] >> -'git branch' [--track | --no-track] [-f] [] >> +'git branch' [--track | --no-track] [-f] [--dry-run | -n] [] >> 'git branch' (--set-upstream-to= | -u ) [] >> 'git branch' --unset-upstream [] >> 'git branch' (-m | -M) [] >> @@ -205,6 +205,12 @@ This option is only applicable in non-verbose mode. >> --no-abbrev:: >> Display the full sha1s in the output listing rather than abbreviating them. >> >> +-n:: >> +--dry-run:: >> + Can only be used when creating a branch. If the branch creation >> + would fail, show the relevant error message. If the branch >> + creation would succeed, show nothing. >> + > > The usage & test show that we've got --dry-run for branch creation, but > not the "creation" we do on --copy or --move. Perhaps this is more of a wording issue i.e. 'creating a branch' is too unspecific. Maybe Can only be used when creating a new branch (without copying or moving an existing branch). If the branch creation would fail, show the relevant error message. If the branch creation would succeed, show nothing. > In any case, any reason to leave those out? No long term reason. I left those out because "create brand new branch with --dry-run" was needed right now, but the others are not. For consistency, we'd want --dry-run for all other actions, including copy, move, delete, etc.