aboutsummaryrefslogtreecommitdiff
path: root/internal/db
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
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')
-rw-r--r--internal/db/action.go2
-rw-r--r--internal/db/mirror.go4
-rw-r--r--internal/db/pull.go8
-rw-r--r--internal/db/repo.go6
-rw-r--r--internal/db/repo_editor.go26
-rw-r--r--internal/db/wiki.go12
6 files changed, 29 insertions, 29 deletions
diff --git a/internal/db/action.go b/internal/db/action.go
index 970ff203..2bb02d39 100644
--- a/internal/db/action.go
+++ b/internal/db/action.go
@@ -267,7 +267,7 @@ func (pc *PushCommits) ToApiPayloadCommits(repoPath, repoURL string) ([]*api.Pay
return nil, fmt.Errorf("get user by email: %v", err)
}
- nameStatus, err := git.RepoShowNameStatus(repoPath, commit.Sha1)
+ nameStatus, err := git.ShowNameStatus(repoPath, commit.Sha1)
if err != nil {
return nil, fmt.Errorf("show name status [commit_sha1: %s]: %v", commit.Sha1, err)
}
diff --git a/internal/db/mirror.go b/internal/db/mirror.go
index 4313d736..58ff8bd1 100644
--- a/internal/db/mirror.go
+++ b/internal/db/mirror.go
@@ -128,7 +128,7 @@ func (m *Mirror) RawAddress() string {
func (m *Mirror) SaveAddress(addr string) error {
repoPath := m.Repo.RepoPath()
- err := git.RepoRemoveRemote(repoPath, "origin")
+ err := git.RemoteRemove(repoPath, "origin")
if err != nil {
return fmt.Errorf("remove remote 'origin': %v", err)
}
@@ -138,7 +138,7 @@ func (m *Mirror) SaveAddress(addr string) error {
return err
}
- err = git.RepoAddRemote(repoPath, "origin", addrURL.String(), git.AddRemoteOptions{MirrorFetch: true})
+ err = git.RemoteAdd(repoPath, "origin", addrURL.String(), git.RemoteAddOptions{MirrorFetch: true})
if err != nil {
return fmt.Errorf("add remote 'origin': %v", err)
}
diff --git a/internal/db/pull.go b/internal/db/pull.go
index d226f2d8..b1f751b8 100644
--- a/internal/db/pull.go
+++ b/internal/db/pull.go
@@ -634,12 +634,12 @@ func (pr *PullRequest) UpdatePatch() (err error) {
// Add a temporary remote.
tmpRemote := com.ToStr(time.Now().UnixNano())
baseRepoPath := RepoPath(pr.BaseRepo.MustOwner().Name, pr.BaseRepo.Name)
- err = headGitRepo.AddRemote(tmpRemote, baseRepoPath, git.AddRemoteOptions{Fetch: true})
+ err = headGitRepo.RemoteAdd(tmpRemote, baseRepoPath, git.RemoteAddOptions{Fetch: true})
if err != nil {
return fmt.Errorf("add remote %q [repo_id: %d]: %v", tmpRemote, pr.HeadRepoID, err)
}
defer func() {
- if err := headGitRepo.RemoveRemote(tmpRemote); err != nil {
+ if err := headGitRepo.RemoteRemove(tmpRemote); err != nil {
log.Error("Failed to remove remote %q [repo_id: %d]: %v", tmpRemote, pr.HeadRepoID, err)
}
}()
@@ -678,13 +678,13 @@ func (pr *PullRequest) PushToBaseRepo() (err error) {
}
tmpRemote := fmt.Sprintf("tmp-pull-%d", pr.ID)
- if err = headGitRepo.AddRemote(tmpRemote, pr.BaseRepo.RepoPath()); err != nil {
+ if err = headGitRepo.RemoteAdd(tmpRemote, pr.BaseRepo.RepoPath()); err != nil {
return fmt.Errorf("add remote %q [repo_id: %d]: %v", tmpRemote, pr.HeadRepoID, err)
}
// Make sure to remove the remote even if the push fails
defer func() {
- if err := headGitRepo.RemoveRemote(tmpRemote); err != nil {
+ if err := headGitRepo.RemoteRemove(tmpRemote); err != nil {
log.Error("Failed to remove remote %q [repo_id: %d]: %v", tmpRemote, pr.HeadRepoID, err)
}
}()
diff --git a/internal/db/repo.go b/internal/db/repo.go
index d6235282..1c85583a 100644
--- a/internal/db/repo.go
+++ b/internal/db/repo.go
@@ -419,7 +419,7 @@ func (repo *Repository) mustOwner(e Engine) *User {
}
func (repo *Repository) UpdateSize() error {
- countObject, err := git.RepoCountObjects(repo.RepoPath())
+ countObject, err := git.CountObjects(repo.RepoPath())
if err != nil {
return fmt.Errorf("count repository objects: %v", err)
}
@@ -1979,7 +1979,7 @@ func GitFsck() {
func(idx int, bean interface{}) error {
repo := bean.(*Repository)
repoPath := repo.RepoPath()
- err := git.RepoFsck(repoPath, git.FsckOptions{
+ err := git.Fsck(repoPath, git.FsckOptions{
Args: conf.Cron.RepoHealthCheck.Args,
Timeout: conf.Cron.RepoHealthCheck.Timeout,
})
@@ -2511,7 +2511,7 @@ func (repo *Repository) CreateNewBranch(oldBranch, newBranch string) (err error)
return fmt.Errorf("create new branch [base: %s, new: %s]: %v", oldBranch, newBranch, err)
}
- if err = git.RepoPush(localPath, "origin", newBranch); err != nil {
+ if err = git.Push(localPath, "origin", newBranch); err != nil {
return fmt.Errorf("push [branch: %s]: %v", newBranch, err)
}
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)
}
diff --git a/internal/db/wiki.go b/internal/db/wiki.go
index 03e3a48d..5bcdd3f1 100644
--- a/internal/db/wiki.go
+++ b/internal/db/wiki.go
@@ -125,11 +125,11 @@ func (repo *Repository) updateWikiPage(doer *User, oldTitle, title, content, mes
if message == "" {
message = "Update page '" + title + "'"
}
- 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("add all changes: %v", err)
- } else if err = git.RepoCommit(localPath, doer.NewGitSig(), message); err != nil {
+ } else if err = git.CreateCommit(localPath, doer.NewGitSig(), message); err != nil {
return fmt.Errorf("commit changes: %v", err)
- } else if err = git.RepoPush(localPath, "origin", "master"); err != nil {
+ } else if err = git.Push(localPath, "origin", "master"); err != nil {
return fmt.Errorf("push: %v", err)
}
@@ -161,11 +161,11 @@ func (repo *Repository) DeleteWikiPage(doer *User, title string) (err error) {
message := "Delete page '" + title + "'"
- 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("add all changes: %v", err)
- } else if err = git.RepoCommit(localPath, doer.NewGitSig(), message); err != nil {
+ } else if err = git.CreateCommit(localPath, doer.NewGitSig(), message); err != nil {
return fmt.Errorf("commit changes: %v", err)
- } else if err = git.RepoPush(localPath, "origin", "master"); err != nil {
+ } else if err = git.Push(localPath, "origin", "master"); err != nil {
return fmt.Errorf("push: %v", err)
}