# [PATCH] git-svn: Create leading directories in create-ignore

2 messages from 2009-02-19 to 2009-02-23. Participants: Brian Gernhardt, Eric Wong.
Thread: https://gitlist.dev/t/17904

## Brian Gernhardt, 2009-02-19 18:08

Subject: [PATCH] git-svn: Create leading directories in create-ignore
Message-ID: <1235066884-56575-1-git-send-email-benji@silverinsanity.com>
URL: https://gitlist.dev/e/1235066884-56575-1-git-send-email-benji%40silverinsanity.com

```
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>
---
 git-svn.perl |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index cbc5211..8acd69e 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -670,7 +670,10 @@ 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: $!");
-- 
1.6.2.rc1.241.g7bf82

```

## Eric Wong, 2009-02-23 04:34

Subject: Re: [PATCH] git-svn: Create leading directories in create-ignore
Message-ID: <20090223043456.GB21136@dcvr.yhbt.net>
URL: https://gitlist.dev/e/20090223043456.GB21136%40dcvr.yhbt.net
In-Reply-To: <1235066884-56575-1-git-send-email-benji@silverinsanity.com>

```
Brian Gernhardt <benji@silverinsanity.com> wrote:
> 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>

Thanks Brian, applied with minor line wrapping adjustment
and pushed out to:

  git://git.bogomips.org/git-svn

-- 
Eric Wong

```
