Skip to content

Commit

Permalink
git-svn: ignore leading blank lines in svn:ignore
Browse files Browse the repository at this point in the history
Subversion ignores all blank lines in svn:ignore properties.  The old
git-svn code ignored blank lines everywhere except for the first line
of the svn:ignore property.  This patch makes the "git svn
show-ignore" and "git svn create-ignore" commands ignore leading blank
lines, too.

Also include leading blank lines in the test suite.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Acked-by: Eric Wong <normalperson@yhbt.net>
  • Loading branch information
Michael Haggerty authored and Eric Wong committed Aug 10, 2009
1 parent 63de84a commit a7d7254
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions git-svn.perl
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,7 @@ sub cmd_show_ignore {
print STDOUT "\n# $path\n";
my $s = $props->{'svn:ignore'} or return;
$s =~ s/[\r\n]+/\n/g;
$s =~ s/^\n+//;
chomp $s;
$s =~ s#^#$path#gm;
print STDOUT "$s\n";
Expand Down Expand Up @@ -801,6 +802,7 @@ sub cmd_create_ignore {
open(GITIGNORE, '>', $ignore)
or fatal("Failed to open `$ignore' for writing: $!");
$s =~ s/[\r\n]+/\n/g;
$s =~ s/^\n+//;
chomp $s;
# Prefix all patterns so that the ignore doesn't apply
# to sub-directories.
Expand Down
5 changes: 4 additions & 1 deletion t/t9101-git-svn-props.sh
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ test_expect_success 'test show-ignore' "
touch deeply/nested/directory/.keep &&
svn_cmd add deeply &&
svn_cmd up &&
svn_cmd propset -R svn:ignore 'no-such-file*' .
svn_cmd propset -R svn:ignore '
no-such-file*
' .
svn_cmd commit -m 'propset svn:ignore'
cd .. &&
git svn show-ignore > show-ignore.got &&
Expand Down Expand Up @@ -171,6 +173,7 @@ test_expect_success 'test create-ignore' "
"

cat >prop.expect <<\EOF
no-such-file*
EOF
Expand Down

0 comments on commit a7d7254

Please sign in to comment.