mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-03 21:08:25 +00:00 
			
		
		
		
	* Change tests to make it possible to run TestGit with 1.7.2 * Make merge run on 1.7.2 * Fix tracking and staging branch name problem * Ensure that git 1.7.2 works on tests * ensure that there is no chance for conflicts * Fix-up missing merge issues * Final rm * Ensure LFS filters run on the tests * Do not sign commits from temp repo * Apply suggestions from code review * Update modules/repofiles/temp_repo.go
This commit is contained in:
		@@ -165,7 +165,7 @@ func (repo *Repository) AddRemote(name, url string, fetch bool) error {
 | 
			
		||||
 | 
			
		||||
// RemoveRemote removes a remote from repository.
 | 
			
		||||
func (repo *Repository) RemoveRemote(name string) error {
 | 
			
		||||
	_, err := NewCommand("remote", "remove", name).RunInDir(repo.Path)
 | 
			
		||||
	_, err := NewCommand("remote", "rm", name).RunInDir(repo.Path)
 | 
			
		||||
	return err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -6,11 +6,13 @@
 | 
			
		||||
package git
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"os"
 | 
			
		||||
	"strings"
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	"github.com/mcuadros/go-version"
 | 
			
		||||
	"gopkg.in/src-d/go-git.v4/plumbing"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@@ -63,6 +65,11 @@ type CommitTreeOpts struct {
 | 
			
		||||
 | 
			
		||||
// CommitTree creates a commit from a given tree id for the user with provided message
 | 
			
		||||
func (repo *Repository) CommitTree(sig *Signature, tree *Tree, opts CommitTreeOpts) (SHA1, error) {
 | 
			
		||||
	binVersion, err := BinVersion()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return SHA1{}, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	commitTimeStr := time.Now().Format(time.RFC3339)
 | 
			
		||||
 | 
			
		||||
	// Because this may call hooks we should pass in the environment
 | 
			
		||||
@@ -80,20 +87,24 @@ func (repo *Repository) CommitTree(sig *Signature, tree *Tree, opts CommitTreeOp
 | 
			
		||||
		cmd.AddArguments("-p", parent)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	cmd.AddArguments("-m", opts.Message)
 | 
			
		||||
	messageBytes := new(bytes.Buffer)
 | 
			
		||||
	_, _ = messageBytes.WriteString(opts.Message)
 | 
			
		||||
	_, _ = messageBytes.WriteString("\n")
 | 
			
		||||
 | 
			
		||||
	if opts.KeyID != "" {
 | 
			
		||||
		cmd.AddArguments(fmt.Sprintf("-S%s", opts.KeyID))
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if opts.NoGPGSign {
 | 
			
		||||
	if version.Compare(binVersion, "2.0.0", ">=") && opts.NoGPGSign {
 | 
			
		||||
		cmd.AddArguments("--no-gpg-sign")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	res, err := cmd.RunInDirWithEnv(repo.Path, env)
 | 
			
		||||
	stdout := new(bytes.Buffer)
 | 
			
		||||
	stderr := new(bytes.Buffer)
 | 
			
		||||
	err = cmd.RunInDirTimeoutEnvFullPipeline(env, -1, repo.Path, stdout, stderr, messageBytes)
 | 
			
		||||
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return SHA1{}, err
 | 
			
		||||
		return SHA1{}, concatenateError(err, stderr.String())
 | 
			
		||||
	}
 | 
			
		||||
	return NewIDFromString(strings.TrimSpace(res))
 | 
			
		||||
	return NewIDFromString(strings.TrimSpace(stdout.String()))
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user