git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Brian Gernhardt <benji@silverinsanity.com>
Date
Feb 19, 2009, 18:08 UTC
Message-ID
<1235066884-56575-1-git-send-email-benji@silverinsanity.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
Next: Eric Wong
Message 1 of 2 in “git-svn: Create leading directories in create-ignore”
  1. git-svn: Create leading directories in create-ignoreBrian Gernhardt, Feb 19, 2009
  2. Eric WongFeb 23, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.