@@ -424,20 +424,22 @@ pure function descriptor_name(descriptor) result(name)
424
424
end function descriptor_name
425
425
426
426
! > Archive a folder using `git archive`.
427
- subroutine git_archive (source , destination , ref , verbose , error )
427
+ subroutine git_archive (source , destination , ref , additional_files , verbose , error )
428
428
! > Directory to archive.
429
429
character (* ), intent (in ) :: source
430
430
! > Destination of the archive.
431
431
character (* ), intent (in ) :: destination
432
432
! > (Symbolic) Reference to be archived.
433
433
character (* ), intent (in ) :: ref
434
+ ! > (Optional) list of additional untracked files to be added to the archive.
435
+ character (* ), optional , intent (in ) :: additional_files(:)
434
436
! > Print additional information if true.
435
437
logical , intent (in ) :: verbose
436
438
! > Error handling.
437
439
type (error_t), allocatable , intent (out ) :: error
438
440
439
- integer :: stat
440
- character (len= :), allocatable :: cmd_output, archive_format
441
+ integer :: stat,i
442
+ character (len= :), allocatable :: cmd_output, archive_format, add_files
441
443
442
444
call execute_and_read_output(' git archive -l' , cmd_output, error, verbose)
443
445
if (allocated (error)) return
@@ -448,9 +450,16 @@ subroutine git_archive(source, destination, ref, verbose, error)
448
450
call fatal_error(error, " Cannot find a suitable archive format for 'git archive'." ); return
449
451
end if
450
452
453
+ allocate (character (len= 0 ) :: add_files)
454
+ if (present (additional_files) then
455
+ do i= 1 ,size (additional_files)
456
+ add_files = trim (add_files)// ' --add-file=' // adjustl (additional_files(i))
457
+ end do
458
+ endif
459
+
451
460
call run(' git archive ' // ref// ' &
452
- --format=' // archive_format// ' &
453
- --add-file=fpm_model.json \
461
+ --format=' // archive_format// &
462
+ add_files // ' \
454
463
-o ' // destination, \
455
464
echo= verbose, \
456
465
exitstat= stat)
0 commit comments