gitrb 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
data/gitrb.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'gitrb'
3
- s.version = '0.1.7'
3
+ s.version = '0.1.8'
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/blob.rb CHANGED
@@ -22,6 +22,7 @@ module Gitrb
22
22
 
23
23
  # Save the data to the git object repository
24
24
  def save
25
+ raise 'Blob is empty' if !data
25
26
  repository.put(self)
26
27
  id
27
28
  end
@@ -185,7 +185,7 @@ module Gitrb
185
185
  #
186
186
  # Returns a tree, blob, commit or tag object.
187
187
  def get(id)
188
- raise ArgumentError, 'No id given' if !(String === id)
188
+ raise ArgumentError, 'Invalid id given' if !(String === id)
189
189
 
190
190
  if id =~ SHA_PATTERN
191
191
  raise ArgumentError, "Sha too short: #{id}" if id.length < 5
@@ -202,6 +202,8 @@ module Gitrb
202
202
  trie = @objects.find(id)
203
203
  raise NotFound, "Sha is ambiguous: #{id}" if trie.size > 1
204
204
  return trie.value if !trie.empty?
205
+ else
206
+ raise ArgumentError, "Invalid id given: #{id}"
205
207
  end
206
208
 
207
209
  @logger.debug "gitrb: Loading #{id}"
data/lib/gitrb/tree.rb CHANGED
@@ -64,6 +64,7 @@ module Gitrb
64
64
 
65
65
  # Write an entry on specified path.
66
66
  def []=(path, entry)
67
+ raise ArgumentError if !entry
67
68
  path = normalize_path(path)
68
69
  if path.empty?
69
70
  raise 'Empty path'
@@ -89,8 +90,9 @@ module Gitrb
89
90
  if path.empty?
90
91
  raise 'Empty path'
91
92
  elsif path.size == 1
92
- @modified = true
93
- @children.delete(path.first)
93
+ child = @children.delete(path.first)
94
+ @modified = true if child
95
+ child
94
96
  else
95
97
  tree = @children[path.first]
96
98
  raise 'Not a tree' if tree.type != :tree
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 7
9
- version: 0.1.7
8
+ - 8
9
+ version: 0.1.8
10
10
  platform: ruby
11
11
  authors:
12
12
  - Daniel Mendler
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-08-21 00:00:00 +02:00
17
+ date: 2010-08-22 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency