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')