From: Brian Gernhardt Date: Thu, 19 Feb 2009 18:08:04 +0000 (-0500) Subject: git-svn: Create leading directories in create-ignore X-Git-Tag: v1.6.2-rc2~14^2~2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=7d9fd459f1f5064b421837e46fe87118a07f6d6c;p=git.git 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 Acked-by: Eric Wong --- diff --git a/git-svn.perl b/git-svn.perl index cbc5211d5..ef01fb93c 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -670,7 +670,11 @@ sub cmd_create_ignore { $gs->prop_walk($gs->{path}, $r, sub { my ($gs, $path, $props) = @_; # $path is of the form /path/to/dir/ - my $ignore = '.' . $path . '.gitignore'; + $path = '.' . $path; + # SVN can have attributes on empty directories, + # which git won't track + mkpath([$path]) unless -d $path; + my $ignore = $path . '.gitignore'; my $s = $props->{'svn:ignore'} or return; open(GITIGNORE, '>', $ignore) or fatal("Failed to open `$ignore' for writing: $!");