lib/itamae/resource/git.rb in itamae-1.9.9 vs lib/itamae/resource/git.rb in itamae-1.9.10
- old
+ new
@@ -8,10 +8,11 @@
define_attribute :action, default: :sync
define_attribute :destination, type: String, default_name: true
define_attribute :repository, type: String, required: true
define_attribute :revision, type: String
define_attribute :recursive, type: [TrueClass, FalseClass], default: false
+ define_attribute :depth, type: Integer
def pre_action
case @current_action
when :sync
attributes.exist = true
@@ -28,9 +29,10 @@
new_repository = false
if check_empty_dir
cmd = ['git', 'clone']
cmd << '--recursive' if attributes.recursive
+ cmd += ['--depth', attributes.depth.to_s] if attributes.depth
cmd << attributes.repository << attributes.destination
run_command(cmd)
new_repository = true
end