mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-03-29 06:45:31 +00:00
Dateien nach „services/repository/files“ hochladen
This commit is contained in:
parent
50d316ffee
commit
e06bcbd52c
1 changed files with 6 additions and 0 deletions
|
@ -28,6 +28,7 @@ type UploadRepoFileOptions struct {
|
||||||
Author *IdentityOptions
|
Author *IdentityOptions
|
||||||
Committer *IdentityOptions
|
Committer *IdentityOptions
|
||||||
Files []string // In UUID format.
|
Files []string // In UUID format.
|
||||||
|
FullPaths []string
|
||||||
Signoff bool
|
Signoff bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,6 +57,10 @@ func UploadRepoFiles(ctx context.Context, repo *repo_model.Repository, doer *use
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(opts.Files) != len(opts.FullPaths) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
uploads, err := repo_model.GetUploadsByUUIDs(ctx, opts.Files)
|
uploads, err := repo_model.GetUploadsByUUIDs(ctx, opts.Files)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("GetUploadsByUUIDs [uuids: %v]: %w", opts.Files, err)
|
return fmt.Errorf("GetUploadsByUUIDs [uuids: %v]: %w", opts.Files, err)
|
||||||
|
@ -65,6 +70,7 @@ func UploadRepoFiles(ctx context.Context, repo *repo_model.Repository, doer *use
|
||||||
infos := make([]uploadInfo, len(uploads))
|
infos := make([]uploadInfo, len(uploads))
|
||||||
for i, upload := range uploads {
|
for i, upload := range uploads {
|
||||||
// Check file is not lfs locked, will return nil if lock setting not enabled
|
// Check file is not lfs locked, will return nil if lock setting not enabled
|
||||||
|
upload.Name = opts.FullPaths[i]
|
||||||
filepath := path.Join(opts.TreePath, upload.Name)
|
filepath := path.Join(opts.TreePath, upload.Name)
|
||||||
lfsLock, err := git_model.GetTreePathLock(ctx, repo.ID, filepath)
|
lfsLock, err := git_model.GetTreePathLock(ctx, repo.ID, filepath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue