summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiteabot <teabot@gitea.io>2023-04-08 04:16:21 -0400
committerGitHub <noreply@github.com>2023-04-08 16:16:21 +0800
commita00e4733415ede1dbf5af63b8fad1412bb4fe24c (patch)
treecda84d7da9bdfa129c357869be7d5c75c3b9fc87
parent4019a6d4b2b6f702bbdc99d5ed478e01ba243d28 (diff)
downloadgitea-a00e4733415ede1dbf5af63b8fad1412bb4fe24c.tar.gz
gitea-a00e4733415ede1dbf5af63b8fad1412bb4fe24c.zip
Remove `Repository.getFilesChanged` to fix Actions `paths` and `paths-ignore` filter (#23920) (#23969)
Backport #23920 by @ChristopherHX Remove the misbehaving function and call Repository.GetFilesChangedBetween instead. Fixes #23919 --- ~~_TODO_ test this~~ `Repository.getFilesChanged` seems to be only used by Gitea Actions, but a similar function already exists **Update** I tested this change and the issue is gone. Co-authored-by: ChristopherHX <christopher.homberger@web.de>
-rw-r--r--modules/git/commit.go2
-rw-r--r--modules/git/repo_commit.go8
2 files changed, 1 insertions, 9 deletions
diff --git a/modules/git/commit.go b/modules/git/commit.go
index 4a55645d30..2deda23114 100644
--- a/modules/git/commit.go
+++ b/modules/git/commit.go
@@ -278,7 +278,7 @@ func (c *Commit) SearchCommits(opts SearchCommitsOptions) ([]*Commit, error) {
// GetFilesChangedSinceCommit get all changed file names between pastCommit to current revision
func (c *Commit) GetFilesChangedSinceCommit(pastCommit string) ([]string, error) {
- return c.repo.getFilesChanged(pastCommit, c.ID.String())
+ return c.repo.GetFilesChangedBetween(pastCommit, c.ID.String())
}
// FileChangedSinceCommit Returns true if the file given has changed since the the past commit
diff --git a/modules/git/repo_commit.go b/modules/git/repo_commit.go
index a62e0670fe..d566b62c58 100644
--- a/modules/git/repo_commit.go
+++ b/modules/git/repo_commit.go
@@ -182,14 +182,6 @@ func (repo *Repository) searchCommits(id SHA1, opts SearchCommitsOptions) ([]*Co
return repo.parsePrettyFormatLogToList(bytes.TrimSuffix(stdout, []byte{'\n'}))
}
-func (repo *Repository) getFilesChanged(id1, id2 string) ([]string, error) {
- stdout, _, err := NewCommand(repo.Ctx, "diff", "--name-only").AddDynamicArguments(id1, id2).RunStdBytes(&RunOpts{Dir: repo.Path})
- if err != nil {
- return nil, err
- }
- return strings.Split(string(stdout), "\n"), nil
-}
-
// FileChangedBetweenCommits Returns true if the file changed between commit IDs id1 and id2
// You must ensure that id1 and id2 are valid commit ids.
func (repo *Repository) FileChangedBetweenCommits(filename, id1, id2 string) (bool, error) {