Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some kind of transforms for "ghq.<url>." #86

Closed
thomasf opened this issue Aug 30, 2017 · 5 comments
Closed

Add some kind of transforms for "ghq.<url>." #86

thomasf opened this issue Aug 30, 2017 · 5 comments

Comments

@thomasf
Copy link

thomasf commented Aug 30, 2017

Instead of doing this:

ghq get git@my-repo-server.example.com:20022/group/project.git 

I want to do this:

ghq get my-repo-server.example.com/group/project

I'ts similar to what GIT's url.<base>.pushInsteadOf does but more powerful
and specifically for GHQ.

quickly thrown together configuration example

The URL in [ghq "my-repo-server.example.com/"] becomes a simple prefix string
matcher which then looks at match/replace to construct the final URLs.

Conceptually it could work something like this but there are probably more use
cases to think about.

[ghq "my-repo-server.example.com/"]
  vcs = git
  match = my-repo-server.example.com/(?P<rest>.*)/+
  replace = git@my-repo-server.example.com:20022/${rest}.git

Forcefully overriding https with .git:

[ghq "https://my-repo-server.example.com/"]
  vcs = git
  match = https://my-repo-server.example.com/(?P<rest>.*)/+
  replace = git@my-repo-server.example.com:20022/${rest}.git

And configure sub paths of hosts to be translated where the longest match wins(?):

[ghq "github.com/"]
  vcs = git
  match = github.com/(?P<rest>.*)
  replace = https://github.com/{rest}
  
[ghq "github.com/thomasf/"]
  vcs = git
  match = github.com/thomasf/(?P<rest>.*)/+
  replace = git@github.com:thomasf/{rest}.git
@thomasf
Copy link
Author

thomasf commented Aug 30, 2017

I also use a LOT of different repository hosts so I would prefer that it was possible to disable ghq get some/thing to go directly to github, I would like to get an error instead and always be forced to qualify github.com : ghq get github.com/some/thing.

@thomasf
Copy link
Author

thomasf commented Aug 30, 2017

This would probably make more sense btw, if there is a replace the first string
will be considered a regexp match/capture instead of a plain URL.

[ghq "my-repo-server.example.com/(?P<rest>.*)/+"]
  vcs = git
  replace = git@my-repo-server.example.com:20022/${rest}.git

But I'm getting ahead of myself with solutions, I would like to know what other people might need from something like this first.

@thomasf
Copy link
Author

thomasf commented Aug 30, 2017

This issue is related to #21 because this feature would probly benifit alot from a less constrained config format

@thomasf
Copy link
Author

thomasf commented Aug 31, 2017

Ok so [ghq "my-repo-server.example.com/(?P<rest>.*)/+"] is not an url and thus unsupported by git config..

Looking at remote_repository code it seems like it shouldnt be very complicated to fit almost everything it does for every back end into some configuration file language.

@Songmu
Copy link
Member

Songmu commented Apr 28, 2019

As a ghq feature, the correspondence between queries and directories is very clear. However, if such complicated rules are applied, it will be difficult to understand, and overkill.

So I close it once.

@Songmu Songmu closed this as completed Apr 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants