提交 548d3464 编写于 作者: J Jonathan Nieder 提交者: Junio C Hamano

Show usage string for 'git http-push -h'

http-push already knows how to dump usage if it is given no options, but
it interprets '-h' as the URL to a remote repository:

    $ git http-push -h
    error: Cannot access URL -h/, return code 6

Dump usage instead.  Humans wanting to pass the URL -h/ to curl for some
reason can use 'git http-push -h/' explicitly.  Scripts expecting to
access an HTTP repository at URL '-h' will break, though.

Also delay finding a git directory until after option parsing, so
"http-push -h" can be used outside any git repository.
Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
Acked-by: NTay Ray Chuan <rctay89@gmail.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 616f86d7
......@@ -1792,8 +1792,6 @@ int main(int argc, char **argv)
git_extract_argv0_path(argv[0]);
setup_git_directory();
repo = xcalloc(sizeof(*repo), 1);
argv++;
......@@ -1827,6 +1825,8 @@ int main(int argc, char **argv)
force_delete = 1;
continue;
}
if (!strcmp(arg, "-h"))
usage(http_push_usage);
}
if (!repo->url) {
char *path = strstr(arg, "//");
......@@ -1854,6 +1854,8 @@ int main(int argc, char **argv)
if (delete_branch && nr_refspec != 1)
die("You must specify only one branch name when deleting a remote branch");
setup_git_directory();
memset(remote_dir_exists, -1, 256);
/*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册