commands: use 'possiblyMalformedSmudge' helper instead of importing runtime
This commit is contained in:
parent
f6beec6cd2
commit
68fb0aea3b
@ -4,13 +4,11 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
|
||||||
|
|
||||||
"github.com/git-lfs/git-lfs/errors"
|
"github.com/git-lfs/git-lfs/errors"
|
||||||
"github.com/git-lfs/git-lfs/filepathfilter"
|
"github.com/git-lfs/git-lfs/filepathfilter"
|
||||||
"github.com/git-lfs/git-lfs/git"
|
"github.com/git-lfs/git-lfs/git"
|
||||||
"github.com/git-lfs/git-lfs/lfs"
|
"github.com/git-lfs/git-lfs/lfs"
|
||||||
"github.com/git-lfs/git-lfs/tools/humanize"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -74,7 +72,7 @@ func filterCommand(cmd *cobra.Command, args []string) {
|
|||||||
if errors.IsNotAPointerError(err) {
|
if errors.IsNotAPointerError(err) {
|
||||||
malformed = append(malformed, req.Header["pathname"])
|
malformed = append(malformed, req.Header["pathname"])
|
||||||
err = nil
|
err = nil
|
||||||
} else if n > 4*humanize.Gigabyte {
|
} else if possiblyMalformedSmudge(n) {
|
||||||
malformedOnWindows = append(malformedOnWindows, req.Header["pathname"])
|
malformedOnWindows = append(malformedOnWindows, req.Header["pathname"])
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +94,6 @@ func filterCommand(cmd *cobra.Command, args []string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(malformedOnWindows) > 0 {
|
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 {
|
for _, m := range malformedOnWindows {
|
||||||
@ -105,7 +102,6 @@ func filterCommand(cmd *cobra.Command, args []string) {
|
|||||||
|
|
||||||
fmt.Fprintf(os.Stderr, "\nSee: `git lfs help smudge` for more details.\n")
|
fmt.Fprintf(os.Stderr, "\nSee: `git lfs help smudge` for more details.\n")
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if err := s.Err(); err != nil && err != io.EOF {
|
if err := s.Err(); err != nil && err != io.EOF {
|
||||||
ExitWithError(err)
|
ExitWithError(err)
|
||||||
|
Loading…
Reference in New Issue
Block a user