|
1 | 1 | !> Implementation for interacting with git repositories.
|
2 | 2 | module fpm_git
|
3 | 3 | use fpm_error, only: error_t, fatal_error
|
4 |
| - use fpm_filesystem, only : get_temp_filename, getline, join_path, execute_and_read_output |
| 4 | + use fpm_filesystem, only : get_temp_filename, getline, join_path, execute_and_read_output, run |
| 5 | + |
5 | 6 | implicit none
|
6 | 7 |
|
7 | 8 | public :: git_target_t, git_target_default, git_target_branch, git_target_tag, git_target_revision, git_revision, &
|
@@ -321,35 +322,18 @@ subroutine git_archive(source, destination, ref, verbose, error)
|
321 | 322 | type(error_t), allocatable, intent(out) :: error
|
322 | 323 |
|
323 | 324 | integer :: stat
|
324 |
| - character(len=:), allocatable :: cmd_output, archive_format, cmd |
325 |
| - |
326 |
| - if (verbose) then |
327 |
| - print *, '' |
328 |
| - print *, 'Show git archive options:' |
329 |
| - print *, ' + git archive -l' |
330 |
| - end if |
| 325 | + character(len=:), allocatable :: cmd_output, archive_format |
331 | 326 |
|
332 |
| - call execute_and_read_output('git archive -l', cmd_output, error) |
| 327 | + call execute_and_read_output('git archive -l', cmd_output, error, verbose) |
333 | 328 | if (allocated(error)) return
|
334 | 329 |
|
335 |
| - if (verbose) print *, ' ', cmd_output |
336 |
| - |
337 | 330 | if (index(cmd_output, 'tar.gz') /= 0) then
|
338 | 331 | archive_format = 'tar.gz'
|
339 | 332 | else
|
340 | 333 | call fatal_error(error, "Cannot find a suitable archive format for 'git archive'."); return
|
341 | 334 | end if
|
342 | 335 |
|
343 |
| - cmd = 'git archive '//ref//' --format='//archive_format//' -o '//destination |
344 |
| - |
345 |
| - if (verbose) then |
346 |
| - print *, '' |
347 |
| - print *, 'Archive ', ref, ' using ', archive_format, ':' |
348 |
| - print *, ' + ', cmd |
349 |
| - print *, '' |
350 |
| - end if |
351 |
| - |
352 |
| - call execute_command_line(cmd, exitstat=stat) |
| 336 | + call run('git archive '//ref//' --format='//archive_format//' -o '//destination, echo=verbose, exitstat=stat) |
353 | 337 | if (stat /= 0) then
|
354 | 338 | call fatal_error(error, "Error packing '"//source//"'."); return
|
355 | 339 | end if
|
|
0 commit comments