Skip to content

Commit

Permalink
git-svn: Create leading directories in create-ignore
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Brian Gernhardt authored and Eric Wong committed Feb 23, 2009
1 parent 2d602e9 commit 7d9fd45
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion git-svn.perl
Original file line number Diff line number Diff line change
Expand Up @@ -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: $!");
Expand Down

0 comments on commit 7d9fd45

Please sign in to comment.