@matheusbsbs / matheus-bagliano / commits / a7d72544b1
Fork 0

git-svn: ignore leading blank lines in svn:ignore

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>

Michael Haggerty committed Aug 7, 2009 at 21:21 UTC a7d72544b112f093b6189a86d05b198b2be73828
2 files changed +6 -1
git-svn.perl
+2
@@ -764,6 +764,7 @@ sub cmd_show_ignore {
764 print STDOUT "\n# $path\n";
765 my $s = $props->{'svn:ignore'} or return;
766 $s =~ s/[\r\n]+/\n/g;
767 + $s =~ s/^\n+//;
768 chomp $s;
769 $s =~ s#^#$path#gm;
770 print STDOUT "$s\n";
@@ -801,6 +802,7 @@ sub cmd_create_ignore {
802 open(GITIGNORE, '>', $ignore)
803 or fatal("Failed to open `$ignore' for writing: $!");
804 $s =~ s/[\r\n]+/\n/g;
805 + $s =~ s/^\n+//;
806 chomp $s;
807 # Prefix all patterns so that the ignore doesn't apply
808 # to sub-directories.
t/t9101-git-svn-props.sh
+4 -1
@@ -142,7 +142,9 @@ test_expect_success 'test show-ignore' "
142 touch deeply/nested/directory/.keep &&
143 svn_cmd add deeply &&
144 svn_cmd up &&
145 - svn_cmd propset -R svn:ignore 'no-such-file*' .
145 + svn_cmd propset -R svn:ignore '
146 +no-such-file*
147 +' .
148 svn_cmd commit -m 'propset svn:ignore'
149 cd .. &&
150 git svn show-ignore > show-ignore.got &&
@@ -171,6 +173,7 @@ test_expect_success 'test create-ignore' "
173 "
174
175 cat >prop.expect <<\EOF
176 +
177 no-such-file*
178
179 EOF