Skip to content

Update commit to return an object, matching the documentation #451

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update commit to return an object, matching the documntation.
Signed-off-by: James Armes <jamesiarmes@gmail.com>
  • Loading branch information
jamesiarmes committed Feb 12, 2020
commit 2810e2d8b60e8fea05c4fe8fcdb909f0ac40cc7d
4 changes: 4 additions & 0 deletions lib/git/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion tests/units/test_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down