Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions modules/git/commit_archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package git

import (
"context"
"fmt"
"path/filepath"
"strings"
Expand Down Expand Up @@ -39,7 +40,7 @@ type CreateArchiveOpts struct {
}

// CreateArchive create archive content to the target path
func (c *Commit) CreateArchive(target string, opts CreateArchiveOpts) error {
func (c *Commit) CreateArchive(ctx context.Context, target string, opts CreateArchiveOpts) error {
if opts.Format.String() == "unknown" {
return fmt.Errorf("unknown format: %v", opts.Format)
}
Expand All @@ -58,6 +59,6 @@ func (c *Commit) CreateArchive(target string, opts CreateArchiveOpts) error {
c.ID.String(),
)

_, err := NewCommand(args...).RunInDir(c.repo.Path)
_, err := NewCommandContext(ctx, args...).RunInDir(c.repo.Path)
return err
}
2 changes: 1 addition & 1 deletion routers/repo/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ func Download(ctx *context.Context) {

archivePath = path.Join(archivePath, base.ShortSha(commit.ID.String())+ext)
if !com.IsFile(archivePath) {
if err := commit.CreateArchive(archivePath, git.CreateArchiveOpts{
if err := commit.CreateArchive(ctx.Req.Context(), archivePath, git.CreateArchiveOpts{
Format: archiveType,
Prefix: setting.Repository.PrefixArchiveFiles,
}); err != nil {
Expand Down