INNER CODE UNIT · Go

score

Bharath-code/git-scope · internal/attention/score.go:34

	score := weightAhead*capCount(s.Ahead) + weightBehd*capCount(s.Behind)
	score += weightDirty * capCount(s.Staged+s.Unstaged+s.Untracked+s.Stashes+s.OtherBranchCommits)
	if s.ScanError != "" {
		score += weightErr
	}
	if Stale(s, now) {
		score += weightStale
	}
	return score
}

// Less reports whether repo a should sort before repo b: higher tier first, then
// higher sub-score, then name ascending for a stable, deterministic order.
func Less(a, b model.Repo, now time.Time) bool {
	ta, tb := Classify(a.Status, now), Classify(b.Status, now)
	if ta != tb {
		return ta > tb
	}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…