From 9a3a4862049c464b0fc12dff6a9bfc49e2d8bf03 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 2 Feb 2026 08:17:28 +0100 Subject: pkg/aflow/flow/patching: fix getting list of recent commits We need to run git log in the master git repo b/c out KernelSrc/KernelScratchSrc are shallow checkouts that don't have history. --- pkg/aflow/flow/patching/actions.go | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'pkg/aflow/flow/patching/actions.go') diff --git a/pkg/aflow/flow/patching/actions.go b/pkg/aflow/flow/patching/actions.go index d42c24fa1..bea70e978 100644 --- a/pkg/aflow/flow/patching/actions.go +++ b/pkg/aflow/flow/patching/actions.go @@ -114,7 +114,6 @@ func maintainers(ctx *aflow.Context, args maintainersArgs) (maintainersResult, e var getRecentCommits = aflow.NewFuncAction("get-recent-commits", recentCommits) type recentCommitsArgs struct { - KernelSrc string KernelCommit string PatchDiff string } @@ -132,11 +131,16 @@ func recentCommits(ctx *aflow.Context, args recentCommitsArgs) (recentCommitsRes if len(files) == 0 { return res, aflow.FlowError(errors.New("patch diff does not contain any modified files")) } - gitArgs := append([]string{"log", "--format=%s", "--no-merges", "-n", "20", args.KernelCommit}, files...) - output, err := osutil.RunCmd(10*time.Minute, args.KernelSrc, "git", gitArgs...) - if err != nil { - return res, aflow.FlowError(fmt.Errorf("%w\n%s", err, output)) - } - res.RecentCommits = string(output) - return res, nil + // We need to run git log in the master git repo b/c out KernelSrc/KernelScratchSrc + // are shallow checkouts that don't have history. + err := kernel.UseLinuxRepo(ctx, func(kernelRepoDir string, _ vcs.Repo) error { + gitArgs := append([]string{"log", "--format=%s", "--no-merges", "-n", "20", args.KernelCommit}, files...) + output, err := osutil.RunCmd(10*time.Minute, kernelRepoDir, "git", gitArgs...) + if err != nil { + return aflow.FlowError(fmt.Errorf("%w\n%s", err, output)) + } + res.RecentCommits = string(output) + return nil + }) + return res, err } -- cgit mrf-deployment