diff options
author | zeripath <art27@cantab.net> | 2020-08-28 07:55:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-28 09:55:12 +0300 |
commit | eb1bf2377be15deb593a3e2426558d92c1973107 (patch) | |
tree | ca01ae95beb2b5decc63c88334216130733f09f7 /modules | |
parent | d3b5edacb655ced0135ca5f48544612ccc38890e (diff) | |
download | gitea-eb1bf2377be15deb593a3e2426558d92c1973107.tar.gz gitea-eb1bf2377be15deb593a3e2426558d92c1973107.zip |
Set context for running CreateArchive in to that of the request (#12555)
Set the context for CreateArchive to that of the request to ensure that archives
are only built for as long as a request is requesting them
Fix #11551
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/git/commit_archive.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/git/commit_archive.go b/modules/git/commit_archive.go index c7d1d06c46..d075ba0911 100644 --- a/modules/git/commit_archive.go +++ b/modules/git/commit_archive.go @@ -6,6 +6,7 @@ package git import ( + "context" "fmt" "path/filepath" "strings" @@ -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) } @@ -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 } |