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

x/review: pickup URL specific http.cookieFile from the git config #35496

Closed
quite opened this issue Nov 11, 2019 · 4 comments
Closed

x/review: pickup URL specific http.cookieFile from the git config #35496

quite opened this issue Nov 11, 2019 · 4 comments
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@quite
Copy link

quite commented Nov 11, 2019

git-codereview does not pick up an URL-specific cookieFile, like: http.{URL}.cookieFile. Looks like this in the config file:

[http "https://go.googlesource.com"]
        cookiefile = ~/.gitcookies-googlesource

git config does have a way to do that matching (--get-urlmatch which is nothing new), which also falls back to any non-URL-specific http.cookieFile.

The following works, but it is clearly not covered by the tests (but they do pass).

diff --git a/git-codereview/api.go b/git-codereview/api.go
index 8440cb5..a3375ea 100644
--- a/git-codereview/api.go
+++ b/git-codereview/api.go
@@ -145,7 +145,7 @@ func loadAuth() {
 
 	// First look in Git's http.cookiefile, which is where Gerrit
 	// now tells users to store this information.
-	if cookieFile, _ := trimErr(cmdOutputErr("git", "config", "--path", "http.cookiefile")); cookieFile != "" {
+	if cookieFile, _ := trimErr(cmdOutputErr("git", "config", "--path", "--get-urlmatch", "http.cookiefile", auth.url)); cookieFile != "" {
 		data, _ := ioutil.ReadFile(cookieFile)
 		maxMatch := -1
 		for _, line := range lines(string(data)) {
@gopherbot gopherbot added this to the Unreleased milestone Nov 11, 2019
@andybons
Copy link
Member

@josharian @kevinburke

@andybons andybons added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Nov 11, 2019
@josharian
Copy link
Contributor

Thanks. Want to send a fix?

@andybons andybons added help wanted NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Nov 12, 2019
@quite
Copy link
Author

quite commented Nov 12, 2019

I can submit the above patch on gerrit but i don't really have time now to rewrite/add tests to accomodate for it..

@gopherbot
Copy link

Change https://golang.org/cl/206697 mentions this issue: git-codereview: pick up URL-specific cookieFile config

@golang golang locked and limited conversation to collaborators Nov 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants