Avoid unused line statistics when refreshing merge facts
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user