X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-remote.c;h=8b63619ef08a2ac3d96000908fe4986396ddd6a2;hb=c7ea453618e41e05a06f05e3ab63d555d0ddd7d9;hp=8fe31dbd9af2833f4dc6c3e93b9179f20d2a1d66;hpb=24b6177e0261efba063c0b83ae0cdc5993945da9;p=git.git diff --git a/builtin-remote.c b/builtin-remote.c index 8fe31dbd9..8b63619ef 100644 --- a/builtin-remote.c +++ b/builtin-remote.c @@ -19,6 +19,8 @@ static const char * const builtin_remote_usage[] = { static int verbose; +static int show_all(void); + static inline int postfixcmp(const char *string, const char *postfix) { int len1 = strlen(string), len2 = strlen(postfix); @@ -105,6 +107,7 @@ static int add(int argc, const char **argv) struct path_list_item *item = track.items + i; strbuf_reset(&buf2); + strbuf_addch(&buf2, '+'); if (mirror) strbuf_addf(&buf2, "refs/%s:refs/%s", item->path, item->path); @@ -115,6 +118,13 @@ static int add(int argc, const char **argv) return 1; } + if (mirror) { + strbuf_reset(&buf); + strbuf_addf(&buf, "remote.%s.mirror", name); + if (git_config_set(buf.buf, "yes")) + return 1; + } + if (fetch && fetch_remote(name)) return 1; @@ -384,8 +394,11 @@ static int show_or_prune(int argc, const char **argv, int prune) argc = parse_options(argc, argv, options, builtin_remote_usage, 0); - if (argc < 1) + if (argc < 1) { + if (!prune) + return show_all(); usage_with_options(builtin_remote_usage, options); + } memset(&states, 0, sizeof(states)); for (; argc; argc--, argv++) {