Merge pull request #1699 from git-lfs/lars/test-1024-error

filter-process:  fix reading 1024 byte files
This commit is contained in:
Taylor Blau 2016-11-22 13:18:14 -07:00 committed by GitHub
commit 21b2fbfa79
3 changed files with 21 additions and 15 deletions

@ -53,10 +53,6 @@ func (r *pktlineReader) Read(p []byte) (int, error) {
// Mark that we have read "nn" bytes into "p"
n += nn
if n >= len(p) {
break
}
}
return n, nil

@ -87,7 +87,7 @@ func TestPktlineReaderReadsManyPacketsInMultipleCallsWithUnevenBuffering(t *test
n2, e2 := pr.Read(p2[:])
assert.Equal(t, 7, n2)
assert.Equal(t, []byte("tsecond"), p2[:])
assert.Equal(t, nil, e2)
assert.Equal(t, io.EOF, e2)
n3, e3 := pr.Read(p3[:])
assert.Equal(t, 0, n3)
@ -135,7 +135,7 @@ func TestPktlineReaderReadsManyPacketsInMultipleCallsWithEvenBuffering(t *testin
n2, e2 := pr.Read(p2[:])
assert.Equal(t, 5, n2)
assert.Equal(t, []byte("other"), p2[:])
assert.Equal(t, nil, e2)
assert.Equal(t, io.EOF, e2)
n3, e3 := pr.Read(p3)
assert.Equal(t, 0, n3)

@ -6,15 +6,7 @@
# from the "next" branch, which is the only (current) version of Git that has
# support for the filter protocol.
#
# Once 2.11 is released, replace this with:
#
# ```
# ensure_git_version_isnt $VERSION_LOWER "2.11.0"
# ```
if [ "1" -ne "$(git version | cut -d ' ' -f 3 | grep -c "g")" ]; then
echo "skip: $0 git version does not include support for filter protocol"
exit
fi
ensure_git_version_isnt $VERSION_LOWER "2.11.0"
begin_test "filter process: checking out a branch"
(
@ -97,3 +89,21 @@ begin_test "filter process: adding a file"
diff -u <(echo "$expected") <(echo "$got")
)
end_test
# https://github.com/git-lfs/git-lfs/issues/1697
begin_test "filter process: add a file with 1024 bytes"
(
set -e
mkdir repo-issue-1697
cd repo-issue-1697
git init
git lfs track "*.dat"
dd if=/dev/zero of=first.dat bs=1024 count=1
printf "any contents" > second.dat
git add .
)
end_test