summaryrefslogtreecommitdiff
path: root/http-push.c
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2009-11-09 04:47:34 -0600
committerJunio C Hamano <gitster@pobox.com>2009-11-10 11:59:51 -0800
commit548d3464dc446db58a8fc8f7a8cc6cfb2d683faa (patch)
treeca41163c421bac78146a8fc6a63e9ae6065cb698 /http-push.c
parent616f86d71325da1ce692f8e878fe066758f88554 (diff)
downloadgit-548d3464dc446db58a8fc8f7a8cc6cfb2d683faa.tar.gz
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: Jonathan Nieder <jrnieder@gmail.com> Acked-by: Tay Ray Chuan <rctay89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http-push.c')
-rw-r--r--http-push.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/http-push.c b/http-push.c
index 00e83dcec1..ad1a6c9096 100644
--- a/http-push.c
+++ b/http-push.c
@@ -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);
/*