Browse Source

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>
maint
Brian Gernhardt 16 years ago committed by Eric Wong
parent
commit
7d9fd459f1
  1. 6
      git-svn.perl

6
git-svn.perl

@ -670,7 +670,11 @@ sub cmd_create_ignore { @@ -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: $!");

Loading…
Cancel
Save