Update modules/git/repo_index.go

This commit is contained in:
David Rotermund 2025-02-09 23:31:53 +01:00
parent bd281bc953
commit a6f7549e35

View file

@ -108,11 +108,13 @@ func (repo *Repository) LsFilesFromDirectory(directory, branch string) ([]string
if branch == "" {
return nil, errors.New("branch not found in context URL")
}
cmd := NewCommand(repo.Ctx, "ls-files").AddDynamicArguments("--with-tree="+branch)
cmd := NewCommand(repo.Ctx, "ls-files", internal.CmdArg("--with-tree=" + branch))
if len(directory) > 0 {
cmd = NewCommand(repo.Ctx, "ls-files").AddDynamicArguments("--with-tree="+branch).AddDynamicArguments("--directory").AddDynamicArguments(directory)
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