Skip to content

Commit 7da06da

Browse files
ChristopherHXLinux User
authored and
Linux User
committed
Remove Repository.getFilesChanged to fix Actions paths and paths-ignore filter (go-gitea#23920)
Remove the misbehaving function and call Repository.GetFilesChangedBetween instead. Fixes go-gitea#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.
1 parent 001d3fb commit 7da06da

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

modules/git/commit.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ func (c *Commit) SearchCommits(opts SearchCommitsOptions) ([]*Commit, error) {
278278

279279
// GetFilesChangedSinceCommit get all changed file names between pastCommit to current revision
280280
func (c *Commit) GetFilesChangedSinceCommit(pastCommit string) ([]string, error) {
281-
return c.repo.getFilesChanged(pastCommit, c.ID.String())
281+
return c.repo.GetFilesChangedBetween(pastCommit, c.ID.String())
282282
}
283283

284284
// FileChangedSinceCommit Returns true if the file given has changed since the the past commit

modules/git/repo_commit.go

-8
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,6 @@ func (repo *Repository) searchCommits(id SHA1, opts SearchCommitsOptions) ([]*Co
182182
return repo.parsePrettyFormatLogToList(bytes.TrimSuffix(stdout, []byte{'\n'}))
183183
}
184184

185-
func (repo *Repository) getFilesChanged(id1, id2 string) ([]string, error) {
186-
stdout, _, err := NewCommand(repo.Ctx, "diff", "--name-only").AddDynamicArguments(id1, id2).RunStdBytes(&RunOpts{Dir: repo.Path})
187-
if err != nil {
188-
return nil, err
189-
}
190-
return strings.Split(string(stdout), "\n"), nil
191-
}
192-
193185
// FileChangedBetweenCommits Returns true if the file changed between commit IDs id1 and id2
194186
// You must ensure that id1 and id2 are valid commit ids.
195187
func (repo *Repository) FileChangedBetweenCommits(filename, id1, id2 string) (bool, error) {

0 commit comments

Comments
 (0)