We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 98e36bf commit a367bffCopy full SHA for a367bff
lib/git/object.rb
@@ -217,9 +217,7 @@ def diff_parent
217
end
218
219
def set_commit(data)
220
- if data['sha']
221
- @sha = data['sha']
222
- end
+ @sha ||= data['sha']
223
@committer = Git::Author.new(data['committer'])
224
@author = Git::Author.new(data['author'])
225
@tree = Git::Object::Tree.new(@base, data['tree'])
tests/units/test_object.rb
@@ -11,6 +11,13 @@ def setup
11
@tree = @git.gtree('1cc8667014381^{tree}')
12
@blob = @git.gblob('v2.5:example.txt')
13
14
+
15
+ def test_sha_state
16
+ o = @git.object('HEAD')
17
+ original_sha = o.sha
18
+ o.date
19
+ assert_equal(original_sha, o.sha)
20
+ end
21
22
def test_commit
23
o = @git.gcommit('1cc8667014381')
0 commit comments