commands: use 'possiblyMalformedSmudge' helper instead of importing runtime

This commit is contained in:
Taylor Blau 2017-07-31 13:04:59 -06:00
parent f6beec6cd2
commit 68fb0aea3b

@ -4,13 +4,11 @@ import (
"fmt"
"io"
"os"
"runtime"
"github.com/git-lfs/git-lfs/errors"
"github.com/git-lfs/git-lfs/filepathfilter"
"github.com/git-lfs/git-lfs/git"
"github.com/git-lfs/git-lfs/lfs"
"github.com/git-lfs/git-lfs/tools/humanize"
"github.com/spf13/cobra"
)
@ -74,7 +72,7 @@ func filterCommand(cmd *cobra.Command, args []string) {
if errors.IsNotAPointerError(err) {
malformed = append(malformed, req.Header["pathname"])
err = nil
} else if n > 4*humanize.Gigabyte {
} else if possiblyMalformedSmudge(n) {
malformedOnWindows = append(malformedOnWindows, req.Header["pathname"])
}
@ -96,15 +94,13 @@ func filterCommand(cmd *cobra.Command, args []string) {
}
if len(malformedOnWindows) > 0 {
if runtime.GOOS == "windows" {
fmt.Fprintf(os.Stderr, "Encountered %d file(s) that may not have been copied correctly on Windows:\n")
fmt.Fprintf(os.Stderr, "Encountered %d file(s) that may not have been copied correctly on Windows:\n")
for _, m := range malformedOnWindows {
fmt.Fprintf(os.Stderr, "\t%s\n", m)
}
fmt.Fprintf(os.Stderr, "\nSee: `git lfs help smudge` for more details.\n")
for _, m := range malformedOnWindows {
fmt.Fprintf(os.Stderr, "\t%s\n", m)
}
fmt.Fprintf(os.Stderr, "\nSee: `git lfs help smudge` for more details.\n")
}
if err := s.Err(); err != nil && err != io.EOF {