mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-15 17:00:02 +02:00
modules/git/repo_index.go aktualisiert
This commit is contained in:
parent
47aa971cc6
commit
f5750f515b
1 changed files with 0 additions and 25 deletions
|
@ -11,7 +11,6 @@ import (
|
|||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"code.gitea.io/gitea/modules/git/internal" //nolint:depguard // only this file can use the internal type CmdArg, other files and packages should use AddXxx functions
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
)
|
||||
|
@ -104,30 +103,6 @@ func (repo *Repository) LsFiles(filenames ...string) ([]string, error) {
|
|||
return filelist, err
|
||||
}
|
||||
|
||||
// Gives a list of all files in a directory and below
|
||||
func (repo *Repository) LsFilesFromDirectory(directory, branch string) ([]string, error) {
|
||||
if branch == "" {
|
||||
return nil, errors.New("branch not found in context URL")
|
||||
}
|
||||
|
||||
cmd := NewCommand(repo.Ctx, "ls-files", internal.CmdArg("--with-tree="+branch))
|
||||
if len(directory) > 0 {
|
||||
cmd = NewCommand(repo.Ctx, "ls-files", internal.CmdArg("--with-tree="+branch), internal.CmdArg("--directory"), internal.CmdArg(directory))
|
||||
}
|
||||
res, stderror, err := cmd.RunStdBytes(&RunOpts{Dir: repo.Path})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(stderror) > 0 {
|
||||
return nil, errors.New(string(stderror))
|
||||
}
|
||||
|
||||
lines := strings.Split(string(res), "\n")
|
||||
|
||||
return lines, nil
|
||||
}
|
||||
|
||||
// RemoveFilesFromIndex removes given filenames from the index - it does not check whether they are present.
|
||||
func (repo *Repository) RemoveFilesFromIndex(filenames ...string) error {
|
||||
objectFormat, err := repo.GetObjectFormat()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue