diff --git a/git/pkt_line_reader.go b/git/pkt_line_reader.go index ab4de351..7a889671 100644 --- a/git/pkt_line_reader.go +++ b/git/pkt_line_reader.go @@ -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 diff --git a/git/pkt_line_reader_test.go b/git/pkt_line_reader_test.go index 2c573b32..189ec2f1 100644 --- a/git/pkt_line_reader_test.go +++ b/git/pkt_line_reader_test.go @@ -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) diff --git a/test/test-filter-process.sh b/test/test-filter-process.sh index 8498a4d7..617dc807 100755 --- a/test/test-filter-process.sh +++ b/test/test-filter-process.sh @@ -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 + + +