@@ -219,11 +219,11 @@ sub _req_svn {
219
219
" Set an SVN repository to a git tree-ish" ,
220
220
{ ' stdin' => \$_stdin, %cmt_opts , %fc_opts , } ],
221
221
' create-ignore' => [ \&cmd_create_ignore,
222
- ' Create a .gitignore per svn: ignore' ,
222
+ " Create a .gitignore per directory with SVN ignore properties " ,
223
223
{ ' revision|r=i' => \$_revision
224
224
} ],
225
225
' mkdirs' => [ \&cmd_mkdirs ,
226
- " recreate empty directories after a checkout" ,
226
+ " Recreate empty directories after a checkout" ,
227
227
{ ' revision|r=i' => \$_revision } ],
228
228
' propget' => [ \&cmd_propget,
229
229
' Print the value of a property on a file or directory' ,
@@ -234,7 +234,7 @@ sub _req_svn {
234
234
' proplist' => [ \&cmd_proplist,
235
235
' List all properties of a file or directory' ,
236
236
{ ' 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 " ,
238
238
{ ' revision|r=i' => \$_revision
239
239
} ],
240
240
' show-externals' => [ \&cmd_show_externals, " Show svn:externals listings" ,
@@ -1279,12 +1279,20 @@ sub cmd_show_ignore {
1279
1279
$gs -> prop_walk($gs -> path, $r , sub {
1280
1280
my ($gs , $path , $props ) = @_ ;
1281
1281
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
+ }
1288
1296
});
1289
1297
}
1290
1298
@@ -1315,16 +1323,25 @@ sub cmd_create_ignore {
1315
1323
# which git won't track
1316
1324
mkpath([$path ]) unless -d $path ;
1317
1325
my $ignore = $path . ' .gitignore' ;
1318
- my $s = $props -> {' svn:ignore' } or return ;
1319
1326
open (GITIGNORE, ' >' , $ignore )
1320
1327
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
+ }
1328
1345
close (GITIGNORE)
1329
1346
or fatal(" Failed to close `$ignore ': $! " );
1330
1347
command_noisy(' add' , ' -f' , $ignore );
0 commit comments