X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin%2Ffetch.c;h=8470850415c14cad8ceeca9f6baef46ab6feabc3;hb=7a0d54facd476a9197f405d2cc65d4bc73e3f1a6;hp=b6c5b344be8e8abb90cf3f03d3cea2600511787f;hpb=e25ccff14071ec3628153992acc82b9922e16938;p=git.git diff --git a/builtin/fetch.c b/builtin/fetch.c index b6c5b344b..847085041 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -14,10 +14,10 @@ #include "transport.h" static const char * const builtin_fetch_usage[] = { - "git fetch [options] [ ...]", - "git fetch [options] ", - "git fetch --multiple [options] [ | ]...", - "git fetch --all [options]", + "git fetch [] [ [...]]", + "git fetch [] ", + "git fetch --multiple [] [ | ]...", + "git fetch --all []", NULL }; @@ -28,6 +28,7 @@ enum { }; static int all, append, dry_run, force, keep, multiple, prune, update_head_ok, verbosity; +static int progress; static int tags = TAGS_DEFAULT; static const char *depth; static const char *upload_pack; @@ -57,6 +58,7 @@ static struct option builtin_fetch_options[] = { OPT_BOOLEAN('k', "keep", &keep, "keep downloaded pack"), OPT_BOOLEAN('u', "update-head-ok", &update_head_ok, "allow updating of HEAD ref"), + OPT_BOOLEAN(0, "progress", &progress, "force progress reporting"), OPT_STRING(0, "depth", &depth, "DEPTH", "deepen history of shallow clone"), OPT_END() @@ -105,10 +107,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 +389,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", TRANSPORT_SUMMARY_WIDTH, *kind ? kind : "branch", REFCOL_WIDTH, *what ? what : "HEAD"); @@ -588,7 +589,7 @@ static void find_non_local_tags(struct transport *transport, * to fetch then we can mark the ref entry in the list * as one to ignore by setting util to NULL. */ - if (!strcmp(ref->name + strlen(ref->name) - 3, "^{}")) { + if (!suffixcmp(ref->name, "^{}")) { if (item && !has_sha1_file(ref->old_sha1) && !will_fetch(head, ref->old_sha1) && !has_sha1_file(item->util) && @@ -845,10 +846,7 @@ static int fetch_one(struct remote *remote, int argc, const char **argv) die("Where do you want to fetch from today?"); transport = transport_get(remote, NULL); - if (verbosity >= 2) - transport->verbose = verbosity <= 3 ? verbosity : 3; - if (verbosity < 0) - transport->verbose = -1; + transport_set_verbosity(transport, verbosity, progress); if (upload_pack) set_option(TRANS_OPT_UPLOADPACK, upload_pack); if (keep)