Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2022-03-04 01:25:16 +0300
committerJunio C Hamano <gitster@pobox.com>2022-03-04 01:44:04 +0300
commitc6dddb34b57d85cc57f2efae98aed2b2539e7acd (patch)
tree09f42fed15273ad5cea2f8fb8e0df0a51a8dae28 /builtin/remote.c
parent715d08a9e51251ad8290b181b6ac3b9e1f9719d7 (diff)
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 <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/remote.c')
-rw-r--r--builtin/remote.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/builtin/remote.c b/builtin/remote.c
index 6f27ddc47b..824fb8099c 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -684,11 +684,14 @@ static int mv(int argc, const char **argv)
struct rename_info rename;
int i, refspec_updated = 0;
- if (argc != 3)
+ argc = parse_options(argc, argv, NULL, options,
+ builtin_remote_rename_usage, 0);
+
+ if (argc != 2)
usage_with_options(builtin_remote_rename_usage, options);
- rename.old_name = argv[1];
- rename.new_name = argv[2];
+ rename.old_name = argv[0];
+ rename.new_name = argv[1];
rename.remote_branches = &remote_branches;
oldremote = remote_get(rename.old_name);