@matheusbsbs / matheus-bagliano / commits / 7d9fd459f1
Fork 0

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 <benji@silverinsanity.com> Acked-by: Eric Wong <normalperson@yhbt.net>

Brian Gernhardt committed Feb 19, 2009 at 13:08 UTC 7d9fd459f1f5064b421837e46fe87118a07f6d6c
1 file changed +5 -1
git-svn.perl
+5 -1
@@ -670,7 +670,11 @@ sub cmd_create_ignore {
670 $gs->prop_walk($gs->{path}, $r, sub {
671 my ($gs, $path, $props) = @_;
672 # $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';
678 my $s = $props->{'svn:ignore'} or return;
679 open(GITIGNORE, '>', $ignore)
680 or fatal("Failed to open `$ignore' for writing: $!");