Merge branch 'sp/maint-index-pack' into maint
[gitweb.git] / builtin-fetch-pack.c
index 65350ca52240bad95c1632ae604d66279d9a8997..6e98cafd08ca9fb09d4f860878691db9ec4999ba 100644 (file)
@@ -117,15 +117,15 @@ static const unsigned char* get_rev(void)
 
        while (commit == NULL) {
                unsigned int mark;
-               struct commit_list *parents = NULL;
+               struct commit_list *parents;
 
                if (rev_list == NULL || non_common_revs == 0)
                        return NULL;
 
                commit = rev_list->item;
-               if (!(commit->object.parsed))
-                       if (!parse_commit(commit))
-                               parents = commit->parents;
+               if (!commit->object.parsed)
+                       parse_commit(commit);
+               parents = commit->parents;
 
                commit->object.flags |= POPPED;
                if (!(commit->object.flags & COMMON))
@@ -309,7 +309,8 @@ static int find_common(int fd[2], unsigned char *result_sha1,
                }
                flushes--;
        }
-       return retval;
+       /* it is no error to fetch into a completely empty repo */
+       return count ? retval : 0;
 }
 
 static struct commit_list *complete;
@@ -635,7 +636,7 @@ static int remove_duplicates(int nr_heads, char **heads)
        return dst;
 }
 
-static int fetch_pack_config(const char *var, const char *value)
+static int fetch_pack_config(const char *var, const char *value, void *cb)
 {
        if (strcmp(var, "fetch.unpacklimit") == 0) {
                fetch_unpack_limit = git_config_int(var, value);
@@ -647,7 +648,7 @@ static int fetch_pack_config(const char *var, const char *value)
                return 0;
        }
 
-       return git_default_config(var, value);
+       return git_default_config(var, value, cb);
 }
 
 static struct lock_file lock;
@@ -657,7 +658,7 @@ static void fetch_pack_setup(void)
        static int did_setup;
        if (did_setup)
                return;
-       git_config(fetch_pack_config);
+       git_config(fetch_pack_config, NULL);
        if (0 <= transfer_unpack_limit)
                unpack_limit = transfer_unpack_limit;
        else if (0 <= fetch_unpack_limit)