diff options
| -rw-r--r-- | builtin/remote.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/builtin/remote.c b/builtin/remote.c index 0d6755bcb7..b6808bb28b 100644 --- a/builtin/remote.c +++ b/builtin/remote.c @@ -1457,10 +1457,13 @@ static int set_head(int argc, const char **argv, const char *prefix, }; argc = parse_options(argc, argv, prefix, options, builtin_remote_sethead_usage, 0); - if (argc) { - strbuf_addf(&b_head, "refs/remotes/%s/HEAD", argv[0]); - remote = remote_get(argv[0]); - } + + /* All modes require at least a remote name. */ + if (!argc) + usage_with_options(builtin_remote_sethead_usage, options); + + strbuf_addf(&b_head, "refs/remotes/%s/HEAD", argv[0]); + remote = remote_get(argv[0]); if (!opt_a && !opt_d && argc == 2) { head_name = xstrdup(argv[1]); |
