mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-07 09:57:07 +02:00
Revert "doDeleteCommitAndPush implemented"
This reverts commit e9c29f82f2.
This commit is contained in:
1 parent
51a769720f
commit
2cbdee0104
2 files changed
+7
-45
No files matched your search
@@ -100,14 +100,6 @@ func AddChangesWithArgs(repoPath string, globalArgs TrustedCmdArgs, all bool, fi
|
|||||||
return err
|
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
|
// CommitChangesOptions the options when a commit created
|
||||||
type CommitChangesOptions struct {
|
type CommitChangesOptions struct {
|
||||||
Committer *Signature
|
Committer *Signature
|
||||||
|
|||||||
@@ -102,11 +102,14 @@ func testGit(t *testing.T, u *url.URL) {
|
|||||||
})
|
})
|
||||||
t.Run("Deletion", func(t *testing.T) {
|
t.Run("Deletion", func(t *testing.T) {
|
||||||
defer tests.PrintCurrentTest(t)()
|
defer tests.PrintCurrentTest(t)()
|
||||||
filename := doCommitAndPush(t, bigSize, dstForkedPath, "data-file-")
|
// TODO doDeleteCommitAndPush(t, littleSize, dstPath, "data-file-")
|
||||||
t.Run("APISetRepoSizeLimit", doAPISetRepoSizeLimit(forkedUserCtx, forkedUserCtx.Username, forkedUserCtx.Reponame, littleSize))
|
|
||||||
err := doDeleteCommitAndPush(t, dstPath, filename)
|
|
||||||
assert.Error(t, err)
|
|
||||||
})
|
})
|
||||||
|
// 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("CreateAgitFlowPull", doCreateAgitFlowPull(dstPath, &httpContext, "master", "test/head"))
|
||||||
t.Run("BranchProtectMerge", doBranchProtectPRMerge(&httpContext, dstPath))
|
t.Run("BranchProtectMerge", doBranchProtectPRMerge(&httpContext, dstPath))
|
||||||
@@ -330,15 +333,6 @@ func doCommitAndPush(t *testing.T, size int, repoPath, prefix string) string {
|
|||||||
return name
|
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 {
|
func doCommitAndPushWithExpectedError(t *testing.T, size int, repoPath, prefix string) string {
|
||||||
name, err := generateCommitWithNewData(size, repoPath, "user2@example.com", "User Two", prefix)
|
name, err := generateCommitWithNewData(size, repoPath, "user2@example.com", "User Two", prefix)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
@@ -404,30 +398,6 @@ func generateCommitWithNewData(size int, repoPath, email, fullName, prefix strin
|
|||||||
return filepath.Base(tmpFile.Name()), err
|
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) {
|
func doBranchProtectPRMerge(baseCtx *APITestContext, dstPath string) func(t *testing.T) {
|
||||||
return func(t *testing.T) {
|
return func(t *testing.T) {
|
||||||
defer tests.PrintCurrentTest(t)()
|
defer tests.PrintCurrentTest(t)()
|
||||||
|
|||||||
Reference in new issue
Block a user