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>
This commit is contained in:
parent
d22cb600ed
commit
648464b504
3
build.go
3
build.go
|
@ -2,7 +2,8 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//+build vendor
|
//go:build vendor
|
||||||
|
// +build vendor
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build ignore
|
||||||
// +build ignore
|
// +build ignore
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build ignore
|
||||||
// +build ignore
|
// +build ignore
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build ignore
|
||||||
// +build ignore
|
// +build ignore
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build ignore
|
||||||
// +build ignore
|
// +build ignore
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
// gocovmerge takes the results from multiple `go test -coverprofile` runs and
|
// gocovmerge takes the results from multiple `go test -coverprofile` runs and
|
||||||
// merges them into one profile
|
// merges them into one profile
|
||||||
|
|
||||||
|
//go:build ignore
|
||||||
// +build ignore
|
// +build ignore
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build bindata
|
||||||
// +build bindata
|
// +build bindata
|
||||||
|
|
||||||
package cmd
|
package cmd
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !bindata
|
||||||
// +build !bindata
|
// +build !bindata
|
||||||
|
|
||||||
package cmd
|
package cmd
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
// +build pam
|
|
||||||
|
|
||||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build pam
|
||||||
|
// +build pam
|
||||||
|
|
||||||
package pam
|
package pam
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
// +build !pam
|
|
||||||
|
|
||||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !pam
|
||||||
|
// +build !pam
|
||||||
|
|
||||||
package pam
|
package pam
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build pam
|
||||||
// +build pam
|
// +build pam
|
||||||
|
|
||||||
// Copyright 2021 The Gitea Authors. All rights reserved.
|
// Copyright 2021 The Gitea Authors. All rights reserved.
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build race
|
||||||
// +build race
|
// +build race
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package pipeline
|
package pipeline
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package pipeline
|
package pipeline
|
||||||
|
|
|
@ -13,6 +13,7 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
@ -415,3 +416,33 @@ func GetDivergingCommits(repoPath string, baseBranch string, targetBranch string
|
||||||
|
|
||||||
return DivergeObject{ahead, behind}, nil
|
return DivergeObject{ahead, behind}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreateBundle create bundle content to the target path
|
||||||
|
func (repo *Repository) CreateBundle(ctx context.Context, commit string, out io.Writer) error {
|
||||||
|
tmp, err := os.MkdirTemp(os.TempDir(), "gitea-bundle")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer os.RemoveAll(tmp)
|
||||||
|
|
||||||
|
tmpFile := filepath.Join(tmp, "bundle")
|
||||||
|
args := []string{
|
||||||
|
"bundle",
|
||||||
|
"create",
|
||||||
|
tmpFile,
|
||||||
|
commit,
|
||||||
|
}
|
||||||
|
_, err = NewCommandContext(ctx, args...).RunInDir(repo.Path)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
fi, err := os.Open(tmpFile)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer fi.Close()
|
||||||
|
|
||||||
|
_, err = io.Copy(out, fi)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
|
@ -21,6 +21,8 @@ const (
|
||||||
ZIP ArchiveType = iota + 1
|
ZIP ArchiveType = iota + 1
|
||||||
// TARGZ tar gz archive type
|
// TARGZ tar gz archive type
|
||||||
TARGZ
|
TARGZ
|
||||||
|
// BUNDLE bundle archive type
|
||||||
|
BUNDLE
|
||||||
)
|
)
|
||||||
|
|
||||||
// String converts an ArchiveType to string
|
// String converts an ArchiveType to string
|
||||||
|
@ -30,6 +32,8 @@ func (a ArchiveType) String() string {
|
||||||
return "zip"
|
return "zip"
|
||||||
case TARGZ:
|
case TARGZ:
|
||||||
return "tar.gz"
|
return "tar.gz"
|
||||||
|
case BUNDLE:
|
||||||
|
return "bundle"
|
||||||
}
|
}
|
||||||
return "unknown"
|
return "unknown"
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package git
|
package git
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
// +build !windows
|
|
||||||
|
|
||||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !windows
|
||||||
|
// +build !windows
|
||||||
|
|
||||||
package graceful
|
package graceful
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
// +build windows
|
|
||||||
|
|
||||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
// This code is heavily inspired by the archived gofacebook/gracenet/net.go handler
|
// This code is heavily inspired by the archived gofacebook/gracenet/net.go handler
|
||||||
|
|
||||||
|
//go:build windows
|
||||||
|
// +build windows
|
||||||
|
|
||||||
package graceful
|
package graceful
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
// +build !windows
|
|
||||||
|
|
||||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
// This code is heavily inspired by the archived gofacebook/gracenet/net.go handler
|
// This code is heavily inspired by the archived gofacebook/gracenet/net.go handler
|
||||||
|
|
||||||
|
//go:build !windows
|
||||||
|
// +build !windows
|
||||||
|
|
||||||
package graceful
|
package graceful
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
// +build windows
|
|
||||||
|
|
||||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
// This code is heavily inspired by the archived gofacebook/gracenet/net.go handler
|
// This code is heavily inspired by the archived gofacebook/gracenet/net.go handler
|
||||||
|
|
||||||
|
//go:build windows
|
||||||
|
// +build windows
|
||||||
|
|
||||||
package graceful
|
package graceful
|
||||||
|
|
||||||
import "net"
|
import "net"
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
// +build !windows
|
|
||||||
|
|
||||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
// This code is heavily inspired by the archived gofacebook/gracenet/net.go handler
|
// This code is heavily inspired by the archived gofacebook/gracenet/net.go handler
|
||||||
|
|
||||||
|
//go:build !windows
|
||||||
|
// +build !windows
|
||||||
|
|
||||||
package graceful
|
package graceful
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gogit
|
||||||
// +build gogit
|
// +build gogit
|
||||||
|
|
||||||
package lfs
|
package lfs
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !gogit
|
||||||
// +build !gogit
|
// +build !gogit
|
||||||
|
|
||||||
package lfs
|
package lfs
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
// +build !bindata
|
|
||||||
|
|
||||||
// Copyright 2016 The Gitea Authors. All rights reserved.
|
// Copyright 2016 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !bindata
|
||||||
|
// +build !bindata
|
||||||
|
|
||||||
package options
|
package options
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//+build bindata
|
//go:build bindata
|
||||||
|
// +build bindata
|
||||||
|
|
||||||
package options
|
package options
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
// +build bindata
|
|
||||||
|
|
||||||
// Copyright 2016 The Gitea Authors. All rights reserved.
|
// Copyright 2016 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build bindata
|
||||||
|
// +build bindata
|
||||||
|
|
||||||
package options
|
package options
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
// +build !bindata
|
|
||||||
|
|
||||||
// Copyright 2016 The Gitea Authors. All rights reserved.
|
// Copyright 2016 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !bindata
|
||||||
|
// +build !bindata
|
||||||
|
|
||||||
package public
|
package public
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//+build bindata
|
//go:build bindata
|
||||||
|
// +build bindata
|
||||||
|
|
||||||
package public
|
package public
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
// +build bindata
|
|
||||||
|
|
||||||
// Copyright 2016 The Gitea Authors. All rights reserved.
|
// Copyright 2016 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build bindata
|
||||||
|
// +build bindata
|
||||||
|
|
||||||
package public
|
package public
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build sqlite
|
||||||
// +build sqlite
|
// +build sqlite
|
||||||
|
|
||||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build bindata
|
||||||
// +build bindata
|
// +build bindata
|
||||||
|
|
||||||
package svg
|
package svg
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !bindata
|
||||||
// +build !bindata
|
// +build !bindata
|
||||||
|
|
||||||
package svg
|
package svg
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
// +build !bindata
|
|
||||||
|
|
||||||
// Copyright 2016 The Gitea Authors. All rights reserved.
|
// Copyright 2016 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !bindata
|
||||||
|
// +build !bindata
|
||||||
|
|
||||||
package templates
|
package templates
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
// +build bindata
|
|
||||||
|
|
||||||
// Copyright 2016 The Gitea Authors. All rights reserved.
|
// Copyright 2016 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build bindata
|
||||||
|
// +build bindata
|
||||||
|
|
||||||
package templates
|
package templates
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//+build bindata
|
//go:build bindata
|
||||||
|
// +build bindata
|
||||||
|
|
||||||
package templates
|
package templates
|
||||||
|
|
||||||
|
|
|
@ -771,6 +771,7 @@ use_template = Use this template
|
||||||
clone_in_vsc = Clone in VS Code
|
clone_in_vsc = Clone in VS Code
|
||||||
download_zip = Download ZIP
|
download_zip = Download ZIP
|
||||||
download_tar = Download TAR.GZ
|
download_tar = Download TAR.GZ
|
||||||
|
download_bundle = Download BUNDLE
|
||||||
generate_repo = Generate Repository
|
generate_repo = Generate Repository
|
||||||
generate_from = Generate From
|
generate_from = Generate From
|
||||||
repo_desc = Description
|
repo_desc = Description
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
// +build !windows
|
|
||||||
|
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !windows
|
||||||
|
// +build !windows
|
||||||
|
|
||||||
package private
|
package private
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
// +build windows
|
|
||||||
|
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build windows
|
||||||
|
// +build windows
|
||||||
|
|
||||||
package private
|
package private
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -54,6 +54,9 @@ func NewRequest(repoID int64, repo *git.Repository, uri string) (*ArchiveRequest
|
||||||
case strings.HasSuffix(uri, ".tar.gz"):
|
case strings.HasSuffix(uri, ".tar.gz"):
|
||||||
ext = ".tar.gz"
|
ext = ".tar.gz"
|
||||||
r.Type = git.TARGZ
|
r.Type = git.TARGZ
|
||||||
|
case strings.HasSuffix(uri, ".bundle"):
|
||||||
|
ext = ".bundle"
|
||||||
|
r.Type = git.BUNDLE
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("Unknown format: %s", uri)
|
return nil, fmt.Errorf("Unknown format: %s", uri)
|
||||||
}
|
}
|
||||||
|
@ -165,13 +168,21 @@ func doArchive(r *ArchiveRequest) (*models.RepoArchiver, error) {
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
err = gitRepo.CreateArchive(
|
if archiver.Type == git.BUNDLE {
|
||||||
graceful.GetManager().ShutdownContext(),
|
err = gitRepo.CreateBundle(
|
||||||
archiver.Type,
|
graceful.GetManager().ShutdownContext(),
|
||||||
w,
|
archiver.CommitID,
|
||||||
setting.Repository.PrefixArchiveFiles,
|
w,
|
||||||
archiver.CommitID,
|
)
|
||||||
)
|
} else {
|
||||||
|
err = gitRepo.CreateArchive(
|
||||||
|
graceful.GetManager().ShutdownContext(),
|
||||||
|
archiver.Type,
|
||||||
|
w,
|
||||||
|
setting.Repository.PrefixArchiveFiles,
|
||||||
|
archiver.CommitID,
|
||||||
|
)
|
||||||
|
}
|
||||||
_ = w.CloseWithError(err)
|
_ = w.CloseWithError(err)
|
||||||
done <- err
|
done <- err
|
||||||
}(done, w, archiver, gitRepo)
|
}(done, w, archiver, gitRepo)
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !windows
|
||||||
// +build !windows
|
// +build !windows
|
||||||
|
|
||||||
package auth
|
package auth
|
||||||
|
|
|
@ -118,6 +118,7 @@
|
||||||
</a>
|
</a>
|
||||||
<a class="item archive-link" data-url="{{$.RepoLink}}/archive/{{EscapePound $.BranchName}}.zip">{{svg "octicon-file-zip"}} {{.i18n.Tr "repo.download_zip"}}</a>
|
<a class="item archive-link" data-url="{{$.RepoLink}}/archive/{{EscapePound $.BranchName}}.zip">{{svg "octicon-file-zip"}} {{.i18n.Tr "repo.download_zip"}}</a>
|
||||||
<a class="item archive-link" data-url="{{$.RepoLink}}/archive/{{EscapePound $.BranchName}}.tar.gz">{{svg "octicon-file-zip"}} {{.i18n.Tr "repo.download_tar"}}</a>
|
<a class="item archive-link" data-url="{{$.RepoLink}}/archive/{{EscapePound $.BranchName}}.tar.gz">{{svg "octicon-file-zip"}} {{.i18n.Tr "repo.download_tar"}}</a>
|
||||||
|
<a class="item archive-link" data-url="{{$.RepoLink}}/archive/{{EscapePound $.BranchName}}.bundle">{{svg "octicon-package"}} {{.i18n.Tr "repo.download_bundle"}}</a>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build gofuzz
|
||||||
// +build gofuzz
|
// +build gofuzz
|
||||||
|
|
||||||
package fuzz
|
package fuzz
|
||||||
|
|
Loading…
Reference in New Issue