Skip to content

Commit

Permalink
Merge pull request #2932 from git-lfs/ls-trees-no-sigsegv
Browse files Browse the repository at this point in the history
commands/ls-files: do not accept '--all' after '--'
  • Loading branch information
ttaylorr committed Mar 21, 2018
2 parents 1011963 + 05d65e7 commit 8c8a711
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
10 changes: 5 additions & 5 deletions commands/command_ls_files.go
Expand Up @@ -45,17 +45,17 @@ func lsFilesCommand(cmd *cobra.Command, args []string) {
seen := make(map[string]struct{})

gitscanner := lfs.NewGitScanner(func(p *lfs.WrappedPointer, err error) {
if err != nil {
Exit("Could not scan for Git LFS tree: %s", err)
return
}

if !lsFilesScanAll {
if _, ok := seen[p.Name]; ok {
return
}
}

if err != nil {
Exit("Could not scan for Git LFS tree: %s", err)
return
}

if debug {
Print(
"filepath: %s\n"+
Expand Down
23 changes: 23 additions & 0 deletions test/test-ls-files.sh
Expand Up @@ -306,3 +306,26 @@ begin_test "ls-files: reference with --deleted"
[ 1 -eq $(grep -c "a\.dat" ls-files-deleted.log) ]
)
end_test
begin_test "ls-files: invalid --all ordering"
(
set -e
reponame="ls-files-invalid---all-ordering"
git init "$reponame"
cd "$reponame"
git lfs track "*.dat"
echo "Hello world" > a.dat
git add .gitattributes a.dat
git commit -m "initial commit"
git lfs ls-files -- --all 2>&1 | tee ls-files.out
if [ ${PIPESTATUS[0]} = "0" ]; then
echo >&2 "fatal: expected \`git lfs ls-files -- --all\' to fail"
exit 1
fi
grep "Could not scan for Git LFS tree" ls-files.out
)
end_test

0 comments on commit 8c8a711

Please sign in to comment.