Junio C Hamano <gitster@xxxxxxxxx> writes: >> The +1 fetch is redundant, so it's probably good to get rid of it >> anyway. Another thing I noticed is that this +1 is *not* limited to "--all". If you give a group that expands to multiple remotes, you'd take the same fetch_multiple() code path (that is why the "single liner" patch in the message I am responding to looks at the "is remote set?", which is the same condition that decides if we use fetch_one() or fetch_multiple()). I also notice that there is a strange "optimzation" that is used after expanding a group into one or more remotes and when it turns out it was a group of one. In such a case (and only in such a case), we set "remote" and bypass the code path that uses &list. I wonder if this "optimization" should be also used for "--all". builtin/fetch.c | 3 +++ 1 file changed, 3 insertions(+) diff --git c/builtin/fetch.c w/builtin/fetch.c index e3791f09ed..9093455e81 100644 --- c/builtin/fetch.c +++ w/builtin/fetch.c @@ -2187,6 +2187,9 @@ int cmd_fetch(int argc, const char **argv, const char *prefix) else if (argc > 1) die(_("fetch --all does not make sense with refspecs")); (void) for_each_remote(get_one_remote_for_fetch, &list); + /* no point doing fetch_multiple() of one */ + if (list.nr == 1) + remote = remote_get(list.items[0].string); } else if (argc == 0) { /* No arguments -- use default remote */ remote = remote_get(NULL);