Skip to content

Commit

Permalink
Issue mojombo#117: Fixed wrong magic comparition.
Browse files Browse the repository at this point in the history
Signed-off-by: Mikhail S. Pobolovets <styx.mp@gmail.com>

Conflicts:
	lib/grit/git-ruby/internal/pack.rb
  • Loading branch information
styx authored and Voker57 committed Dec 19, 2013
1 parent 3590fe0 commit aca434c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/grit/git-ruby/internal/pack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
require 'grit/git-ruby/internal/file_window'

PACK_IDX_SIGNATURE = [0xFF, 0x74, 0x4F, 0x63]
PACK_SIGNATURE = "PACK"

module Grit
module GitRuby
Expand Down Expand Up @@ -59,7 +60,7 @@ def with_idx(index_file = nil)
# read header
# File.read return a ASCII-8BIT encoded string. Since we're comparing
# sig against a source file string we force the encoding on it to UTF-8.
sig = idxfile.read(4).force_encoding("UTF-8")
sig = idxfile.read(4).unpack("C*").force_encoding("UTF-8")
ver = idxfile.read(4).unpack("N")[0]

if sig == PACK_IDX_SIGNATURE
Expand Down

0 comments on commit aca434c

Please sign in to comment.