git-codereview: pick up URL-specific cookieFile config
Example config:
[http "https://go.googlesource.com"]
cookiefile = ~/.gitcookies-googlesource
The --get-urlmatch option falls back to non-URL-specific config.
Fixes golang/go#35496
Change-Id: I2410ff5b55e2bf9214fcc2cad16095facec78434
Reviewed-on: https://go-review.googlesource.com/c/review/+/206697
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
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 @@
// 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)) {