factor out common code from git/dir loader
specifically, the batching/transfer logic is largely the same
Migrated from T117 (view on Phabricator)
specifically, the batching/transfer logic is largely the same
Migrated from T117 (view on Phabricator)