# [PATCH 1/1] git-svn: ignore leading blank lines in svn:ignore

2 messages from 2009-08-07 to 2009-08-10. Participants: Michael Haggerty, Eric Wong.
Thread: https://gitlist.dev/t/20455

## Michael Haggerty, 2009-08-07 19:21

Subject: [PATCH 1/1] git-svn: ignore leading blank lines in svn:ignore
Message-ID: <e6857eacc53d862018138bd8d9e1ab778e8f5725.1249672562.git.mhagger@alum.mit.edu>
URL: https://gitlist.dev/e/e6857eacc53d862018138bd8d9e1ab778e8f5725.1249672562.git.mhagger%40alum.mit.edu

```
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>
---
 git-svn.perl             |    2 ++
 t/t9101-git-svn-props.sh |    5 ++++-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index d075810..f1cc849 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -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";
@@ -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.
diff --git a/t/t9101-git-svn-props.sh b/t/t9101-git-svn-props.sh
index 9da4178..929499e 100755
--- a/t/t9101-git-svn-props.sh
+++ b/t/t9101-git-svn-props.sh
@@ -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 &&
@@ -171,6 +173,7 @@ test_expect_success 'test create-ignore' "
 	"
 
 cat >prop.expect <<\EOF
+
 no-such-file*
 
 EOF
-- 
1.6.4

```

## Eric Wong, 2009-08-10 09:38

Subject: Re: [PATCH 1/1] git-svn: ignore leading blank lines in svn:ignore
Message-ID: <20090810093827.GA28489@dcvr.yhbt.net>
URL: https://gitlist.dev/e/20090810093827.GA28489%40dcvr.yhbt.net
In-Reply-To: <e6857eacc53d862018138bd8d9e1ab778e8f5725.1249672562.git.mhagger@alum.mit.edu>

```
Michael Haggerty <mhagger@alum.mit.edu> wrote:
> 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>

Thanks Michael,

Acked out and pushed out along with two of Adam's to
git://yhbt.net/git-svn:

Adam Brewster (2):
      svn: Add && to t9107-git-svn-migrate.sh
      svn: Honor --prefix option in init without --stdlayout

Michael Haggerty (1):
      git-svn: ignore leading blank lines in svn:ignore

-- 
Eric Wong

```
