]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin-fetch.c
Merge branch 'maint-1.6.6' into maint
[thirdparty/git.git] / builtin-fetch.c
index 0acf80991b57226d44305fd51f2c32544130dc91..007dabf62f2574fc9214d6fb2a961619ad305a6b 100644 (file)
 #include "sigchain.h"
 
 static const char * const builtin_fetch_usage[] = {
-       "git fetch [options] [<repository> <refspec>...]",
-       "git fetch [options] <group>",
-       "git fetch --multiple [options] [<repository> | <group>]...",
-       "git fetch --all [options]",
+       "git fetch [<options>] [<repository> [<refspec>...]]",
+       "git fetch [<options>] <group>",
+       "git fetch --multiple [<options>] [<repository> | <group>]...",
+       "git fetch --all [<options>]",
        NULL
 };
 
@@ -104,10 +104,8 @@ static void add_merge_config(struct ref **head,
                 * there is no entry in the resulting FETCH_HEAD marked
                 * for merging.
                 */
+               memset(&refspec, 0, sizeof(refspec));
                refspec.src = branch->merge[i]->src;
-               refspec.dst = NULL;
-               refspec.pattern = 0;
-               refspec.force = 0;
                get_fetch_map(remote_refs, &refspec, tail, 1);
                for (rm = *old_tail; rm; rm = rm->next)
                        rm->merge = 1;
@@ -389,9 +387,10 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
                                fputc(url[i], fp);
                fputc('\n', fp);
 
-               if (ref)
+               if (ref) {
                        rc |= update_local_ref(ref, what, note);
-               else
+                       free(ref);
+               } else
                        sprintf(note, "* %-*s %-*s -> FETCH_HEAD",
                                SUMMARY_WIDTH, *kind ? kind : "branch",
                                 REFCOL_WIDTH, *what ? what : "HEAD");