// ChangedFiles returns a list of files those were touched between two commits.
ChangedFiles returns a list of files those were touched between two commits.
// ChangedFiles returns a list of files those were touched between two commits .
func (r *repo) ChangedFiles(ctx context.Context, from, to string) ([]string, error) {
	out, err := r.runGitCommand(ctx, "diff", "--name-only", from, to)
	if err != nil {
		return nil, formatCommandError(err, out)
	}
	var (
		lines = strings.Split(string(out), "\n")
		files = make([]string, 0, len(lines))
	)
	for _, f := range lines {
		if f != "" {
			files = append(files, f)
		}
	}
	return files, nil
}
func ( r * repo ) ChangedFiles ( ctx context . Context , from , to string ) ( [ ] string , error ) { out , err := r . runGitCommand ( ctx , " " , " " , from , to ) if err != nil { return nil , formatCommandError ( err , out ) } var ( lines = strings . Split ( string ( out ) , " \n " ) files = make ( [ ] string , 0 , len ( lines ) ) ) for _ , f := range lines { if f != " " { files = append ( files , f ) } } return files , nil }
ChangedFiles returns a list of files those were touched between two commits.
ChangedFiles returns a list of files those were touched between two commits .
// The result may include some empty lines // so we need to remove all of them.