From 2810e2d8b60e8fea05c4fe8fcdb909f0ac40cc7d Mon Sep 17 00:00:00 2001 From: James Armes Date: Wed, 12 Feb 2020 12:21:27 -0500 Subject: [PATCH] Update commit to return an object, matching the documntation. Signed-off-by: James Armes --- lib/git/base.rb | 4 ++++ tests/units/test_base.rb | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/git/base.rb b/lib/git/base.rb index 068d7931..895c1e50 100644 --- a/lib/git/base.rb +++ b/lib/git/base.rb @@ -291,6 +291,8 @@ def revert(commitish = nil, opts = {}) # def commit(message, opts = {}) self.lib.commit(message, opts) + + gcommit('HEAD') end # commits all pending changes in the index file to the git repository, @@ -299,6 +301,8 @@ def commit(message, opts = {}) def commit_all(message, opts = {}) opts = {:add_all => true}.merge(opts) self.lib.commit(message, opts) + + gcommit('HEAD') end # checks out a branch as the new git working directory diff --git a/tests/units/test_base.rb b/tests/units/test_base.rb index 08f651a4..19fbd3d7 100644 --- a/tests/units/test_base.rb +++ b/tests/units/test_base.rb @@ -91,9 +91,11 @@ def test_commit base_commit_id = git.log[0].objectish - git.commit("Test Commit") + o = git.commit("Test Commit") + assert(o.is_a?(Git::Object::Commit)) original_commit_id = git.log[0].objectish + assert(o.sha == original_commit_id) create_file('test_commit/test_file_3', 'content test_file_3')