git-media icon indicating copy to clipboard operation
git-media copied to clipboard

smuge fails on remote repo Fixnum into String (TypeError)

Open kyv opened this issue 12 years ago • 4 comments

hi,

I have a local repo in which i edit markdown and save binary files. And a remote repo which i push to. Both repos are configured to use git-media (in case someone adds an image directly to the remote repo). Binary files are 'synced' to remote server.

The problem i encounter is that smudge fails on remote repo when i push to it.

remote: /var/lib/gems/1.8/gems/git-media-0.1.1/lib/git-media/filter-smudge.rb:9:in readline': can't convert Fixnum into String (TypeError) remote: from /var/lib/gems/1.8/gems/git-media-0.1.1/lib/git-media/filter-smudge.rb:9:inrun!' remote: from /var/lib/gems/1.8/gems/git-media-0.1.1/lib/git-media.rb:82:in `run!' remote: from /usr/local/bin/git-media:8 remote: error: external filter git-media filter-smudge failed 1 remote: error: external filter git-media filter-smudge failed remote: Saving media : bcb197a0e150b3f86a473dbc1bf336dd7b9a13d7 : 0.00142 remote: Saving media : 24a4df6c0f142f3f773ae63333616151b9bf991e : 0.001701 remote: Saving media : 21c8df31d4523c799aaea8b9b33ea46f5f65599f : 0.00233 remote: Saving media : 5ca114dea611a0488f46df21c96100803b0b1096 : 0.001581

kyv avatar Mar 02 '12 16:03 kyv

sorry the is mostly likely a ruby 1.8 error, see:

https://gist.github.com/1744222

kyv avatar Mar 02 '12 20:03 kyv

The difference between the versions between version 1.8.7 and 1.9.3, since 1.8.7 does not support a number as argument, see detail:

http://ruby-doc.org/core-1.8.7/IO.html#method-i-readline http://ruby-doc.org/core-1.9.3/IO.html#method-i-readline

Maybe catch the version and implement a difference in the way it generates sha in FilterSmudge:09

fitorec avatar Mar 05 '12 18:03 fitorec

Yes sounds easy unfortunatly i dont know ruby but hopefully i can learn enough soon in order to implement a version check. For now, i can confirm that the following change fixes the problem for me on my setup:

  •  sha = STDIN.readline(64).strip # read no more than 64 bytes
    
  •  sha = STDIN.gets.chomp # read no more than 64 bytes
    

kyv avatar Mar 08 '12 00:03 kyv

Fixed in 0.1.4

benjyw avatar Jun 22 '12 22:06 benjyw