aboutsummaryrefslogtreecommitdiff
path: root/internal/db/repo_editor.go
diff options
context:
space:
mode:
authordependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2022-03-22 00:55:36 +0800
committerGitHub <noreply@github.com>2022-03-22 00:55:36 +0800
commit3c49a6173d9cdf339f4a27d427a4cfc3dd51a24f (patch)
tree4ed73e5a8ea82695a073b74fd9b53a874f7bfca7 /internal/db/repo_editor.go
parentd66fe583d5f1e0ea5b50aa478ae1dcf3bd69fe7c (diff)
mod: bump github.com/gogs/git-module from 1.2.0 to 1.4.0 (#6866)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Joe Chen <jc@unknwon.io>
Diffstat (limited to 'internal/db/repo_editor.go')
-rw-r--r--internal/db/repo_editor.go26
1 files changed, 13 insertions, 13 deletions
diff --git a/internal/db/repo_editor.go b/internal/db/repo_editor.go
index 99f982ab..cf2426f6 100644
--- a/internal/db/repo_editor.go
+++ b/internal/db/repo_editor.go
@@ -87,7 +87,7 @@ func discardLocalRepoBranchChanges(localPath, branch string) error {
}
rev := "origin/" + branch
- if err := git.RepoReset(localPath, rev, git.ResetOptions{Hard: true}); err != nil {
+ if err := git.Reset(localPath, rev, git.ResetOptions{Hard: true}); err != nil {
return fmt.Errorf("reset [revision: %s]: %v", rev, err)
}
return nil
@@ -99,7 +99,7 @@ func (repo *Repository) DiscardLocalRepoBranchChanges(branch string) error {
// CheckoutNewBranch checks out to a new branch from the a branch name.
func (repo *Repository) CheckoutNewBranch(oldBranch, newBranch string) error {
- if err := git.RepoCheckout(repo.LocalCopyPath(), newBranch, git.CheckoutOptions{
+ if err := git.Checkout(repo.LocalCopyPath(), newBranch, git.CheckoutOptions{
BaseBranch: oldBranch,
Timeout: time.Duration(conf.Git.Timeout.Pull) * time.Second,
}); err != nil {
@@ -141,7 +141,7 @@ func (repo *Repository) UpdateRepoFile(doer *User, opts UpdateRepoFileOptions) (
// Otherwise, delete branch from local copy in case out of sync
if git.RepoHasBranch(localPath, opts.NewBranch) {
- if err = git.RepoDeleteBranch(localPath, opts.NewBranch, git.DeleteBranchOptions{
+ if err = git.DeleteBranch(localPath, opts.NewBranch, git.DeleteBranchOptions{
Force: true,
}); err != nil {
return fmt.Errorf("delete branch %q: %v", opts.NewBranch, err)
@@ -169,7 +169,7 @@ func (repo *Repository) UpdateRepoFile(doer *User, opts UpdateRepoFileOptions) (
// Ignore move step if it's a new file under a directory.
// Otherwise, move the file when name changed.
if osutil.IsFile(oldFilePath) && opts.OldTreeName != opts.NewTreeName {
- if err = git.RepoMove(localPath, opts.OldTreeName, opts.NewTreeName); err != nil {
+ if err = git.Move(localPath, opts.OldTreeName, opts.NewTreeName); err != nil {
return fmt.Errorf("git mv %q %q: %v", opts.OldTreeName, opts.NewTreeName, err)
}
}
@@ -178,9 +178,9 @@ func (repo *Repository) UpdateRepoFile(doer *User, opts UpdateRepoFileOptions) (
return fmt.Errorf("write file: %v", err)
}
- if err = git.RepoAdd(localPath, git.AddOptions{All: true}); err != nil {
+ if err = git.Add(localPath, git.AddOptions{All: true}); err != nil {
return fmt.Errorf("git add --all: %v", err)
- } else if err = git.RepoCommit(localPath, doer.NewGitSig(), opts.Message); err != nil {
+ } else if err = git.CreateCommit(localPath, doer.NewGitSig(), opts.Message); err != nil {
return fmt.Errorf("commit changes on %q: %v", localPath, err)
}
@@ -192,7 +192,7 @@ func (repo *Repository) UpdateRepoFile(doer *User, opts UpdateRepoFileOptions) (
RepoName: repo.Name,
RepoPath: repo.RepoPath(),
})
- if err = git.RepoPush(localPath, "origin", opts.NewBranch, git.PushOptions{Envs: envs}); err != nil {
+ if err = git.Push(localPath, "origin", opts.NewBranch, git.PushOptions{Envs: envs}); err != nil {
return fmt.Errorf("git push origin %s: %v", opts.NewBranch, err)
}
return nil
@@ -283,9 +283,9 @@ func (repo *Repository) DeleteRepoFile(doer *User, opts DeleteRepoFileOptions) (
return fmt.Errorf("remove file %q: %v", opts.TreePath, err)
}
- if err = git.RepoAdd(localPath, git.AddOptions{All: true}); err != nil {
+ if err = git.Add(localPath, git.AddOptions{All: true}); err != nil {
return fmt.Errorf("git add --all: %v", err)
- } else if err = git.RepoCommit(localPath, doer.NewGitSig(), opts.Message); err != nil {
+ } else if err = git.CreateCommit(localPath, doer.NewGitSig(), opts.Message); err != nil {
return fmt.Errorf("commit changes to %q: %v", localPath, err)
}
@@ -297,7 +297,7 @@ func (repo *Repository) DeleteRepoFile(doer *User, opts DeleteRepoFileOptions) (
RepoName: repo.Name,
RepoPath: repo.RepoPath(),
})
- if err = git.RepoPush(localPath, "origin", opts.NewBranch, git.PushOptions{Envs: envs}); err != nil {
+ if err = git.Push(localPath, "origin", opts.NewBranch, git.PushOptions{Envs: envs}); err != nil {
return fmt.Errorf("git push origin %s: %v", opts.NewBranch, err)
}
return nil
@@ -507,9 +507,9 @@ func (repo *Repository) UploadRepoFiles(doer *User, opts UploadRepoFileOptions)
}
}
- if err = git.RepoAdd(localPath, git.AddOptions{All: true}); err != nil {
+ if err = git.Add(localPath, git.AddOptions{All: true}); err != nil {
return fmt.Errorf("git add --all: %v", err)
- } else if err = git.RepoCommit(localPath, doer.NewGitSig(), opts.Message); err != nil {
+ } else if err = git.CreateCommit(localPath, doer.NewGitSig(), opts.Message); err != nil {
return fmt.Errorf("commit changes on %q: %v", localPath, err)
}
@@ -521,7 +521,7 @@ func (repo *Repository) UploadRepoFiles(doer *User, opts UploadRepoFileOptions)
RepoName: repo.Name,
RepoPath: repo.RepoPath(),
})
- if err = git.RepoPush(localPath, "origin", opts.NewBranch, git.PushOptions{Envs: envs}); err != nil {
+ if err = git.Push(localPath, "origin", opts.NewBranch, git.PushOptions{Envs: envs}); err != nil {
return fmt.Errorf("git push origin %s: %v", opts.NewBranch, err)
}