Page MenuHomePhabricator

Always initialize Git repositories with "git init", never with "git clone"
ClosedPublic

Authored by epriestley on Fri, Nov 8, 12:07 AM.

Details

Summary

Fixes T13448. We currently "git clone" to initialize repositories, but this will fetch too many refs if "Fetch Refs" is configured.

In modern Phabricator, there's no apparent reason to "git clone"; we can just "git init" instead. This workflow naturally falls through to an update, where we'll do a "git fetch" and pull in exactly the refs we want.

Test Plan
  • Configured an observed repository with "Fetch Refs".
  • Destroyed the working copy.
  • Ran "bin/repository pull X --trace --verbose".
    • Before: saw "git clone" pull in the world.
    • After: saw "git init" create a bare empty working copy, then "git fetch" fill it surgically.

Both flows end up in the same place, this one is just simpler and does less work.

Diff Detail

Repository
rP Phabricator
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

epriestley created this revision.Fri, Nov 8, 12:07 AM
epriestley requested review of this revision.Fri, Nov 8, 12:09 AM
This revision was not accepted when it landed; it landed in state Needs Review.Fri, Nov 8, 12:17 AM
This revision was automatically updated to reflect the committed changes.