-
Notifications
You must be signed in to change notification settings - Fork 1k
Conversation
For private repositories and git over ssh repositories implementation of dep was different from `go get`. Examples: go get example.com/repo.git Will use remote (scheme)://example.com/repo The most important part that suffix .git tells go get to access the path as git, but it drops the suffix to actually access the remote. Go get will clone this repo as git clone git+ssh://example.com/repo $GOPATH/src/example.com/repo.git It is very unfortunate that you will end up with .git suffixes but at least it works, this is the only way to make `go get` to recognize this import as git. But in case of dep import "example.com/repo.git" Will result for dep to try to access remote as (scheme)://example.com/repo.git Which makes it impossible to teach go get to work with dep. This change is making consistent behavior between *go get* and *dep* by always dropping suffix *.git* for remotes (which is also not ideal, but at least it works now with *go dep*). Other changes related to the schemas, I made the order match to the default schemes in *go get*
Thanks for your pull request. t looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
1 similar comment
Thanks for your pull request. t looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
I signed it! |
CLAs look good, thanks! |
1 similar comment
CLAs look good, thanks! |
@sdboyer curious, did you have a chance to look into this? Just want to know if this is something that can be considered to be merged? I definitely do not want to maintain my own fork of Also I am happy to iterate, add more explanations if needed, docs for how to work with private repos, etc. |
IMO being required to update the import to have a |
Could you explain why? Unfortunately So in my PR the only thing I do just trying to make
Not sure I understand the proposal, could you explain on example? |
Reason being when you develop multiple projects, your
Let's imagine project2 depends on project1, and you've made a change in projet1. If you have the Not having the git suffix means go will simply pick up your project1 without having to push or running dep every time you push. Having this PR merged is certainly better than nothing, but this issue needs to be addressed correctly. Glide for example manages this correctly. As for the proposal, I've not looked at how dep works internally, however, from what I've observed is that it's sees the
is the same as
Then we resolve stuff, we only care about the source attribute. Finally, once the source location has been resolved, we can check it out in |
In your scenario you will need to change folder names to be
At the beginning, and in that case everything else will work. The main reason why you need Also with the scheme
And if project2 depends on project1 you don't have a way to make With this change the workflow for your example will be:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry it's taken me so long to respond - most of my dep time for the past few months has been occupied by rebutting vgo.
The main issue that i'm concerned about with this is how it would interact with the logic in the sourceCoordinator
. The on-disk path they're cloned into is derived from the URL, meaning that both the suffixed and unsuffixed paths would end up using the same clone on disk.
On balance, that's a good thing, but we'd have to make sure that there's only one object in memory for that repository, independent of which path we take. i believe we have checking in place that should result in them folding together, but we'll need a test that makes sure of it. You could probably extend TestSourceCreationCounts
to this end.
@@ -73,7 +73,7 @@ var ( | |||
//gcRegex = regexp.MustCompile(`^(?P<root>code\.google\.com/[pr]/(?P<project>[a-z0-9\-]+)(\.(?P<subrepo>[a-z0-9\-]+))?)(/[A-Za-z0-9_.\-]+)*$`) | |||
jazzRegex = regexp.MustCompile(`^(?P<root>hub\.jazz\.net(/git/[a-z0-9]+/[A-Za-z0-9_.\-]+))((?:/[A-Za-z0-9_.\-]+)*)$`) | |||
apacheRegex = regexp.MustCompile(`^(?P<root>git\.apache\.org(/[a-z0-9_.\-]+\.git))((?:/[A-Za-z0-9_.\-]+)*)$`) | |||
vcsExtensionRegex = regexp.MustCompile(`^(?P<root>([a-z0-9.\-]+\.)+[a-z0-9.\-]+(:[0-9]+)?/[A-Za-z0-9_.\-/~]*?\.(?P<vcs>bzr|git|hg|svn))((?:/[A-Za-z0-9_.\-]+)*)$`) | |||
vcsExtensionRegex = regexp.MustCompile(`^(?P<root>(?P<repo>([a-z0-9.\-]+\.)+[a-z0-9.\-]+(:[0-9]+)?(/~?[A-Za-z0-9_.\-]+)+?)\.(?P<vcs>bzr|fossil|git|hg|svn))(/~?[A-Za-z0-9_.\-]+)*$`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't actually support fossil - not sure there's much point in adding it.
Considering the current state of dep and vgo, I assume we can just close (abandon) this PR Please just make sure that this will be well covered in vgo ;) Thank you! |
Sorry, but i'm not contributing my time voluntarily to vgo, as i believe it is fundamentally the wrong direction. i'll keep this in mind with the successor tool to dep. |
(note that this should not be an issue in vgo, as it uses none of our code. i'm also pretty sure that the concern i raised above is something we handle automatically, so incorporating this should be pretty easy.) |
For private repositories and git over ssh repositories implementation of
dep was different from
go get
.Examples:
Will use remote
The most important part that suffix .git tells go get to access the path
as git, but it drops the suffix to actually access the remote.
Go get will clone this repo as
It is very unfortunate that you will end up with .git suffixes but at least it
works, this is the only way to make
go get
to recognize this import asgit.
But in case of dep
Will result for dep to try to access remote as
Which makes it impossible to teach go get to work with dep.
This change is making consistent behavior between go get and dep by
always dropping suffix .git for remotes (which is also not ideal, but
at least it works now with go dep).
Other changes related to the schemas, I made the order match to the
default schemes in go get (this one I reverted, as there are a lot of tests failed)
What does this do / why do we need it?
After fixing this issue I believe
go get
anddep
will have good working solution for private git repos (as many people complain in other tickets that it does not work).If you have your own private git repository available on
git+ssh://example.com/repo
you will be able to reference it in the go source likeThat will clone the
git+ssh://example.com/repo
under$GOPATH/src/example.com/repo.git
, where suffix.git
is not ideal, but at least it works.And after that you will be able to run
dep init
anddep ensure
which also behave similarly togo get
by cloningexample.com/repo.git
from remote(scheme)://example.com/repo
in pathvendor/example.com/repo.git
What should your reviewer look out for in this PR?
go get
as well vcs.go#L48-L54go get
to load vcs path and scheme vcs.go#L1019-L1022go get
handles this regex to resolve the remote, see vcs.go#L683-L751Do you need help or clarification on anything?
Which issue(s) does this PR fix?
fixes #1716
fixes #174 (maybe?)