MCPcopy Create free account
hub / github.com/gogs/gogs / CheckoutNewBranch

Method CheckoutNewBranch

internal/database/repo_editor.go:109–117  ·  view source on GitHub ↗

CheckoutNewBranch checks out to a new branch from the a branch name.

(oldBranch, newBranch string)

Source from the content-addressed store, hash-verified

107
108// CheckoutNewBranch checks out to a new branch from the a branch name.
109func (r *Repository) CheckoutNewBranch(oldBranch, newBranch string) error {
110 if err := git.Checkout(r.LocalCopyPath(), newBranch, git.CheckoutOptions{
111 BaseBranch: oldBranch,
112 Timeout: time.Duration(conf.Git.Timeout.Pull) * time.Second,
113 }); err != nil {
114 return errors.Newf("checkout [base: %s, new: %s]: %v", oldBranch, newBranch, err)
115 }
116 return nil
117}
118
119// hasSymlinkInPath returns true if there is any symlink in path hierarchy using
120// the given base and relative path.

Callers 4

UpdateRepoFileMethod · 0.95
DeleteRepoFileMethod · 0.95
UploadRepoFilesMethod · 0.95
CreateNewBranchMethod · 0.95

Implementers 2

Repositoryinternal/database/repo.go
mailerRepointernal/database/issue_mail.go

Calls 1

LocalCopyPathMethod · 0.95

Tested by

no test coverage detected