Skip to content

Commit 7d9fd45

Browse files
BenabikEric Wong
authored andcommitted
git-svn: Create leading directories in create-ignore
Since SVN tracks empty directories and git does not, we can not assume that the directory exists when creating .gitignore files. Signed-off-by: Brian Gernhardt <[email protected]> Acked-by: Eric Wong <[email protected]>
1 parent 2d602e9 commit 7d9fd45

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

git-svn.perl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,11 @@ sub cmd_create_ignore {
670670
$gs->prop_walk($gs->{path}, $r, sub {
671671
my ($gs, $path, $props) = @_;
672672
# $path is of the form /path/to/dir/
673-
my $ignore = '.' . $path . '.gitignore';
673+
$path = '.' . $path;
674+
# SVN can have attributes on empty directories,
675+
# which git won't track
676+
mkpath([$path]) unless -d $path;
677+
my $ignore = $path . '.gitignore';
674678
my $s = $props->{'svn:ignore'} or return;
675679
open(GITIGNORE, '>', $ignore)
676680
or fatal("Failed to open `$ignore' for writing: $!");

0 commit comments

Comments
 (0)