summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--go/src/cow-dedupe/dedupe.go21
1 files changed, 15 insertions, 6 deletions
diff --git a/go/src/cow-dedupe/dedupe.go b/go/src/cow-dedupe/dedupe.go
index 84140f5..af2063a 100644
--- a/go/src/cow-dedupe/dedupe.go
+++ b/go/src/cow-dedupe/dedupe.go
@@ -160,15 +160,16 @@ func dedupe(srcFile string, dupFiles []string) error {
type fancyStatus struct {
sizeN, sizeD, sizeC int
sumT, sumN, sumD, sumC int
- summed, deduped int
+ summed, deduped, errs int
verb string
}
func (s fancyStatus) String() string {
- return fmt.Sprintf("size-set[%d/%d]->%d :: sha256-set[%d+%d/%d]->%d :: (summed=%d deduped=%d) :: %s",
+ return fmt.Sprintf("size-set[%d/%d]->%d :: sha256-set[%d+%d/%d]->%d :: (sum=%d dedup=%d err=%d) :: %s",
s.sizeN, s.sizeD, s.sizeC,
s.sumT, s.sumN, s.sumD, s.sumC,
- s.summed, s.deduped, s.verb)
+ s.summed, s.deduped, s.errs,
+ s.verb)
}
func main() {
@@ -253,10 +254,18 @@ func main() {
dupFiles = append(dupFiles, fiemap2filenames[fiemap]...)
}
// And actually dedupe those
- status.verb = fmt.Sprintf("dedupe %q (and %d more)", filepath.Base(srcFile), len(dupFiles))
+ name := filepath.Base(srcFile)
+ if len(name) > 25 {
+ name = name[:25]
+ }
+ status.verb = fmt.Sprintf("dedupe %q (and %d more)", name, len(dupFiles))
sl.Put(status.String())
- dedupe(srcFile, dupFiles) // XXX ignore error?
- status.deduped++
+ err := dedupe(srcFile, dupFiles)
+ if err != nil {
+ status.errs++
+ } else {
+ status.deduped++
+ }
status.sumN++
}
status.sumT += len(checksum2filenames)