@@ -219,11 +219,11 @@ sub _req_svn {
219219 " Set an SVN repository to a git tree-ish" ,
220220 { ' stdin' => \$_stdin, %cmt_opts , %fc_opts , } ],
221221 ' create-ignore' => [ \&cmd_create_ignore,
222- ' Create a .gitignore per svn: ignore' ,
222+ " Create a .gitignore per directory with SVN ignore properties " ,
223223 { ' revision|r=i' => \$_revision
224224 } ],
225225 ' mkdirs' => [ \&cmd_mkdirs ,
226- " recreate empty directories after a checkout" ,
226+ " Recreate empty directories after a checkout" ,
227227 { ' revision|r=i' => \$_revision } ],
228228 ' propget' => [ \&cmd_propget,
229229 ' Print the value of a property on a file or directory' ,
@@ -234,7 +234,7 @@ sub _req_svn {
234234 ' proplist' => [ \&cmd_proplist,
235235 ' List all properties of a file or directory' ,
236236 { ' revision|r=i' => \$_revision } ],
237- ' show-ignore' => [ \&cmd_show_ignore, " Show svn: ignore listings " ,
237+ ' show-ignore' => [ \&cmd_show_ignore, " Show .gitignore patterns from SVN ignore properties " ,
238238 { ' revision|r=i' => \$_revision
239239 } ],
240240 ' show-externals' => [ \&cmd_show_externals, " Show svn:externals listings" ,
@@ -1279,12 +1279,20 @@ sub cmd_show_ignore {
12791279 $gs -> prop_walk($gs -> path, $r , sub {
12801280 my ($gs , $path , $props ) = @_ ;
12811281 print STDOUT " \n # $path \n " ;
1282- my $s = $props -> {' svn:ignore' } or return ;
1283- $s =~ s / [\r\n ]+/ \n / g ;
1284- $s =~ s / ^\n +// ;
1285- chomp $s ;
1286- $s =~ s # ^# $path # gm ;
1287- print STDOUT " $s \n " ;
1282+ if (my $s = $props -> {' svn:ignore' }) {
1283+ $s =~ s / [\r\n ]+/ \n / g ;
1284+ $s =~ s / ^\n +// ;
1285+ chomp $s ;
1286+ $s =~ s # ^# $path # gm ;
1287+ print STDOUT " $s \n " ;
1288+ }
1289+ if (my $s = $props -> {' svn:global-ignores' }) {
1290+ $s =~ s / [\r\n ]+/ \n / g ;
1291+ $s =~ s / ^\n +// ;
1292+ chomp $s ;
1293+ $s =~ s # ^# $path **/# gm ;
1294+ print STDOUT " $s \n " ;
1295+ }
12881296 });
12891297}
12901298
@@ -1315,16 +1323,25 @@ sub cmd_create_ignore {
13151323 # which git won't track
13161324 mkpath([$path ]) unless -d $path ;
13171325 my $ignore = $path . ' .gitignore' ;
1318- my $s = $props -> {' svn:ignore' } or return ;
13191326 open (GITIGNORE, ' >' , $ignore )
13201327 or fatal(" Failed to open `$ignore ' for writing: $! " );
1321- $s =~ s / [\r\n ]+/ \n / g ;
1322- $s =~ s / ^\n +// ;
1323- chomp $s ;
1324- # Prefix all patterns so that the ignore doesn't apply
1325- # to sub-directories.
1326- $s =~ s # ^# /# gm ;
1327- print GITIGNORE " $s \n " ;
1328+ if (my $s = $props -> {' svn:ignore' }) {
1329+ $s =~ s / [\r\n ]+/ \n / g ;
1330+ $s =~ s / ^\n +// ;
1331+ chomp $s ;
1332+ # Prefix all patterns so that the ignore doesn't apply
1333+ # to sub-directories.
1334+ $s =~ s # ^# /# gm ;
1335+ print GITIGNORE " $s \n " ;
1336+ }
1337+ if (my $s = $props -> {' svn:global-ignores' }) {
1338+ $s =~ s / [\r\n ]+/ \n / g ;
1339+ $s =~ s / ^\n +// ;
1340+ chomp $s ;
1341+ # Global ignores apply to sub-directories, so they are
1342+ # not prefixed.
1343+ print GITIGNORE " $s \n " ;
1344+ }
13281345 close (GITIGNORE)
13291346 or fatal(" Failed to close `$ignore ': $! " );
13301347 command_noisy(' add' , ' -f' , $ignore );
0 commit comments