@@ -223,6 +223,12 @@ OptionParser.new do |opts|
223
223
opts . on ( "--skip-fetch" , "skip fetching the latest git objects and refs from the remote source" ) do |v |
224
224
@options [ :skip_fetch ] = v
225
225
end
226
+ opts . on ( "--fetch-branches" , "fetch branches from the remote source" ) do |v |
227
+ @options [ :fetch_branches ] = v
228
+ end
229
+ opts . on ( "--fetch-tags" , "fetch tags from the remote source" ) do |v |
230
+ @options [ :fetch_tags ] = v
231
+ end
226
232
opts . on ( "--skip-cleanup" , "skip cleaning up the target VM. this may be useful for copying additional files from the target after the build" ) do |v |
227
233
@options [ :skip_cleanup ] = v
228
234
end
@@ -320,12 +326,19 @@ build_desc["remotes"].each do |remote|
320
326
system! ( "git init inputs/#{ dir } " )
321
327
end
322
328
if !@options [ :skip_fetch ]
323
- system! ( "cd inputs/#{ dir } && git fetch -f --update-head-ok #{ sanitize_path ( remote [ "url" ] , remote [ "url" ] ) } #{ commit } :refs/tags/tobuild" )
324
- system! ( "cd inputs/#{ dir } && git checkout -q tobuild" )
325
- system! ( "cd inputs/#{ dir } && git submodule update --init --recursive --force" )
329
+ if @options [ :fetch_branches ]
330
+ system! ( "cd inputs/#{ dir } && git fetch -f --update-head-ok #{ sanitize_path ( remote [ "url" ] , remote [ "url" ] ) } +refs/heads/*:refs/heads/*" )
331
+ end
332
+ if @options [ :fetch_tags ]
333
+ system! ( "cd inputs/#{ dir } && git fetch -f --update-head-ok #{ sanitize_path ( remote [ "url" ] , remote [ "url" ] ) } +refs/tags/*:refs/tags/*" )
334
+ end
335
+ system! ( "cd inputs/#{ dir } && git fetch -f --update-head-ok #{ sanitize_path ( remote [ "url" ] , remote [ "url" ] ) } #{ commit } " )
336
+ system! ( "cd inputs/#{ dir } && git checkout -q FETCH_HEAD" )
337
+ else
338
+ system! ( "cd inputs/#{ dir } && git checkout -q #{ commit } " )
326
339
end
327
- commit = ` cd inputs/#{ dir } && git log --format=%H -1 tobuild` . strip
328
- raise "error looking up commit for tag #{ remote [ "commit" ] } " unless $? . exitstatus == 0
340
+ system! ( " cd inputs/#{ dir } && git submodule update --init --recursive --force" )
341
+ commit = `cd inputs/ #{ dir } && git log --format=%H -1` . strip
329
342
in_sums << "git:#{ commit } #{ dir } "
330
343
end
331
344
0 commit comments