subcmds/sync: Use pack-refs instead of gc for redundant gitdirs.
subcmds/sync: Use pack-refs instead of gc for redundant gitdirs.

Previously `git gc` was being run on every gitdir even when they shared
the same objects. Instead only call it once and use pack-refs for the
gitdirs that were not gc'ed.

Bug: https://crbug.com/gerrit/15113
Test: repo sync -j # and check that git pack-refs is called
Change-Id: Icff37ab3ec78cfb44391d8cc7f2d875991532320
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/320275
Tested-by: Allen Webb <880184b418addffb87cd9c8e8e882ca6764ac96b@google.com>
Reviewed-by: Mike Frysinger <8f3f75c74bd5184edcfa6534cab3c13a00a2f794@google.com>

couchbasedeps/git-repo,lewixliu/git-repo,couchbasedeps/git-repo,GerritCodeReview/git-repo,GerritCodeReview/git-repo,lewixliu/git-repo