Bug 38664: The auto-rebase script - Create parent directory if missing

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Jonathan Druart 2025-02-12 12:01:25 +01:00 committed by Katrin Fischer
parent 2f9b826a55
commit a76a1f0073
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 9 additions and 3 deletions

View File

@ -2,9 +2,11 @@
use Modern::Perl;
use Term::ANSIColor qw(:constants);
use Git::Wrapper;
use File::Slurp qw( write_file );
use File::Temp qw( tempfile );
use List::Util qw( first );
use File::Slurp qw( write_file );
use File::Temp qw( tempfile );
use File::Basename qw(dirname);
use File::Path qw(make_path);
use List::Util qw( first );
use Getopt::Long;
use Pod::Usage;
use Try::Tiny;
@ -164,6 +166,10 @@ FILE: while ( my ( $ii, $file ) = each @modified_files ) {
next unless @content; # We removed the file
my $parent_directory = dirname($file);
unless ( -f $parent_directory ) {
make_path($parent_directory);
}
write_file( $file, join "\n", @content );
# Tidy the file