handle cases where we dont know the total

This commit is contained in:
Rick Olson 2014-08-07 09:31:44 -06:00
parent 0204cb2abe
commit 203a86ea3b

@ -57,7 +57,10 @@ func smudgeCommand(cmd *cobra.Command, args []string) {
}
cb = gitmedia.CopyCallback(func(total int64, written int64) error {
p := int((float64(written) / float64(total) * 100))
var p uint64
if total > 0 {
p = uint64(float64(written) / float64(total) * 100)
}
_, err := file.Write([]byte(fmt.Sprintf("\n%s %d", filename, p)))
return err
})