Skip to content

Blob object's data stream incomplete for certain files #220

Closed
@terminalmage

Description

@terminalmage
>>> import git
>>> git.__version__
'0.3.2.1'
>>> import os
>>> os.mkdir('foo')
>>> repo = git.Repo.init('foo')
>>> repo.create_remote('origin', 'https://github.com/terminalmage/gitfs-test1.git')
<git.Remote "origin">
>>> repo.git.config('http.sslVerify', 'true')
''
>>> origin = repo.remotes[0]
>>> origin.fetch()
[<git.remote.FetchInfo at 0x7f2f12da6aa0>,
 <git.remote.FetchInfo at 0x7f2f12da6af0>,
 <git.remote.FetchInfo at 0x7f2f12da6b40>]
>>> repo.refs
[<git.RemoteReference "refs/remotes/origin/master">,
 <git.RemoteReference "refs/remotes/origin/slash/test">,
 <git.TagReference "refs/tags/foo_tag">]
>>> tree = repo.refs[0].commit.tree
>>> blob = tree / 'loremipsum.txt'
>>> blob
<git.Blob "93c8ff2243c4d2e9c63850d025a25ed38a51e623">
>>> blob.size
18804
>>> len(blob.data_stream.read())
18804
>>> blob = tree / 'saltstack.png'
>>> blob.size
7377
>>> len(blob.data_stream.read())
7377
>>> blob = tree / 'imagemagick_6.7.7.10-6ubuntu4_amd64.deb'
>>> blob.size
222318
>>> len(blob.data_stream.read())
221818
>>> blob = tree / 'archlinux_1080p.png'
>>> blob.size
778428
>>> len(blob.data_stream.read())
778428

Note that the .deb package's data stream is not the correct size (221818 instead of 222318 as it should be).

This doesn't seem to be related to the file size, as a larger PNG image works just fine. Both the PNG images and the .deb package are marked as binary files in the .gitattributes file, as well.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions