buildinspace / peru

a generic package manager, for including other people's code in your projects
MIT License
1.11k stars 69 forks source link

Implement git worktree plugin #203

Closed iilyak closed 5 years ago

iilyak commented 5 years ago

With git worktree it is possible to checkout different branches into different directories of a project. It is very useful when working with gh-pages branch for example. The gh-pages branch can be checked out into docs directory for example. It would be great if peru would have worktree plugin (or support the feature in git plugin). In this case every developer on the team wouldn't have to run git worktree add docs gh-pages every time they do a fresh clone.

oconnor663 commented 5 years ago

Have you considered adding the same git module to peru.yaml twice, with different revisions and import paths for each instance? You could set the reup field on one of the modules to make sure that peru reup looks to some particular branch to update it.

iilyak commented 5 years ago

Thank you. I'll try that. Feel free to close the issue.

oconnor663 commented 5 years ago

Closing for now, but let me know what you find.

I don't know much about the worktree feature, but it seems like it doesn't encode any information about which commit from the target branch should correspond to a given commit from master. Hopefully the "just add the same repo twice" approach is able to solve similar problems while also helping you keep a stable set of revisions for everything.