summaryrefslogtreecommitdiffstats
path: root/modules/git/repo.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/git/repo.go')
-rw-r--r--modules/git/repo.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/modules/git/repo.go b/modules/git/repo.go
index 881a76c87f..ff704138a7 100644
--- a/modules/git/repo.go
+++ b/modules/git/repo.go
@@ -58,7 +58,7 @@ func (repo *Repository) parsePrettyFormatLogToList(logs []byte) ([]*Commit, erro
// IsRepoURLAccessible checks if given repository URL is accessible.
func IsRepoURLAccessible(ctx context.Context, url string) bool {
- _, err := NewCommandContext(ctx, "ls-remote", "-q", "-h", url, "HEAD").Run()
+ _, err := NewCommand(ctx, "ls-remote", "-q", "-h", url, "HEAD").Run()
return err == nil
}
@@ -69,7 +69,7 @@ func InitRepository(ctx context.Context, repoPath string, bare bool) error {
return err
}
- cmd := NewCommandContext(ctx, "init")
+ cmd := NewCommand(ctx, "init")
if bare {
cmd.AddArguments("--bare")
}
@@ -80,7 +80,7 @@ func InitRepository(ctx context.Context, repoPath string, bare bool) error {
// IsEmpty Check if repository is empty.
func (repo *Repository) IsEmpty() (bool, error) {
var errbuf, output strings.Builder
- if err := NewCommandContext(repo.Ctx, "rev-list", "--all", "--count", "--max-count=1").
+ if err := NewCommand(repo.Ctx, "rev-list", "--all", "--count", "--max-count=1").
RunWithContext(&RunContext{
Timeout: -1,
Dir: repo.Path,
@@ -187,7 +187,7 @@ type PushOptions struct {
// Push pushs local commits to given remote branch.
func Push(ctx context.Context, repoPath string, opts PushOptions) error {
- cmd := NewCommandContext(ctx, "push")
+ cmd := NewCommand(ctx, "push")
if opts.Force {
cmd.AddArguments("-f")
}
@@ -239,7 +239,7 @@ func Push(ctx context.Context, repoPath string, opts PushOptions) error {
// GetLatestCommitTime returns time for latest commit in repository (across all branches)
func GetLatestCommitTime(ctx context.Context, repoPath string) (time.Time, error) {
- cmd := NewCommandContext(ctx, "for-each-ref", "--sort=-committerdate", BranchPrefix, "--count", "1", "--format=%(committerdate)")
+ cmd := NewCommand(ctx, "for-each-ref", "--sort=-committerdate", BranchPrefix, "--count", "1", "--format=%(committerdate)")
stdout, err := cmd.RunInDir(repoPath)
if err != nil {
return time.Time{}, err
@@ -256,7 +256,7 @@ type DivergeObject struct {
func checkDivergence(ctx context.Context, repoPath, baseBranch, targetBranch string) (int, error) {
branches := fmt.Sprintf("%s..%s", baseBranch, targetBranch)
- cmd := NewCommandContext(ctx, "rev-list", "--count", branches)
+ cmd := NewCommand(ctx, "rev-list", "--count", branches)
stdout, err := cmd.RunInDir(repoPath)
if err != nil {
return -1, err
@@ -294,23 +294,23 @@ func (repo *Repository) CreateBundle(ctx context.Context, commit string, out io.
defer os.RemoveAll(tmp)
env := append(os.Environ(), "GIT_OBJECT_DIRECTORY="+filepath.Join(repo.Path, "objects"))
- _, err = NewCommandContext(ctx, "init", "--bare").RunInDirWithEnv(tmp, env)
+ _, err = NewCommand(ctx, "init", "--bare").RunInDirWithEnv(tmp, env)
if err != nil {
return err
}
- _, err = NewCommandContext(ctx, "reset", "--soft", commit).RunInDirWithEnv(tmp, env)
+ _, err = NewCommand(ctx, "reset", "--soft", commit).RunInDirWithEnv(tmp, env)
if err != nil {
return err
}
- _, err = NewCommandContext(ctx, "branch", "-m", "bundle").RunInDirWithEnv(tmp, env)
+ _, err = NewCommand(ctx, "branch", "-m", "bundle").RunInDirWithEnv(tmp, env)
if err != nil {
return err
}
tmpFile := filepath.Join(tmp, "bundle")
- _, err = NewCommandContext(ctx, "bundle", "create", tmpFile, "bundle", "HEAD").RunInDirWithEnv(tmp, env)
+ _, err = NewCommand(ctx, "bundle", "create", tmpFile, "bundle", "HEAD").RunInDirWithEnv(tmp, env)
if err != nil {
return err
}