google / copybara

Copybara: A tool for transforming and moving code between repositories.
Apache License 2.0
2.13k stars 258 forks source link

Reuse existing local git repos rather than each run performing a git clone #250

Closed yang closed 1 year ago

yang commented 1 year ago

Currently, each run of copybara performs a fresh initialization of local repos (for both origin and destination). For large git repos, this takes quite a while.

Is it possible to reuse existing local git repos?

yang commented 1 year ago

My own workaround (not sure if this is the best approach).

If you don't need to work with GitHub PRs or Gerrit CRs, then you can just point to an existing local repo by using file:///.... instead of the original repo URL.

You can probably do this with both origins and destinations—for destinations, you would then need to push the changes back to the original URL yourself after the Copybara run.

vonbirdie commented 4 months ago

@yang I'm guessing that you specified an absolute path using file:///....?

I've been attempting to use a relative path (the current directory) but based on the error messages I'm seeing I'm guessing that Copybara runs in a different directory and using a relative path from that will be difficult if the destination repo is cloned into different locations.