merge-recursive: Fix code checking for D/F conflicts still being present
[gitweb.git] / http-fetch.c
index 762c750d7af3651287c147034d3dead469453e7c..3af4c71bd0fb8370c6f08b0e3d43adc722cac2f4 100644 (file)
@@ -8,14 +8,12 @@ static const char http_fetch_usage[] = "git http-fetch "
 
 int main(int argc, const char **argv)
 {
-       const char *prefix;
        struct walker *walker;
        int commits_on_stdin = 0;
        int commits;
        const char **write_ref = NULL;
        char **commit_id;
-       const char *url;
-       char *rewritten_url = NULL;
+       char *url = NULL;
        int arg = 1;
        int rc = 0;
        int get_tree = 0;
@@ -57,18 +55,13 @@ int main(int argc, const char **argv)
                commit_id = (char **) &argv[arg++];
                commits = 1;
        }
-       url = argv[arg];
 
-       prefix = setup_git_directory();
+       if (argv[arg])
+               str_end_url_with_slash(argv[arg], &url);
 
-       git_config(git_default_config, NULL);
+       setup_git_directory();
 
-       if (url && url[strlen(url)-1] != '/') {
-               rewritten_url = xmalloc(strlen(url)+2);
-               strcpy(rewritten_url, url);
-               strcat(rewritten_url, "/");
-               url = rewritten_url;
-       }
+       git_config(git_default_config, NULL);
 
        http_init(NULL);
        walker = get_http_walker(url);
@@ -93,7 +86,7 @@ int main(int argc, const char **argv)
        walker_free(walker);
        http_cleanup();
 
-       free(rewritten_url);
+       free(url);
 
        return rc;
 }