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

ghq get does not clone to the primary root set in gitconfig #239

Closed
taxio opened this issue Dec 26, 2019 · 6 comments
Closed

ghq get does not clone to the primary root set in gitconfig #239

taxio opened this issue Dec 26, 2019 · 6 comments

Comments

@taxio
Copy link

taxio commented Dec 26, 2019

environment

  • Mac OS Catalina 10.15.2
  • go1.13.5
  • ghq v0.17.2

my gitconfig

[ghq]
	root = ~/.ghq
	root = ~/go/src

ghq root returns ~/.ghq correctly, but when ghq get <repo>, it is cloned to ~/go/src

I think...

Until v0.16.0, the first path was extracted after getting all with gitconfig.PathAll("ghq.root").

https://github.com/motemen/ghq/blob/aeacda0267/local_repository.go#L99

https://github.com/motemen/ghq/blob/aeacda0267/local_repository.go#L343-L349

https://github.com/motemen/ghq/blob/aeacda026785e37a6f076fdc2f71b5d8153f49fa/local_repository.go#L310

But, since v0.17.0, that has been replaced by gitconfig.Do("--path", "--get-urlmatch", "ghq.root", remoteURL.String()) .

https://github.com/motemen/ghq/blob/bb059e45e7/local_repository.go#L99

https://github.com/motemen/ghq/blob/bb059e45e72c30b28e38fbadbda29dca71f8d04a/local_repository.go#L114

As a result of attaching the debugger, gitconfig.Do(...) returned the second root.
Is this a bug?

@Songmu
Copy link
Member

Songmu commented Dec 26, 2019

Thank you for detailed report.

Certainly, this is an unintended incompatible change. However, this may be more natural for gitconfig, so I'm not sure should I restore the behavior.

@taxio
Copy link
Author

taxio commented Dec 26, 2019

thanks.

I think so too. It is more natural to see the last root as primary from the point of view of gitconfig operation.

If so, why not change the behavior of ghq root?
This shows the first root yet.

@Songmu
Copy link
Member

Songmu commented Dec 26, 2019

If this incompatible behavior to be true, ghq root must be changed. This is just my omission.

@Songmu
Copy link
Member

Songmu commented Dec 26, 2019

The behavior has been adjusted in v0.17.3. Now, the last ghq.root setting is the primary directory to clone a repository.

Sorry to trouble you to rewrite the settings.

@taxio
Copy link
Author

taxio commented Dec 27, 2019

I think this is a great decision.

thank you.

@Songmu
Copy link
Member

Songmu commented Dec 27, 2019

Thanks to your polite report, this problem was solved quickly. Thank you very much.

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