Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package git-credential-oauth for openSUSE:Factory checked in at 2024-07-18 19:16:17 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/git-credential-oauth (Old) and /work/SRC/openSUSE:Factory/.git-credential-oauth.new.17339 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "git-credential-oauth" Thu Jul 18 19:16:17 2024 rev:4 rq:1188161 version:0.13.0 Changes: -------- --- /work/SRC/openSUSE:Factory/git-credential-oauth/git-credential-oauth.changes 2024-05-07 18:04:15.296363971 +0200 +++ /work/SRC/openSUSE:Factory/.git-credential-oauth.new.17339/git-credential-oauth.changes 2024-07-18 19:16:22.627203084 +0200 @@ -1,0 +2,8 @@ +Wed Jul 17 07:06:15 UTC 2024 - draskm...@protonmail.com + +- Update to version 0.13.0: + * New config key credential.oauthDeviceAuthURL + * GitHub username hint + * Update go version to 1.22 + +------------------------------------------------------------------- Old: ---- git-credential-oauth-0.11.3.tar.gz New: ---- git-credential-oauth-0.13.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ git-credential-oauth.spec ++++++ --- /var/tmp/diff_new_pack.mhR6NL/_old 2024-07-18 19:16:23.567240715 +0200 +++ /var/tmp/diff_new_pack.mhR6NL/_new 2024-07-18 19:16:23.567240715 +0200 @@ -17,7 +17,7 @@ Name: git-credential-oauth -Version: 0.11.3 +Version: 0.13.0 Release: 0 Summary: Git credential helper that authenticates to GitHub and other forges using OAuth License: Apache-2.0 @@ -27,6 +27,7 @@ Source1: vendor.tar.zst BuildRequires: golang-packaging BuildRequires: zstd +BuildRequires: golang(API) >= 1.22 Requires: git-core %description ++++++ git-credential-oauth-0.11.3.tar.gz -> git-credential-oauth-0.13.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/git-credential-oauth-0.11.3/.github/workflows/go.yml new/git-credential-oauth-0.13.0/.github/workflows/go.yml --- old/git-credential-oauth-0.11.3/.github/workflows/go.yml 2024-05-02 21:18:01.000000000 +0200 +++ new/git-credential-oauth-0.13.0/.github/workflows/go.yml 2024-07-10 21:24:05.000000000 +0200 @@ -11,12 +11,12 @@ build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: - go-version: 1.19 + go-version: 1.22.2 - name: Build run: go build -v ./... diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/git-credential-oauth-0.11.3/README.md new/git-credential-oauth-0.13.0/README.md --- old/git-credential-oauth-0.11.3/README.md 2024-05-02 21:18:01.000000000 +0200 +++ new/git-credential-oauth-0.13.0/README.md 2024-07-10 21:24:05.000000000 +0200 @@ -88,13 +88,13 @@ ```sh git config --global --unset-all credential.helper -git config --global --add credential.helper "cache --timeout 7200" # two hours +git config --global --add credential.helper "cache --timeout 21600" # six hours git config --global --add credential.helper oauth ``` You may choose a different storage helper such as `osxkeychain`, `wincred` or `libsecret`, but git-credential-oauth must be configured last. This ensures Git checks for *stored* credentials before generating *new* credentials. -**Windows users** must use storage helper `wincred` because [git-credential-cache isn't available on Windows](https://github.com/git-for-windows/git/issues/3892). +**Windows users** are recommended to use storage helper `wincred`. ### Manual config @@ -102,7 +102,7 @@ ```ini [credential] - helper = cache --timeout 7200 # two hours + helper = cache --timeout 21600 # six hours helper = oauth ``` @@ -112,7 +112,7 @@ ```ini [credential] - helper = cache --timeout 7200 # two hours + helper = cache --timeout 21600 # six hours helper = oauth -device ``` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/git-credential-oauth-0.11.3/git-credential-oauth.1 new/git-credential-oauth-0.13.0/git-credential-oauth.1 --- old/git-credential-oauth-0.11.3/git-credential-oauth.1 2024-05-02 21:18:01.000000000 +0200 +++ new/git-credential-oauth-0.13.0/git-credential-oauth.1 2024-07-10 21:24:05.000000000 +0200 @@ -14,7 +14,7 @@ .IP .EX git config --global --unset-all credential.helper -git config --global --add credential.helper \[dq]cache --timeout 7200\[dq] # two hours +git config --global --add credential.helper \[dq]cache --timeout 21600\[dq] # six hours git config --global --add credential.helper oauth .EE .PP diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/git-credential-oauth-0.11.3/go.mod new/git-credential-oauth-0.13.0/go.mod --- old/git-credential-oauth-0.11.3/go.mod 2024-05-02 21:18:01.000000000 +0200 +++ new/git-credential-oauth-0.13.0/go.mod 2024-07-10 21:24:05.000000000 +0200 @@ -1,5 +1,5 @@ module github.com/hickford/git-credential-oauth -go 1.19 +go 1.22.2 require golang.org/x/oauth2 v0.19.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/git-credential-oauth-0.11.3/go.sum new/git-credential-oauth-0.13.0/go.sum --- old/git-credential-oauth-0.11.3/go.sum 2024-05-02 21:18:01.000000000 +0200 +++ new/git-credential-oauth-0.13.0/go.sum 2024-07-10 21:24:05.000000000 +0200 @@ -1,3 +1,4 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= golang.org/x/oauth2 v0.19.0 h1:9+E/EZBCbTLNrbN35fHv/a/d/mOBatymz1zbtQrXpIg= golang.org/x/oauth2 v0.19.0/go.mod h1:vYi7skDa1x015PmRRYZ7+s1cWyPgrPiSYRe4rnsexc8= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/git-credential-oauth-0.11.3/main.go new/git-credential-oauth-0.13.0/main.go --- old/git-credential-oauth-0.11.3/main.go 2024-05-02 21:18:01.000000000 +0200 +++ new/git-credential-oauth-0.13.0/main.go 2024-07-10 21:24:05.000000000 +0200 @@ -252,6 +252,13 @@ log.Fatalln(err) } } + bytes, err = exec.Command(gitPath, "config", "--get-urlmatch", "credential.oauthDeviceAuthURL", urll).Output() + if err == nil { + c.Endpoint.DeviceAuthURL, err = urlResolveReference(urll, strings.TrimSpace(string(bytes))) + if err != nil { + log.Fatalln(err) + } + } bytes, err = exec.Command(gitPath, "config", "--get-urlmatch", "credential.oauthRedirectURL", urll).Output() if err == nil { c.RedirectURL = strings.TrimSpace(string(bytes)) @@ -282,12 +289,18 @@ } } + var authURLSuffix string + if looksLikeGitHub && pairs["username"] != "" && pairs["username"] != "oauth2" { + // https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps#1-request-a-users-github-identity + authURLSuffix = fmt.Sprintf("&login=%s", pairs["username"]) + } + if token == nil { // Generate new token (opens browser, may require user input) if device { token, err = getDeviceToken(ctx, c) } else { - token, err = getToken(ctx, c) + token, err = getToken(ctx, c, authURLSuffix) } if err != nil { log.Fatalln(err) @@ -377,7 +390,7 @@ </body> </html>` -func getToken(ctx context.Context, c oauth2.Config) (*oauth2.Token, error) { +func getToken(ctx context.Context, c oauth2.Config, authURLSuffix string) (*oauth2.Token, error) { state := oauth2.GenerateVerifier() queries := make(chan url.Values) handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -420,19 +433,23 @@ defer server.Close() verifier := oauth2.GenerateVerifier() authCodeURL := c.AuthCodeURL(state, oauth2.S256ChallengeOption(verifier)) + authCodeURL += authURLSuffix fmt.Fprintf(os.Stderr, "Please complete authentication in your browser...\n%s\n", authCodeURL) var open string + var p []string switch runtime.GOOS { case "windows": - open = "start" + open = "rundll32" + p = append(p, "url.dll,FileProtocolHandler") case "darwin": open = "open" default: open = "xdg-open" } + p = append(p, authCodeURL) // TODO: wait for server to start before opening browser if _, err := exec.LookPath(open); err == nil { - err = exec.Command(open, authCodeURL).Run() + err = exec.Command(open, p...).Run() if err != nil { return nil, err } ++++++ vendor.tar.zst ++++++