constabulary / gb

gb, the project based build tool for Go
https://getgb.io/
MIT License
2.15k stars 148 forks source link

"clone" mode for gb-vendor #316

Open vstarodub opened 9 years ago

vstarodub commented 9 years ago

It would be convenient to be able to optionally clone vendored paths as proper repositories.

Use scenario: I've got project repo and a shared repo. I'm developing a feature in the project repo and need to add some supporting code to the shared repo. I want able to write/test/commit the supporting code inside the "vendor/" dir.

Currently with gb, it looks like I've got following options: 1) Manually copy changed files to a separately cloned repo to be able to commit them. This is quite tedious. 2) Don't use gb-vendor for the shared repo. Clone a repo into the vendor dir. This essentially means using two separate vendoring mechanisms, e.g. using git submodule in addition to gb. It might also conflict with 'gb-vendor' fetches of other repositories.

I suggest adding something like '-clone' option for 'gb-vendor fetch', that would get registered in the manifest. The repository would simply get cloned. In case of an update, simply failing if the vendored repository is not clean seems ok.

Since gb-vendor is already doing the job of cloning a repo and branch tracking, it might be quite easy to implement.

davecheney commented 9 years ago

All the logic is there in the manifest format to implement this. It's on the backlog, but not near the tip. If you want to tackle it, I'd welcome the assistance.

On Fri, 21 Aug 2015 22:55 Victor Starodub notifications@github.com wrote:

It would be convenient to be able to optionally clone vendored paths as proper repositories.

Use scenario: I've got project repo and a shared repo. I'm developing a feature in the project repo and need to add some supporting code to the shared repo. I want able to write/test/commit the supporting code inside the "vendor/" dir.

Currently with gb, it looks like I've got following options: 1) Manually copy changed files to a separately cloned repo to be able to commit them. This is quite tedious. 2) Don't use gb-vendor for the shared repo. Clone a repo into the vendor dir. This essentially means using two separate vendoring mechanisms, e.g. using git submodule in addition to gb. It might also conflict with 'gb-vendor' fetches of other repositories.

I suggest adding something like '-clone' option for 'gb-vendor fetch', that would get registered in the manifest. The repository would simply get cloned. In case of an update, simply failing if the vendored repository is not clean seems ok.

Since gb-vendor is already doing the job of cloning a repo and branch tracking, it might be quite easy to implement.

— Reply to this email directly or view it on GitHub https://github.com/constabulary/gb/issues/316.

vstarodub commented 9 years ago

Sure, I'll give it a try.

davecheney commented 9 years ago

The trick is to use the prefix field of the manifest to strip out the import path prefix that TV projects have.

On 21 Aug 2015, at 23:34, Victor Starodub notifications@github.com wrote:

Sure, I'll give it a try.

— Reply to this email directly or view it on GitHub.

davidkaya commented 9 years ago

@davecheney Hey! I am back (after a looong time)! I can implement this, but I didn't quite get the "prefix" that you are talking about Dave.