Skip to content

Commit 17623bb

Browse files
Remove Repository.getFilesChanged to fix Actions paths and paths-ignore filter (#23920)
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.
1 parent 6148e38 commit 17623bb

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

modules/git/commit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ func (c *Commit) SearchCommits(opts SearchCommitsOptions) ([]*Commit, error) {
291291

292292
// GetFilesChangedSinceCommit get all changed file names between pastCommit to current revision
293293
func (c *Commit) GetFilesChangedSinceCommit(pastCommit string) ([]string, error) {
294-
return c.repo.getFilesChanged(pastCommit, c.ID.String())
294+
return c.repo.GetFilesChangedBetween(pastCommit, c.ID.String())
295295
}
296296

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

modules/git/repo_commit.go

Lines changed: 0 additions & 8 deletions
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)