Skip to content

Commit 11a8137

Browse files
Making options optional
1 parent f9c9ce7 commit 11a8137

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

lib/git/base.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,12 @@ def reset_hard(commitish = nil, opts = {})
281281
end
282282

283283

284-
# cleans the working directory, removing directories, too.
284+
# cleans the working directory
285+
#
286+
# options:
287+
# :force
288+
# :d
289+
#
285290
def clean(opts = {})
286291
self.lib.clean(opts)
287292
end

lib/git/lib.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,10 @@ def reset(commit, opts = {})
422422
end
423423

424424
def clean(opts = {})
425-
arr_opts = ["--force"] # Some configurations require a --force
426-
arr_opts << ["-d"] # Remove untracked directories in addition to untracked files.
425+
arr_opts = []
426+
arr_opts << '--force' if opts[:force]
427+
arr_opts << '-d' if opts[:d]
428+
427429
command('clean', arr_opts)
428430
end
429431

0 commit comments

Comments
 (0)