From c48f4a15241e013e77670bdaec024d16b10f9874 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 19 May 2018 12:45:35 -0400 Subject: fix totals in the checkums status --- go/src/cow-dedupe/dedupe.go | 15 ++++++++------- 1 file 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 -- cgit v1.2.3-2-g168b