summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Gernhardt <benji@silverinsanity.com>2009-02-19 18:08:04 (GMT)
committerEric Wong <normalperson@yhbt.net>2009-02-23 04:30:58 (GMT)
commit7d9fd459f1f5064b421837e46fe87118a07f6d6c (patch)
treeef82d481c491d9cdce66fef2b608c0e46132aa42
parent2d602e9179c7eb1a31a0abf41283c132e26a61af (diff)
downloadgit-7d9fd459f1f5064b421837e46fe87118a07f6d6c.zip
git-7d9fd459f1f5064b421837e46fe87118a07f6d6c.tar.gz
git-7d9fd459f1f5064b421837e46fe87118a07f6d6c.tar.bz2
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>
-rwxr-xr-xgit-svn.perl6
1 files changed, 5 insertions, 1 deletions
diff --git a/git-svn.perl b/git-svn.perl
index cbc5211..ef01fb9 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: $!");