forked from forgejo/forgejo
Restore deleted branches when syncing (#29898)
Regression of #29493. If a branch has been deleted, repushing it won't restore it. Lunny may have noticed that, but I didn't delve into the comment then overlooked it: https://github.com/go-gitea/gitea/pull/29493#discussion_r1509046867 The additional comments added are to explain the issue I found during testing, which are unrelated to the fixes. (cherry picked from commit f371f84fa3456c2a71470632b6458d81e4892a54)
This commit is contained in:
parent
e358500519
commit
18e95af24f
2 changed files with 21 additions and 0 deletions
|
@ -69,6 +69,23 @@ func testGitPush(t *testing.T, u *url.URL) {
|
|||
return pushed, deleted
|
||||
})
|
||||
})
|
||||
|
||||
t.Run("Push to deleted branch", func(t *testing.T) {
|
||||
runTestGitPush(t, u, func(t *testing.T, gitPath string) (pushed, deleted []string) {
|
||||
doGitPushTestRepository(gitPath, "origin", "master")(t) // make sure master is the default branch instead of a branch we are going to delete
|
||||
pushed = append(pushed, "master")
|
||||
|
||||
doGitCreateBranch(gitPath, "branch-1")(t)
|
||||
doGitPushTestRepository(gitPath, "origin", "branch-1")(t)
|
||||
pushed = append(pushed, "branch-1")
|
||||
|
||||
// delete and restore
|
||||
doGitPushTestRepository(gitPath, "origin", "--delete", "branch-1")(t)
|
||||
doGitPushTestRepository(gitPath, "origin", "branch-1")(t)
|
||||
|
||||
return pushed, deleted
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
func runTestGitPush(t *testing.T, u *url.URL, gitOperation func(t *testing.T, gitPath string) (pushed, deleted []string)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue