aboutsummaryrefslogtreecommitdiffstats
path: root/modules/git
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2024-05-07 01:02:30 +0800
committerGitHub <noreply@github.com>2024-05-06 17:02:30 +0000
commit9c08637eae8c3a44d15e62d85144e07ae9dabbec (patch)
tree464831c1d31b9a32f36f3bb2d705a93d52c22638 /modules/git
parent7c613f100e032f821df88a75954fc50b1cf2f926 (diff)
downloadgitea-9c08637eae8c3a44d15e62d85144e07ae9dabbec.tar.gz
gitea-9c08637eae8c3a44d15e62d85144e07ae9dabbec.zip
Make "sync branch" also sync object format and add tests (#30878)
Diffstat (limited to 'modules/git')
-rw-r--r--modules/git/repo.go27
1 files changed, 0 insertions, 27 deletions
diff --git a/modules/git/repo.go b/modules/git/repo.go
index d4e1669bec..1c223018ad 100644
--- a/modules/git/repo.go
+++ b/modules/git/repo.go
@@ -7,7 +7,6 @@ package git
import (
"bytes"
"context"
- "errors"
"fmt"
"io"
"net/url"
@@ -63,32 +62,6 @@ func IsRepoURLAccessible(ctx context.Context, url string) bool {
return err == nil
}
-// GetObjectFormatOfRepo returns the hash type of repository at a given path
-func GetObjectFormatOfRepo(ctx context.Context, repoPath string) (ObjectFormat, error) {
- var stdout, stderr strings.Builder
-
- err := NewCommand(ctx, "hash-object", "--stdin").Run(&RunOpts{
- Dir: repoPath,
- Stdout: &stdout,
- Stderr: &stderr,
- Stdin: &strings.Reader{},
- })
- if err != nil {
- return nil, err
- }
-
- if stderr.Len() > 0 {
- return nil, errors.New(stderr.String())
- }
-
- h, err := NewIDFromString(strings.TrimRight(stdout.String(), "\n"))
- if err != nil {
- return nil, err
- }
-
- return h.Type(), nil
-}
-
// InitRepository initializes a new Git repository.
func InitRepository(ctx context.Context, repoPath string, bare bool, objectFormatName string) error {
err := os.MkdirAll(repoPath, os.ModePerm)