mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-20 14:00:04 +02:00
Fix dump and restore respository (#16698)
* Fix dump and restore * return different error message for get commit * Fix missing delete release attachment when deleting repository * Fix ci and add some comments Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
parent
c0f5da3e1a
commit
8d7704b5a2
6 changed files with 17 additions and 4 deletions
|
@ -11,6 +11,7 @@ import (
|
|||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
@ -481,7 +482,9 @@ func (g *RepositoryDumper) CreatePullRequests(prs ...*base.PullRequest) error {
|
|||
if err != nil {
|
||||
log.Error("Fetch branch from %s failed: %v", pr.Head.CloneURL, err)
|
||||
} else {
|
||||
headBranch := filepath.Join(g.gitPath(), "refs", "heads", pr.Head.OwnerName, pr.Head.Ref)
|
||||
// a new branch name with <original_owner_name/original_branchname> will be created to as new head branch
|
||||
ref := path.Join(pr.Head.OwnerName, pr.Head.Ref)
|
||||
headBranch := filepath.Join(g.gitPath(), "refs", "heads", ref)
|
||||
if err := os.MkdirAll(filepath.Dir(headBranch), os.ModePerm); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -494,10 +497,14 @@ func (g *RepositoryDumper) CreatePullRequests(prs ...*base.PullRequest) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
pr.Head.Ref = ref
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// whatever it's a forked repo PR, we have to change head info as the same as the base info
|
||||
pr.Head.OwnerName = pr.Base.OwnerName
|
||||
pr.Head.RepoName = pr.Base.RepoName
|
||||
}
|
||||
|
||||
var err error
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue