Thread (92 messages) 92 messages, 5 authors, 2022-02-04

Re: [PATCH 3/4] branch: add --dry-run option to branch

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2021-11-23 10:44:22

On Mon, Nov 22 2021, Glen Choo wrote:
quoted hunk ↗ jump to hunk
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] <branchname> [<start-point>]
+'git branch' [--track | --no-track] [-f] [--dry-run | -n] <branchname> [<start-point>]
 'git branch' (--set-upstream-to=<upstream> | -u <upstream>) [<branchname>]
 'git branch' --unset-upstream [<branchname>]
 'git branch' (-m | -M) [<oldbranch>] <newbranch>
@@ -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.

The former is just a "create from source", but "move" maybe not.

In any case, any reason to leave those out?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help