threads / patch / 17904

patchgit-svn: Create leading directories in create-ignore

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

## tl;dr

2 messages between Feb 19, 2009 and Feb 23, 2009. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Brian Gernhardt· Feb 19, 2009, 18:08 UTC · lore

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(-)
Show changes to git-svn.perl +4 −1
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· Feb 23, 2009, 04:34 UTC · re: Brian Gernhardt · lore

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

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

← back to recent threads