From a420beda2a12f25f5f5503c20d0d6febee892132 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sat, 31 Oct 2020 23:42:54 +0800 Subject: [PATCH] Fix a bug on refactoring (#13373) --- modules/repository/push.go | 5 ++--- services/repository/push.go | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/repository/push.go b/modules/repository/push.go index 04dd63a2cc..e349b51094 100644 --- a/modules/repository/push.go +++ b/modules/repository/push.go @@ -5,11 +5,10 @@ package repository import ( - "path/filepath" "strings" + "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/git" - "code.gitea.io/gitea/modules/setting" ) // PushUpdateOptions defines the push update options @@ -105,7 +104,7 @@ func IsForcePush(opts *PushUpdateOptions) (bool, error) { } output, err := git.NewCommand("rev-list", "--max-count=1", opts.OldCommitID, "^"+opts.NewCommitID). - RunInDir(filepath.Join(setting.RepoRootPath, opts.RepoUserName, opts.RepoName)) + RunInDir(models.RepoPath(opts.RepoUserName, opts.RepoName)) if err != nil { return false, err } else if len(output) > 0 { diff --git a/services/repository/push.go b/services/repository/push.go index 538f282784..b7c261ec3a 100644 --- a/services/repository/push.go +++ b/services/repository/push.go @@ -138,7 +138,7 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error { isForce, err := repo_module.IsForcePush(opts) if err != nil { - log.Error("isForcePush %s/%s failed: %v", repo.ID, branch, err) + log.Error("isForcePush %s:%s failed: %v", repo.FullName(), branch, err) } if isForce {