Avoid unused line statistics when refreshing merge facts

This commit is contained in:
Ian Gulliver
2026-10-21 12:02:22 -07:00
parent 09faa74822
commit 36d6636220
2 changed files with 13 additions and 2 deletions
+12
View File
@@ -43,6 +43,18 @@ func Compare(dir, defaultBranch, head, tree, since string) (api.TaskChanges, err
return api.TaskChanges{Base: base, Tree: tree, Files: files}, nil
}
func ChangedFileCount(dir, defaultBranch, tree string) (int, error) {
base, err := run(dir, "merge-base", "HEAD", defaultBranch)
if err != nil {
return 0, err
}
paths, err := run(dir, "diff", "--find-renames", "--name-only", "-z", base, tree)
if err != nil {
return 0, err
}
return strings.Count(paths, "\x00"), nil
}
func Snapshot(dir string) (string, error) {
index, err := run(dir, "rev-parse", "--path-format=absolute", "--git-path", "index")
if err != nil {