aboutsummaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorJohn Olheiser <john.olheiser@gmail.com>2021-08-24 11:47:09 -0500
committerGitHub <noreply@github.com>2021-08-24 11:47:09 -0500
commit648464b504755ee96187692fbe59acc2eec5bddf (patch)
treeaa25fbd8c8d9cb975d6eb53094098d5a33aa7afa /services
parentd22cb600edc2605bd8be25c9079a5ce2c6643547 (diff)
downloadgitea-648464b504755ee96187692fbe59acc2eec5bddf.tar.gz
gitea-648464b504755ee96187692fbe59acc2eec5bddf.zip
Add bundle download for repository (#14538)
* Add bundle download Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix fmt Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix build tags Signed-off-by: jolheiser <john.olheiser@gmail.com> * Download specific commit Signed-off-by: jolheiser <john.olheiser@gmail.com>
Diffstat (limited to 'services')
-rw-r--r--services/archiver/archiver.go25
-rw-r--r--services/auth/placeholder.go1
2 files changed, 19 insertions, 7 deletions
diff --git a/services/archiver/archiver.go b/services/archiver/archiver.go
index 00c0281306..7ae0a94d7e 100644
--- a/services/archiver/archiver.go
+++ b/services/archiver/archiver.go
@@ -54,6 +54,9 @@ func NewRequest(repoID int64, repo *git.Repository, uri string) (*ArchiveRequest
case strings.HasSuffix(uri, ".tar.gz"):
ext = ".tar.gz"
r.Type = git.TARGZ
+ case strings.HasSuffix(uri, ".bundle"):
+ ext = ".bundle"
+ r.Type = git.BUNDLE
default:
return nil, fmt.Errorf("Unknown format: %s", uri)
}
@@ -165,13 +168,21 @@ func doArchive(r *ArchiveRequest) (*models.RepoArchiver, error) {
}
}()
- err = gitRepo.CreateArchive(
- graceful.GetManager().ShutdownContext(),
- archiver.Type,
- w,
- setting.Repository.PrefixArchiveFiles,
- archiver.CommitID,
- )
+ if archiver.Type == git.BUNDLE {
+ err = gitRepo.CreateBundle(
+ graceful.GetManager().ShutdownContext(),
+ archiver.CommitID,
+ w,
+ )
+ } else {
+ err = gitRepo.CreateArchive(
+ graceful.GetManager().ShutdownContext(),
+ archiver.Type,
+ w,
+ setting.Repository.PrefixArchiveFiles,
+ archiver.CommitID,
+ )
+ }
_ = w.CloseWithError(err)
done <- err
}(done, w, archiver, gitRepo)
diff --git a/services/auth/placeholder.go b/services/auth/placeholder.go
index 50e3061885..d9a0ceae7c 100644
--- a/services/auth/placeholder.go
+++ b/services/auth/placeholder.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build !windows
// +build !windows
package auth