// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
-//+build vendor
+//go:build vendor
+// +build vendor
package main
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
package main
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
package main
+//go:build ignore
// +build ignore
package main
+//go:build ignore
// +build ignore
package main
// gocovmerge takes the results from multiple `go test -coverprofile` runs and
// merges them into one profile
+//go:build ignore
// +build ignore
package main
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build bindata
// +build bindata
package cmd
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build !bindata
// +build !bindata
package cmd
-// +build pam
-
// Copyright 2014 The Gogs Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build pam
+// +build pam
+
package pam
import (
-// +build !pam
-
// Copyright 2014 The Gogs Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build !pam
+// +build !pam
+
package pam
import (
+//go:build pam
// +build pam
// Copyright 2021 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build gogit
// +build gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build !gogit
// +build !gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build race
// +build race
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build gogit
// +build gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build gogit
// +build gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build !gogit
// +build !gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build gogit
// +build gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build !gogit
// +build !gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build gogit
// +build gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build !gogit
// +build !gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build gogit
// +build gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build gogit
// +build gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build !gogit
// +build !gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build !gogit
// +build !gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build gogit
// +build gogit
package pipeline
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build !gogit
// +build !gogit
package pipeline
"net/url"
"os"
"path"
+ "path/filepath"
"strconv"
"strings"
"time"
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
+}
ZIP ArchiveType = iota + 1
// TARGZ tar gz archive type
TARGZ
+ // BUNDLE bundle archive type
+ BUNDLE
)
// String converts an ArchiveType to string
return "zip"
case TARGZ:
return "tar.gz"
+ case BUNDLE:
+ return "bundle"
}
return "unknown"
}
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build gogit
// +build gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build !gogit
// +build !gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build gogit
// +build gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build !gogit
// +build !gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build gogit
// +build gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build !gogit
// +build !gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build gogit
// +build gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build !gogit
// +build !gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build gogit
// +build gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build gogit
// +build gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build !gogit
// +build !gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build gogit
// +build gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build !gogit
// +build !gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build gogit
// +build gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build !gogit
// +build !gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build gogit
// +build gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build !gogit
// +build !gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build gogit
// +build gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build !gogit
// +build !gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build gogit
// +build gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build !gogit
// +build !gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build gogit
// +build gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build !gogit
// +build !gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build gogit
// +build gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build !gogit
// +build !gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build gogit
// +build gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build gogit
// +build gogit
package git
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build !gogit
// +build !gogit
package git
-// +build !windows
-
// Copyright 2019 The Gitea Authors. All rights reserved.
// 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 graceful
import (
-// +build windows
-
// Copyright 2019 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
// This code is heavily inspired by the archived gofacebook/gracenet/net.go handler
+//go:build windows
+// +build windows
+
package graceful
import (
-// +build !windows
-
// Copyright 2019 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
// This code is heavily inspired by the archived gofacebook/gracenet/net.go handler
+//go:build !windows
+// +build !windows
+
package graceful
import (
-// +build windows
-
// Copyright 2019 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
// This code is heavily inspired by the archived gofacebook/gracenet/net.go handler
+//go:build windows
+// +build windows
+
package graceful
import "net"
-// +build !windows
-
// Copyright 2019 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
// This code is heavily inspired by the archived gofacebook/gracenet/net.go handler
+//go:build !windows
+// +build !windows
+
package graceful
import (
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build gogit
// +build gogit
package lfs
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build !gogit
// +build !gogit
package lfs
-// +build !bindata
-
// Copyright 2016 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build !bindata
+// +build !bindata
+
package options
import (
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
-//+build bindata
+//go:build bindata
+// +build bindata
package options
-// +build bindata
-
// Copyright 2016 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build bindata
+// +build bindata
+
package options
import (
-// +build !bindata
-
// Copyright 2016 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build !bindata
+// +build !bindata
+
package public
import (
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
-//+build bindata
+//go:build bindata
+// +build bindata
package public
-// +build bindata
-
// Copyright 2016 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build bindata
+// +build bindata
+
package public
import (
+//go:build sqlite
// +build sqlite
// Copyright 2014 The Gogs Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build bindata
// +build bindata
package svg
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build !bindata
// +build !bindata
package svg
-// +build !bindata
-
// Copyright 2016 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build !bindata
+// +build !bindata
+
package templates
import (
-// +build bindata
-
// Copyright 2016 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build bindata
+// +build bindata
+
package templates
import (
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
-//+build bindata
+//go:build bindata
+// +build bindata
package templates
clone_in_vsc = Clone in VS Code
download_zip = Download ZIP
download_tar = Download TAR.GZ
+download_bundle = Download BUNDLE
generate_repo = Generate Repository
generate_from = Generate From
repo_desc = Description
-// +build !windows
-
// Copyright 2020 The Gitea Authors. All rights reserved.
// 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 private
import (
-// +build windows
-
// Copyright 2020 The Gitea Authors. All rights reserved.
// 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 private
import (
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)
}
}
}()
- 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)
// 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
</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}}.bundle">{{svg "octicon-package"}} {{.i18n.Tr "repo.download_bundle"}}</a>
</div>
</button>
</div>
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
+//go:build gofuzz
// +build gofuzz
package fuzz