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
Account for url.<url>.insteadOf in all operations #1117
Conversation
Hi @artagnon, thanks for the patch 🤘 This is just an initial triage of the PR, so I haven't reviewed the code yet, but it now has a
|
Oops, fixed the minor detail. Thanks. diff --git a/test/test-config.sh b/test/test-config.sh
index a535651..bf4a63e 100755
--- a/test/test-config.sh
+++ b/test/test-config.sh
@@ -22,9 +22,10 @@ begin_test "default config"
git lfs env | tee env.log
grep "Endpoint=http://local-lfsconfig (auth=none)" env.log
- git config url."http://actual-url".insteadOf alias:
+ git config url."http://actual-url/".insteadOf alias:
+ git config lfs.url alias:rest
git lfs env | tee env.log
- grep "Endpoint=http://actual-url (auth=none)" env.log
+ grep "Endpoint=http://actual-url/rest (auth=none)" env.log
)
end_test |
uniqKeys := make(map[string]string) | ||
for _, line := range lines { | ||
// Why is this not "="? | ||
pieces := strings.SplitN(line, " ", 2) |
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.
// Why is this not "="?
This is the first time the pieces
var is used in this scope, so it must be declared. Same goes for values like key
or value
below. I suppose we could declare them above the for
block, but I don't think it's worth the hassle.
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.
No, I meant why the string we're splitting on is not "=": inconsistency in the way git config
reports; see line 489.
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.
Doh, sorry. That's silly of me. No clue why git config --list
differs from --get-regexp
, either. Looks like the only way we could parse the output of both commands the same is by using -z
.
We tackle the problem in two places: first, when a raw clone url is given, we must load possible replacement for substrings from the config; second, when we are fetching a certain remote's url from the config, we must try to replace the relevant part of the url. The implementation iterates over the map insteadOfs, and attempts to strings.Replace() the url with all the key-value pairs.
Hey @artagnon, thanks for reworking this based on my feedback so quickly. I'm beginning the QA phase for Git LFS 1.2 now, but this will probably just barely make the cut :) |
If we're going to support |
c.readGitInsteadOfConfig(listOutput, uniqInsteadOfs) | ||
c.insteadOfs = uniqInsteadOfs | ||
|
||
c.readGitConfigFromFiles(configFiles, 0, uniqRemotes) |
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.
There's a silent dependency here on readGitInsteadOfConfig
being called before readGitConfigFromFiles
, and having assigned c.insteadOfs
before it, even though that member var isn't used anywhere else.
I think the call to readGitInsteadOfConfig
should be nested inside the readGitConfigFromFiles
to make this explicit, and the output uniqInsteadOfs
not stored in the Config
at all, just used to affect the behaviour of the rest of readGitConfigFromFiles
, as it currently does. This would eliminate the hidden 'magic' ordering and unused state.
You think it's worth shipping this, or waiting until I'm inclined to let https://github.com/github/git-lfs/pull/1117/files#r59379179 slide until the next version too. @sinbad: if you feel strongly about it, we can hold off though. |
TBH this is the first time I've ever heard of these features, I'd never heard from anyone who used them before :) When I looked them up they just seemed to go together. If it's important to ship now I don't have major objections. |
Hey @artagnon, I found a bug during my QA where it looks like this is doing the Unfortunately, I'm going to hold this back from Git LFS v1.2. I'd like the following to be fixed before I merge this:
Thanks for your work on this. Let me know if I can help you out in anyway on here or gitter. |
Thanks for catching those bugs @technoweenie. I'll be on vacation for 10 days, and I'll continue development when I'm back. |
@artagnon Hey, friendly nudge. Do you have time to pick this back up? If not, that's totally cool. I or someone else should be able to push this over the finish line. |
@technoweenie Hey, I don't think I have the time to finish this up in the Thanks. On Tue, May 10, 2016 at 5:14 PM risk danger olson notifications@github.com
|
@artagnon Thanks again for submitting this PR. Unfortunately, I dropped the ball here. Lately, we've been on a refactoring kick in the I also changed the implementation, since
Just FYI :) Thanks again for your original patch. Hope to see you around again! |
We tackle the problem in two places: first, when a raw clone url is given, we
must load possible replacement for substrings from the config; second, when we
are fetching a certain remote's url from the config, we must try to replace the
relevant part of the url.
The implementation iterates over the map insteadOfs, and attempts to
strings.Replace() the url with all the key-value pairs.