Skip to content

Commit f7fb1a6

Browse files
committed
improvements
1 parent 3e97124 commit f7fb1a6

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

modules/git/gitcmd/command.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,7 @@ func (c *Command) Run(ctx context.Context, opts *RunOpts) error {
285285
}
286286

287287
cmdLogString := c.LogString()
288-
skip := 1 /* util */ + 1 /* this */ + opts.LogSkip /* parent */
289-
callerInfo := util.CallerFuncName(skip)
288+
callerInfo := util.CallerFuncName(1 /* util */ + 1 /* this */ + opts.LogSkip /* parent */)
290289
if pos := strings.LastIndex(callerInfo, "/"); pos >= 0 {
291290
callerInfo = callerInfo[pos+1:]
292291
}

routers/web/repo/pull.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@ func GetMergedBaseCommitID(ctx *context.Context, issue *issues_model.Issue) stri
234234
}
235235
if commitSHA != "" {
236236
// Get immediate parent of the first commit in the patch, grab history back
237-
parentCommit, _, err = gitcmd.NewCommand("rev-list", "-1", "--skip=1").AddDynamicArguments(commitSHA).RunStdString(ctx, &gitcmd.RunOpts{Dir: ctx.Repo.GitRepo.Path})
237+
parentCommit, err = gitrepo.RunCmdString(ctx, ctx.Repo.Repository,
238+
gitcmd.NewCommand("rev-list", "-1", "--skip=1").AddDynamicArguments(commitSHA))
238239
if err == nil {
239240
parentCommit = strings.TrimSpace(parentCommit)
240241
}

services/repository/migrate.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,9 @@ func MigrateRepositoryGitData(ctx context.Context, u *user_model.User,
226226

227227
// this is necessary for sync local tags from remote
228228
configName := fmt.Sprintf("remote.%s.fetch", mirrorModel.GetRemoteName())
229-
if stdout, _, err := gitcmd.NewCommand("config").
230-
AddOptionValues("--add", configName, `+refs/tags/*:refs/tags/*`).
231-
RunStdString(ctx, &gitcmd.RunOpts{Dir: repoPath}); err != nil {
229+
if stdout, err := gitrepo.RunCmdString(ctx, repo,
230+
gitcmd.NewCommand("config").
231+
AddOptionValues("--add", configName, `+refs/tags/*:refs/tags/*`)); err != nil {
232232
log.Error("MigrateRepositoryGitData(git config --add <remote> +refs/tags/*:refs/tags/*) in %v: Stdout: %s\nError: %v", repo, stdout, err)
233233
return repo, fmt.Errorf("error in MigrateRepositoryGitData(git config --add <remote> +refs/tags/*:refs/tags/*): %w", err)
234234
}

0 commit comments

Comments
 (0)