Skip to content

Commit c6dddb3

Browse files
ttaylorrgitster
authored andcommitted
builtin/remote.c: parse options in 'rename'
The 'git remote rename' command doesn't currently take any command-line arguments besides the existing and new name of a remote, and so has no need to call parse_options(). But the subsequent patch will add a `--[no-]progress` option, in which case we will need to call parse_options(). Do so now so as to avoid cluttering the following patch with noise, like adjusting setting `rename.{old,new}_name` to argv[0] and argv[1], since parse_options handles advancing argv past the name of the sub-command. Signed-off-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 715d08a commit c6dddb3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

builtin/remote.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -684,11 +684,14 @@ static int mv(int argc, const char **argv)
684684
struct rename_info rename;
685685
int i, refspec_updated = 0;
686686

687-
if (argc != 3)
687+
argc = parse_options(argc, argv, NULL, options,
688+
builtin_remote_rename_usage, 0);
689+
690+
if (argc != 2)
688691
usage_with_options(builtin_remote_rename_usage, options);
689692

690-
rename.old_name = argv[1];
691-
rename.new_name = argv[2];
693+
rename.old_name = argv[0];
694+
rename.new_name = argv[1];
692695
rename.remote_branches = &remote_branches;
693696

694697
oldremote = remote_get(rename.old_name);

0 commit comments

Comments
 (0)