MCPcopy
hub / github.com/Jguer/yay / gitHasDiff

Function gitHasDiff

pkg/menus/diff_menu.go:74–91  ·  view source on GitHub ↗

Check whether or not a diff exists between the last reviewed diff and HEAD@{upstream}.

(ctx context.Context, cmdBuilder exe.ICmdBuilder, dir string)

Source from the content-addressed store, hash-verified

72// Check whether or not a diff exists between the last reviewed diff and
73// HEAD@{upstream}.
74func gitHasDiff(ctx context.Context, cmdBuilder exe.ICmdBuilder, dir string) (bool, error) {
75 if gitHasLastSeenRef(ctx, cmdBuilder, dir) {
76 stdout, stderr, err := cmdBuilder.Capture(
77 cmdBuilder.BuildGitCmd(ctx, dir, "rev-parse", gitDiffRefName, "HEAD@{upstream}"))
78 if err != nil {
79 return false, fmt.Errorf("%s%w", stderr, err)
80 }
81
82 lines := strings.Split(stdout, "\n")
83 lastseen := lines[0]
84 upstream := lines[1]
85
86 return lastseen != upstream, nil
87 }
88 // If AUR_SEEN does not exists, we have never reviewed a diff for this package
89 // and should display it.
90 return true, nil
91}
92
93// Return whether or not we have reviewed a diff yet. It checks for the existence of
94// AUR_SEEN in the git ref-list.

Callers 1

showPkgbuildDiffsFunction · 0.85

Calls 3

gitHasLastSeenRefFunction · 0.85
CaptureMethod · 0.65
BuildGitCmdMethod · 0.65

Tested by

no test coverage detected