module Gitrb

  class User < Struct.new(:name, :email, :date)
    def initialize(name, email, date = Time.now)
      super
    end

    def dump
      off = date.gmt_offset / 60
      '%s <%s> %d %s%02d%02d' % [name, email, date.to_i, off < 0 ? '-' : '+', off / 60, off % 60]
    end

    def self.parse(user)
      if match = user.match(/(.*)<(.*)> (\d+) ([+-]?\d+)/)
        new match[1].strip, match[2].strip, Time.at(match[3].to_i)
      end
    end

  end

end

module Gitrb

  class User < Struct.new(:name, :email, :date)
    def initialize(name, email, date = Time.now)
      super
    end

    def dump
      off = date.gmt_offset / 60
      '%s <%s> %d %s%02d%02d' % [name, email, date.to_i, off < 0 ? '' : '+', off / 60, off % 60]
    end

    def self.parse(user)
      if match = user.match(/(.*)<(.*)> (\d+) ([+-]?\d+)/)
        new match[1].strip, match[2].strip, Time.at(match[3].to_i)
      end
    end

  end

end

Make negative time zones produce '-700', not '--700'
Make negative time zones produce '-700', not '--700'

This fixes failing spec:
'Gitrb::Commit should be readable by git binary' FAILED
expected: "Date:   Mon Apr 20 00:00:00 2009 -0700\n",
     got: "Date:   Mon Apr 20 00:00:00 2009 +0000\n" (using ==)
     commit_spec.rb:45:in `block (3 levels) in <top (required)>'
