gitrb 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/gitrb.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'gitrb'
3
- s.version = '0.2.6'
3
+ s.version = '0.2.7'
4
4
  s.summary = 'Pure ruby git implementation'
5
5
  s.author = 'Daniel Mendler'
6
6
  s.email = 'mail@daniel-mendler.de'
data/lib/gitrb/tree.rb CHANGED
@@ -39,7 +39,7 @@ module Gitrb
39
39
  end
40
40
 
41
41
  def dump
42
- @children.to_a.sort {|a,b| a.first <=> b.first }.map do |name, child|
42
+ sorted_children.map do |name, child|
43
43
  child.save if !(Reference === child) || child.resolved?
44
44
  "#{child.mode.to_s(8)} #{name}\0#{repository.set_encoding [child.id].pack("H*")}"
45
45
  end.join
@@ -126,23 +126,29 @@ module Gitrb
126
126
 
127
127
  # Iterate over all children
128
128
  def each(&block)
129
- @children.sort.each do |name, child|
129
+ sorted_children.each do |name, child|
130
130
  yield(name, child)
131
131
  end
132
132
  end
133
133
 
134
134
  def names
135
- @children.keys.sort
135
+ map {|name, child| name }
136
136
  end
137
137
 
138
138
  def values
139
- map { |name, child| child }
139
+ map {|name, child| child }
140
140
  end
141
141
 
142
142
  alias children values
143
143
 
144
144
  private
145
145
 
146
+ def sorted_children
147
+ @children.map do |name, child|
148
+ [name + (child.type == :tree ? '/' : "\0"), name, child]
149
+ end.sort.map {|_, name, child| [name, child] }
150
+ end
151
+
146
152
  def normalize_path(path)
147
153
  return path if Array === path
148
154
  path = path.to_s
data/lib/gitrb/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Gitrb
2
- VERSION = '0.2.6'
2
+ VERSION = '0.2.7'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitrb
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 6
10
- version: 0.2.6
9
+ - 7
10
+ version: 0.2.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Daniel Mendler