summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1a507b9)
raw | patch | inline | side by side (parent: 1a507b9)
author | Jonathan Nieder <jrnieder@gmail.com> | |
Mon, 9 Nov 2009 15:04:59 +0000 (09:04 -0600) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 10 Nov 2009 19:11:21 +0000 (11:11 -0800) |
Delay search for a git directory until option parsing has finished.
None of the functions used in option parsing look for or read any
files other than stdin, so this is safe.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
None of the functions used in option parsing look for or read any
files other than stdin, so this is safe.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http-fetch.c | patch | blob | history |
diff --git a/http-fetch.c b/http-fetch.c
index 88f7dc8845face548d973e46c9da052b057ea778..ffd0ad7e295d7341776bb7b6407602cdb2997ef3 100644 (file)
--- a/http-fetch.c
+++ b/http-fetch.c
#include "exec_cmd.h"
#include "walker.h"
+static const char http_fetch_usage[] = "git http-fetch "
+"[-c] [-t] [-a] [-v] [--recover] [-w ref] [--stdin] commit-id url";
+
int main(int argc, const char **argv)
{
const char *prefix;
int get_recover = 0;
git_extract_argv0_path(argv[0]);
- prefix = setup_git_directory();
- git_config(git_default_config, NULL);
while (arg < argc && argv[arg][0] == '-') {
if (argv[arg][1] == 't') {
} else if (argv[arg][1] == 'w') {
write_ref = &argv[arg + 1];
arg++;
+ } else if (argv[arg][1] == 'h') {
+ usage(http_fetch_usage);
} else if (!strcmp(argv[arg], "--recover")) {
get_recover = 1;
} else if (!strcmp(argv[arg], "--stdin")) {
}
arg++;
}
- if (argc < arg + 2 - commits_on_stdin) {
- usage("git http-fetch [-c] [-t] [-a] [-v] [--recover] [-w ref] [--stdin] commit-id url");
- return 1;
- }
+ if (argc != arg + 2 - commits_on_stdin)
+ usage(http_fetch_usage);
if (commits_on_stdin) {
commits = walker_targets_stdin(&commit_id, &write_ref);
} else {
commits = 1;
}
url = argv[arg];
+
+ prefix = setup_git_directory();
+
+ git_config(git_default_config, NULL);
+
if (url && url[strlen(url)-1] != '/') {
rewritten_url = xmalloc(strlen(url)+2);
strcpy(rewritten_url, url);