File tree 3 files changed +9
-0
lines changed
3 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -311,6 +311,7 @@ g.fetch
311
311
g.fetch(g.remotes.first)
312
312
g.fetch(' origin' , {:ref => ' some/ref/head' } )
313
313
g.fetch(all: true , force: true , depth: 2 )
314
+ g.fetch(' origin' , {:'update-head-ok' => true })
314
315
315
316
g.pull
316
317
g.pull(Git ::Repo , Git ::Branch ) # fetch and a merge
Original file line number Diff line number Diff line change @@ -951,6 +951,7 @@ def fetch(remote, opts)
951
951
arr_opts << '--prune' if opts [ :p ] || opts [ :prune ]
952
952
arr_opts << '--prune-tags' if opts [ :P ] || opts [ :'prune-tags' ]
953
953
arr_opts << '--force' if opts [ :f ] || opts [ :force ]
954
+ arr_opts << '--update-head-ok' if opts [ :u ] || opts [ :'update-head-ok' ]
954
955
arr_opts << '--unshallow' if opts [ :unshallow ]
955
956
arr_opts << '--depth' << opts [ :depth ] if opts [ :depth ]
956
957
arr_opts << '--' if remote || opts [ :ref ]
Original file line number Diff line number Diff line change @@ -147,6 +147,13 @@ def test_fetch_cmd_with_all_with_other_args
147
147
assert_command_line ( expected_command_line , git_cmd , git_cmd_args )
148
148
end
149
149
150
+ def test_fetch_cmd_with_update_head_ok
151
+ expected_command_line = [ 'fetch' , '--update-head-ok' ]
152
+ git_cmd = :fetch
153
+ git_cmd_args = [ :'update-head-ok' => true ]
154
+ assert_command_line ( expected_command_line , git_cmd , git_cmd_args )
155
+ end
156
+
150
157
def test_fetch_command_injection
151
158
test_file = 'VULNERABILITY_EXISTS'
152
159
vulnerability_exists = false
You can’t perform that action at this time.
0 commit comments