diff options
author | Luke Shumaker <lukeshu@beefcake.parabola.nu> | 2018-05-19 12:45:35 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@beefcake.parabola.nu> | 2018-05-19 12:45:35 -0400 |
commit | c48f4a15241e013e77670bdaec024d16b10f9874 (patch) | |
tree | b2dced23c403dd447845e964833df41a6e26f721 | |
parent | 9110ae474a8ac9fd70b6e15aa3cfda368c5d1cb4 (diff) |
fix totals in the checkums status
-rw-r--r-- | go/src/cow-dedupe/dedupe.go | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/go/src/cow-dedupe/dedupe.go b/go/src/cow-dedupe/dedupe.go index a47e31f..b70aeb2 100644 --- a/go/src/cow-dedupe/dedupe.go +++ b/go/src/cow-dedupe/dedupe.go @@ -87,19 +87,20 @@ func getChecksums(paths []string) map[string][]string { cnt := 0 sl.Put(fmt.Sprintf("Generating checksums for files... %d/%d", cnt, len(paths))) - for len(paths) > 0 { - _paths := paths + pathsTodo := paths + for len(pathsTodo) > 0 { + pathsDoing := pathsTodo arg_len := 0 - for i := range _paths { - arg_len += len(_paths[i]) + 1 + for i := range pathsDoing { + arg_len += len(pathsDoing[i]) + 1 if arg_len > arg_max/2 { - _paths = _paths[:i-1] + pathsDoing = pathsDoing[:i-1] break } } - paths = paths[len(_paths):] + pathsTodo = pathsTodo[len(pathsDoing):] - cmd := exec.Command("sha256sum", append([]string{"--"}, _paths...)...) + cmd := exec.Command("sha256sum", append([]string{"--"}, pathsDoing...)...) stdout, err := cmd.StdoutPipe() errhandle(err) cmd.Stderr = os.Stderr |