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

quite opened this issue Nov 11, 2019 · 4 comments


Copy link

@quite 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 ""]
        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

This comment has been minimized.

Copy link

@andybons andybons commented Nov 11, 2019


This comment has been minimized.

Copy link

@josharian josharian commented Nov 11, 2019

Thanks. Want to send a fix?


This comment has been minimized.

Copy link

@quite 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..


This comment has been minimized.

Copy link

@gopherbot gopherbot commented Nov 12, 2019

Change mentions this issue: git-codereview: pick up URL-specific cookieFile config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
4 participants
You can’t perform that action at this time.