port ls-files test

This commit is contained in:
Rick Olson 2015-05-26 11:51:38 -06:00
parent 793d894fe8
commit 6eb340b0d8
2 changed files with 20 additions and 29 deletions

@ -1,29 +0,0 @@
package commands
import (
"path/filepath"
"testing"
)
func TestLsFiles(t *testing.T) {
repo := NewRepository(t, "empty")
defer repo.Test()
cmd := repo.Command("ls-files")
cmd.Output = "a.dat"
cmd.Before(func() {
path := filepath.Join(".git", "info", "attributes")
repo.WriteFile(path, "*.dat filter=lfs -crlf\n")
// Add a Git LFS object
repo.WriteFile(filepath.Join(repo.Path, "a.dat"), "some data")
repo.GitCmd("add", "a.dat")
repo.GitCmd("commit", "-m", "a")
// Add a regular file
repo.WriteFile(filepath.Join(repo.Path, "hi.txt"), "some text")
repo.GitCmd("add", "hi.txt")
repo.GitCmd("commit", "-m", "hi")
})
}

20
test/test-ls-files.sh Executable file

@ -0,0 +1,20 @@
#!/bin/sh
. "test/testlib.sh"
begin_test "ls-files"
(
set -e
mkdir repo
cd repo
git init
git lfs track "*.dat" | grep "Tracking \*.dat"
echo "some data" > some.dat
echo "some text" > some.txt
git add some.dat some.txt
git commit -m "added some files"
[ "some.dat" == "$(git lfs ls-files)" ]
)
end_test