Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package gitea-tea for openSUSE:Factory checked in at 2025-10-18 18:36:28 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/gitea-tea (Old) and /work/SRC/openSUSE:Factory/.gitea-tea.new.18484 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "gitea-tea" Sat Oct 18 18:36:28 2025 rev:13 rq:1312169 version:0.11.1 Changes: -------- --- /work/SRC/openSUSE:Factory/gitea-tea/gitea-tea.changes 2025-10-09 15:09:30.118214578 +0200 +++ /work/SRC/openSUSE:Factory/.gitea-tea.new.18484/gitea-tea.changes 2025-10-18 18:36:33.174251908 +0200 @@ -1,0 +2,8 @@ +Sat Oct 18 06:04:09 UTC 2025 - Johannes Kastl <[email protected]> + +- update to 0.11.1: + * 61d4e57 Fix Pr Create crash (#823) + * 4f33146 add test for matching logins (#820) + * 08b8398 Update README.md (#819) + +------------------------------------------------------------------- Old: ---- gitea-tea-0.11.0.tar.gz New: ---- gitea-tea-0.11.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ gitea-tea.spec ++++++ --- /var/tmp/diff_new_pack.ExrHJF/_old 2025-10-18 18:36:34.794319936 +0200 +++ /var/tmp/diff_new_pack.ExrHJF/_new 2025-10-18 18:36:34.818320944 +0200 @@ -1,7 +1,6 @@ # # spec file for package gitea-tea # -# Copyright (c) 2025 SUSE LLC # Copyright (c) 2025 SUSE LLC and contributors # # All modifications and additions to the file contributed by third parties @@ -18,7 +17,7 @@ Name: gitea-tea -Version: 0.11.0 +Version: 0.11.1 Release: 0 Summary: A command line tool to interact with Gitea servers License: MIT ++++++ gitea-tea-0.11.0.tar.gz -> gitea-tea-0.11.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gitea-tea-0.11.0/README.md new/gitea-tea-0.11.1/README.md --- old/gitea-tea-0.11.0/README.md 2025-09-14 02:23:12.000000000 +0200 +++ new/gitea-tea-0.11.1/README.md 2025-10-08 16:43:38.000000000 +0200 @@ -106,9 +106,7 @@ 3. Install from source: [see *Compilation*](#compilation) -4. Docker (thirdparty): [tgerczei/tea](https://hub.docker.com/r/tgerczei/tea) - -5. asdf (thirdparty): [mvaldes14/asdf-tea](https://github.com/mvaldes14/asdf-tea) +4. Docker: [Tea at docker hub](https://hub.docker.com/r/gitea/tea) ### Log in to Gitea from tea diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gitea-tea-0.11.0/modules/context/context.go new/gitea-tea-0.11.1/modules/context/context.go --- old/gitea-tea-0.11.0/modules/context/context.go 2025-09-14 02:23:12.000000000 +0200 +++ new/gitea-tea-0.11.1/modules/context/context.go 2025-10-08 16:43:38.000000000 +0200 @@ -14,6 +14,7 @@ "time" "code.gitea.io/tea/modules/config" + "code.gitea.io/tea/modules/debug" "code.gitea.io/tea/modules/git" "code.gitea.io/tea/modules/theme" "code.gitea.io/tea/modules/utils" @@ -95,6 +96,12 @@ remoteFlag = config.GetPreferences().FlagDefaults.Remote } + if repoPath == "" { + if repoPath, err = os.Getwd(); err != nil { + log.Fatal(err.Error()) + } + } + // try to read local git repo & extract context: if repoFlag specifies a valid path, read repo in that dir, // otherwise attempt PWD. if no repo is found, continue with default login if c.LocalRepo, c.Login, c.RepoSlug, err = contextFromLocalRepo(repoPath, remoteFlag); err != nil { @@ -168,6 +175,7 @@ if err != nil { return repo, nil, "", err } + debug.Printf("Get git config %v of %s in repo %s", gitConfig, remoteValue, repoPath) if len(gitConfig.Remotes) == 0 { return repo, nil, "", errNotAGiteaRepo @@ -206,35 +214,67 @@ remoteConfig, ok := gitConfig.Remotes[remoteValue] if !ok || remoteConfig == nil { - return repo, nil, "", fmt.Errorf("Remote '%s' not found in this Git repository", remoteValue) + return repo, nil, "", fmt.Errorf("remote '%s' not found in this Git repository", remoteValue) } + debug.Printf("Get remote configurations %v of %s in repo %s", remoteConfig, remoteValue, repoPath) + logins, err := config.GetLogins() if err != nil { return repo, nil, "", err } + for _, u := range remoteConfig.URLs { + if l, p, err := MatchLogins(u, logins); err == nil { + return repo, l, p, nil + } + } + + return repo, nil, "", errNotAGiteaRepo +} + +// MatchLogins matches the given remoteURL against the provided logins and returns +// the first matching login +// remoteURL could be like: +// +// https://gitea.com/owner/repo.git +// http://gitea.com/owner/repo.git +// ssh://gitea.com/owner/repo.git +// [email protected]:owner/repo.git +func MatchLogins(remoteURL string, logins []config.Login) (*config.Login, string, error) { for _, l := range logins { + debug.Printf("Matching remote URL '%s' against %v login", remoteURL, l) sshHost := l.GetSSHHost() - for _, u := range remoteConfig.URLs { - p, err := git.ParseURL(u) + atIdx := strings.Index(remoteURL, "@") + colonIdx := strings.Index(remoteURL, ":") + if atIdx > 0 && colonIdx > atIdx { + domain := remoteURL[atIdx+1 : colonIdx] + if domain == sshHost { + return &l, strings.TrimSuffix(remoteURL[colonIdx+1:], ".git"), nil + } + } else { + p, err := git.ParseURL(remoteURL) if err != nil { - return repo, nil, "", fmt.Errorf("Git remote URL parse failed: %s", err.Error()) + return nil, "", fmt.Errorf("git remote URL parse failed: %s", err.Error()) } - if strings.EqualFold(p.Scheme, "http") || strings.EqualFold(p.Scheme, "https") { - if strings.HasPrefix(u, l.URL) { + + switch { + case strings.EqualFold(p.Scheme, "http") || strings.EqualFold(p.Scheme, "https"): + if strings.HasPrefix(remoteURL, l.URL) { ps := strings.Split(p.Path, "/") path := strings.Join(ps[len(ps)-2:], "/") - return repo, &l, strings.TrimSuffix(path, ".git"), nil + return &l, strings.TrimSuffix(path, ".git"), nil } - } else if strings.EqualFold(p.Scheme, "ssh") { + case strings.EqualFold(p.Scheme, "ssh"): if sshHost == p.Host || sshHost == p.Hostname() { - return repo, &l, strings.TrimLeft(p.Path, "/"), nil + return &l, strings.TrimLeft(p.Path, "/"), nil } + default: + // unknown scheme + return nil, "", fmt.Errorf("git remote URL parse failed: %s", "unknown scheme "+p.Scheme) } } } - - return repo, nil, "", errNotAGiteaRepo + return nil, "", errNotAGiteaRepo } // GetLoginByEnvVar returns a login based on environment variables, or nil if no login can be created diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gitea-tea-0.11.0/modules/context/context_test.go new/gitea-tea-0.11.1/modules/context/context_test.go --- old/gitea-tea-0.11.0/modules/context/context_test.go 1970-01-01 01:00:00.000000000 +0100 +++ new/gitea-tea-0.11.1/modules/context/context_test.go 2025-10-08 16:43:38.000000000 +0200 @@ -0,0 +1,47 @@ +// Copyright 2025 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package context + +import ( + "testing" + + "code.gitea.io/tea/modules/config" +) + +func Test_MatchLogins(t *testing.T) { + kases := []struct { + remoteURL string + logins []config.Login + matchedLoginName string + expectedRepoPath string + hasError bool + }{ + { + remoteURL: "https://gitea.com/owner/repo.git", + logins: []config.Login{{Name: "gitea.com", URL: "https://gitea.com"}}, + matchedLoginName: "gitea.com", + expectedRepoPath: "owner/repo", + hasError: false, + }, + { + remoteURL: "[email protected]:owner/repo.git", + logins: []config.Login{{Name: "gitea.com", URL: "https://gitea.com"}}, + matchedLoginName: "gitea.com", + expectedRepoPath: "owner/repo", + hasError: false, + }, + } + + for _, kase := range kases { + t.Run(kase.remoteURL, func(t *testing.T) { + _, repoPath, err := MatchLogins(kase.remoteURL, kase.logins) + if (err != nil) != kase.hasError { + t.Errorf("Expected error: %v, got: %v", kase.hasError, err) + } + if repoPath != kase.expectedRepoPath { + t.Errorf("Expected repo path: %s, got: %s", kase.expectedRepoPath, repoPath) + } + }) + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gitea-tea-0.11.0/modules/interact/pull_create.go new/gitea-tea-0.11.1/modules/interact/pull_create.go --- old/gitea-tea-0.11.0/modules/interact/pull_create.go 2025-09-14 02:23:12.000000000 +0200 +++ new/gitea-tea-0.11.1/modules/interact/pull_create.go 2025-10-08 16:43:38.000000000 +0200 @@ -33,7 +33,7 @@ if ctx.LocalRepo != nil { headOwner, headBranch, err = task.GetDefaultPRHead(ctx.LocalRepo) if err == nil { - validator = nil + validator = func(string) error { return nil } } } ++++++ vendor.tar.gz ++++++
