Skip to content

Commit 93ea661

Browse files
kokeschacon
authored andcommitted
Added :allow_empty option to commit
Signed-off-by: Scott Chacon <schacon@gmail.com>
1 parent 89ba125 commit 93ea661

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

lib/git/base.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,10 @@ def reset_hard(commitish = nil, opts = {})
252252
end
253253

254254
# commits all pending changes in the index file to the git repository
255+
#
256+
# options:
257+
# :add_all
258+
# :allow_empty
255259
def commit(message, opts = {})
256260
self.lib.commit(message, opts)
257261
end

lib/git/lib.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ def remove(path = '.', opts = {})
371371
def commit(message, opts = {})
372372
arr_opts = ["-m '#{message}'"]
373373
arr_opts << '-a' if opts[:add_all]
374+
arr_opts << '--allow-empty' if opts[:allow_empty]
374375
command('commit', arr_opts)
375376
end
376377

0 commit comments

Comments
 (0)