mirror of
https://github.com/go-gitea/gitea.git
synced 2026-06-12 11:32:32 +02:00
Revert "doDeleteCommitAndPush implemented"
This reverts commit e9c29f82f24ded9adcba4c14acb17ada5e886127.
This commit is contained in:
parent
51a769720f
commit
2cbdee0104
@ -100,14 +100,6 @@ func AddChangesWithArgs(repoPath string, globalArgs TrustedCmdArgs, all bool, fi
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteChangesWithArgs marks local changes to be ready for commit.
|
||||
func DeleteChangesWithArgs(repoPath string, globalArgs TrustedCmdArgs, files ...string) error {
|
||||
cmd := NewCommandContextNoGlobals(DefaultContext, globalArgs...).AddArguments("rm")
|
||||
cmd.AddDashesAndList(files...)
|
||||
_, _, err := cmd.RunStdString(&RunOpts{Dir: repoPath})
|
||||
return err
|
||||
}
|
||||
|
||||
// CommitChangesOptions the options when a commit created
|
||||
type CommitChangesOptions struct {
|
||||
Committer *Signature
|
||||
|
||||
@ -102,11 +102,14 @@ func testGit(t *testing.T, u *url.URL) {
|
||||
})
|
||||
t.Run("Deletion", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
filename := doCommitAndPush(t, bigSize, dstForkedPath, "data-file-")
|
||||
t.Run("APISetRepoSizeLimit", doAPISetRepoSizeLimit(forkedUserCtx, forkedUserCtx.Username, forkedUserCtx.Reponame, littleSize))
|
||||
err := doDeleteCommitAndPush(t, dstPath, filename)
|
||||
assert.Error(t, err)
|
||||
// TODO doDeleteCommitAndPush(t, littleSize, dstPath, "data-file-")
|
||||
})
|
||||
// TODO delete branch
|
||||
// TODO delete tag
|
||||
// TODO add big commit that will be over with the push
|
||||
// TODO add lfs
|
||||
// TODO remove lfs
|
||||
// TODO add missing case
|
||||
})
|
||||
t.Run("CreateAgitFlowPull", doCreateAgitFlowPull(dstPath, &httpContext, "master", "test/head"))
|
||||
t.Run("BranchProtectMerge", doBranchProtectPRMerge(&httpContext, dstPath))
|
||||
@ -330,15 +333,6 @@ func doCommitAndPush(t *testing.T, size int, repoPath, prefix string) string {
|
||||
return name
|
||||
}
|
||||
|
||||
func doDeleteCommitAndPush(t *testing.T, repoPath, filename string) error {
|
||||
var err = generateDeleteCommit(repoPath, "user2@example.com", "User Two", filename)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, _, err = git.NewCommand(git.DefaultContext, "push", "origin", "master").RunStdString(&git.RunOpts{Dir: repoPath}) // Push
|
||||
return err
|
||||
}
|
||||
|
||||
func doCommitAndPushWithExpectedError(t *testing.T, size int, repoPath, prefix string) string {
|
||||
name, err := generateCommitWithNewData(size, repoPath, "user2@example.com", "User Two", prefix)
|
||||
assert.NoError(t, err)
|
||||
@ -404,30 +398,6 @@ func generateCommitWithNewData(size int, repoPath, email, fullName, prefix strin
|
||||
return filepath.Base(tmpFile.Name()), err
|
||||
}
|
||||
|
||||
func generateDeleteCommit(repoPath, email, fullName, file string) error {
|
||||
// Commit
|
||||
// Now here we should explicitly allow lfs filters to run
|
||||
globalArgs := git.AllowLFSFiltersArgs()
|
||||
err := git.DeleteChangesWithArgs(repoPath, globalArgs, filepath.Base(file))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = git.CommitChangesWithArgs(repoPath, globalArgs, git.CommitChangesOptions{
|
||||
Committer: &git.Signature{
|
||||
Email: email,
|
||||
Name: fullName,
|
||||
When: time.Now(),
|
||||
},
|
||||
Author: &git.Signature{
|
||||
Email: email,
|
||||
Name: fullName,
|
||||
When: time.Now(),
|
||||
},
|
||||
Message: fmt.Sprintf("Testing commit @ %v", time.Now()),
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
func doBranchProtectPRMerge(baseCtx *APITestContext, dstPath string) func(t *testing.T) {
|
||||
return func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user