git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] git-svn: use svn:global-ignores when creating .gitignores
@ 2024-07-17 19:57 Alex Galvin via GitGitGadget
  2024-07-17 19:57 ` [PATCH 1/2] git-svn: add public property `svn:global-ignores` Alex Galvin via GitGitGadget
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Alex Galvin via GitGitGadget @ 2024-07-17 19:57 UTC (permalink / raw)
  To: git; +Cc: Alex Galvin

Git-SVN does not currently use the svn:global-ignores property added in
Subversion 1.8 when showing or creating .gitignore files. This causes
Git-SVN to track files that are ignored by this directive in Subversion.

The following patches add svn:global-ignores to the list of public svn
properties, and update git svn show-ignore and git svn create-ignore to use
this attribute (as well as svn:ignore).

Alex Galvin (2):
  git-svn: add public property `svn:global-ignores`
  git-svn: use `svn:global-ignores` to create .gitignore

 git-svn.perl    | 45 +++++++++++++++++++++++++++++++--------------
 perl/Git/SVN.pm |  2 +-
 2 files changed, 32 insertions(+), 15 deletions(-)


base-commit: c2b3f2b3cdbf5ad9feb978dd367d77561a1271f7
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1747%2Fav-gal%2Fgit-svn-global-ignores-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1747/av-gal/git-svn-global-ignores-v1
Pull-Request: https://github.com/git/git/pull/1747
-- 
gitgitgadget

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/2] git-svn: add public property `svn:global-ignores`
  2024-07-17 19:57 [PATCH 0/2] git-svn: use svn:global-ignores when creating .gitignores Alex Galvin via GitGitGadget
@ 2024-07-17 19:57 ` Alex Galvin via GitGitGadget
  2024-07-17 19:57 ` [PATCH 2/2] git-svn: use `svn:global-ignores` to create .gitignore Alex Galvin via GitGitGadget
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 13+ messages in thread
From: Alex Galvin via GitGitGadget @ 2024-07-17 19:57 UTC (permalink / raw)
  To: git; +Cc: Alex Galvin, Alex Galvin

From: Alex Galvin <agalvin@comqi.com>

Signed-off-by: Alex Galvin <agalvin@comqi.com>
---
 perl/Git/SVN.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm
index 7721708ce5d..b0913ca1b63 100644
--- a/perl/Git/SVN.pm
+++ b/perl/Git/SVN.pm
@@ -763,7 +763,7 @@ sub prop_walk {
 		# this needs to be updated.
 		++$interesting_props if /^svn:(?:ignore|keywords|executable
 		                                 |eol-style|mime-type
-						 |externals|needs-lock)$/x;
+						 |externals|needs-lock|global-ignores)$/x;
 	}
 	&$sub($self, $p, $props) if $interesting_props;
 
-- 
gitgitgadget


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/2] git-svn: use `svn:global-ignores` to create .gitignore
  2024-07-17 19:57 [PATCH 0/2] git-svn: use svn:global-ignores when creating .gitignores Alex Galvin via GitGitGadget
  2024-07-17 19:57 ` [PATCH 1/2] git-svn: add public property `svn:global-ignores` Alex Galvin via GitGitGadget
@ 2024-07-17 19:57 ` Alex Galvin via GitGitGadget
  2024-07-17 20:45 ` [PATCH 0/2] git-svn: use svn:global-ignores when creating .gitignores Junio C Hamano
  2024-07-18 20:47 ` [PATCH v2 " Alex Galvin via GitGitGadget
  3 siblings, 0 replies; 13+ messages in thread
From: Alex Galvin via GitGitGadget @ 2024-07-17 19:57 UTC (permalink / raw)
  To: git; +Cc: Alex Galvin, Alex Galvin

From: Alex Galvin <agalvin@comqi.com>

Signed-off-by: Alex Galvin <agalvin@comqi.com>
---
 git-svn.perl | 45 +++++++++++++++++++++++++++++++--------------
 1 file changed, 31 insertions(+), 14 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index b0d0a50984b..a2a46608c9b 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -1279,12 +1279,20 @@ sub cmd_show_ignore {
 	$gs->prop_walk($gs->path, $r, sub {
 		my ($gs, $path, $props) = @_;
 		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";
+		if (my $s = $props->{'svn:ignore'}) {
+			$s =~ s/[\r\n]+/\n/g;
+			$s =~ s/^\n+//;
+			chomp $s;
+			$s =~ s#^#$path#gm;
+			print STDOUT "$s\n";
+		}
+		if (my $s = $props->{'svn:global-ignores'}) {
+			$s =~ s/[\r\n]+/\n/g;
+			$s =~ s/^\n+//;
+			chomp $s;
+			$s =~ s#^#$path**/#gm;
+			print STDOUT "$s\n";
+		}
 	});
 }
 
@@ -1315,16 +1323,25 @@ sub cmd_create_ignore {
 		# which git won't track
 		mkpath([$path]) unless -d $path;
 		my $ignore = $path . '.gitignore';
-		my $s = $props->{'svn:ignore'} or return;
 		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.
-		$s =~ s#^#/#gm;
-		print GITIGNORE "$s\n";
+		if (my $s = $props->{'svn:ignore'}) {
+			$s =~ s/[\r\n]+/\n/g;
+			$s =~ s/^\n+//;
+			chomp $s;
+			# Prefix all patterns so that the ignore doesn't apply
+			# to sub-directories.
+			$s =~ s#^#/#gm;
+			print GITIGNORE "$s\n";
+		}
+		if (my $s = $props->{'svn:global-ignores'}) {
+			$s =~ s/[\r\n]+/\n/g;
+			$s =~ s/^\n+//;
+			chomp $s;
+			# Global ignores apply to sub-directories, so they are
+			# not prefixed.
+			print GITIGNORE "$s\n";
+		}
 		close(GITIGNORE)
 		  or fatal("Failed to close `$ignore': $!");
 		command_noisy('add', '-f', $ignore);
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/2] git-svn: use svn:global-ignores when creating .gitignores
  2024-07-17 19:57 [PATCH 0/2] git-svn: use svn:global-ignores when creating .gitignores Alex Galvin via GitGitGadget
  2024-07-17 19:57 ` [PATCH 1/2] git-svn: add public property `svn:global-ignores` Alex Galvin via GitGitGadget
  2024-07-17 19:57 ` [PATCH 2/2] git-svn: use `svn:global-ignores` to create .gitignore Alex Galvin via GitGitGadget
@ 2024-07-17 20:45 ` Junio C Hamano
  2024-07-18 19:59   ` Alex Galvin
  2024-07-18 20:47 ` [PATCH v2 " Alex Galvin via GitGitGadget
  3 siblings, 1 reply; 13+ messages in thread
From: Junio C Hamano @ 2024-07-17 20:45 UTC (permalink / raw)
  To: Alex Galvin via GitGitGadget; +Cc: git, Alex Galvin

"Alex Galvin via GitGitGadget" <gitgitgadget@gmail.com> writes:

> Git-SVN does not currently use the svn:global-ignores property added in
> Subversion 1.8 when showing or creating .gitignore files. This causes
> Git-SVN to track files that are ignored by this directive in Subversion.

That is a well written explanation of what issue the patches want to
address.

> The following patches add svn:global-ignores to the list of public svn
> properties, and update git svn show-ignore and git svn create-ignore to use
> this attribute (as well as svn:ignore).

Paying attention to the new property and get it reflected to
.gitignore on Git side may be a reasonable solution, especially if
we ignore older version of Subversion.  But I have a naïve question.
If a new version of git-svn starts to rely on the new property that
is only available in SVN 1.8, would it create problems with folks
whose SVN installation does not understand it?  Would it cause
problems to them?

Anyway, in this project, explanation of the problem the patches
address, with the outline of the solution, should be in the proposed
commit log message of the patches themselves, not just written in
the cover letter.  Can you redo the proposed log messages of these
two patches, where you have none in this iteration?

Thanks.

> Alex Galvin (2):
>   git-svn: add public property `svn:global-ignores`
>   git-svn: use `svn:global-ignores` to create .gitignore
>
>  git-svn.perl    | 45 +++++++++++++++++++++++++++++++--------------
>  perl/Git/SVN.pm |  2 +-
>  2 files changed, 32 insertions(+), 15 deletions(-)
>
>
> base-commit: c2b3f2b3cdbf5ad9feb978dd367d77561a1271f7
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1747%2Fav-gal%2Fgit-svn-global-ignores-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1747/av-gal/git-svn-global-ignores-v1
> Pull-Request: https://github.com/git/git/pull/1747

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/2] git-svn: use svn:global-ignores when creating .gitignores
  2024-07-17 20:45 ` [PATCH 0/2] git-svn: use svn:global-ignores when creating .gitignores Junio C Hamano
@ 2024-07-18 19:59   ` Alex Galvin
  0 siblings, 0 replies; 13+ messages in thread
From: Alex Galvin @ 2024-07-18 19:59 UTC (permalink / raw)
  To: Junio C Hamano, Alex Galvin via GitGitGadget; +Cc: git


On 2024-07-17 4:45 p.m., Junio C Hamano wrote:
> Paying attention to the new property and get it reflected to
> .gitignore on Git side may be a reasonable solution, especially if
> we ignore older version of Subversion.  But I have a naïve question.
> If a new version of git-svn starts to rely on the new property that
> is only available in SVN 1.8, would it create problems with folks
> whose SVN installation does not understand it?  Would it cause
> problems to them?

I don't believe so. Git doesn't do anything to set these properties,
it just reads and translates them into the format used by .gitignore.
So users on old versions of SVN should not be affected, their
servers will not have this property set anywhere.

> Anyway, in this project, explanation of the problem the patches
> address, with the outline of the solution, should be in the proposed
> commit log message of the patches themselves, not just written in
> the cover letter.  Can you redo the proposed log messages of these
> two patches, where you have none in this iteration?
>
> Thanks.
Sure thing. An amended patchset is incoming.

Thanks,
Alex

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 0/2] git-svn: use svn:global-ignores when creating .gitignores
  2024-07-17 19:57 [PATCH 0/2] git-svn: use svn:global-ignores when creating .gitignores Alex Galvin via GitGitGadget
                   ` (2 preceding siblings ...)
  2024-07-17 20:45 ` [PATCH 0/2] git-svn: use svn:global-ignores when creating .gitignores Junio C Hamano
@ 2024-07-18 20:47 ` Alex Galvin via GitGitGadget
  2024-07-18 20:47   ` [PATCH v2 1/2] git-svn: add public property `svn:global-ignores` Alex Galvin via GitGitGadget
                     ` (2 more replies)
  3 siblings, 3 replies; 13+ messages in thread
From: Alex Galvin via GitGitGadget @ 2024-07-18 20:47 UTC (permalink / raw)
  To: git; +Cc: Alex Galvin

Git-SVN does not currently use the svn:global-ignores property added in
Subversion 1.8 when showing or creating .gitignore files. This causes
Git-SVN to track files that are ignored by this directive in Subversion.

The following patches add svn:global-ignores to the list of public svn
properties, and update git svn show-ignore and git svn create-ignore to use
this attribute (as well as svn:ignore).

Alex Galvin (2):
  git-svn: add public property `svn:global-ignores`
  git-svn: use `svn:global-ignores` to create .gitignore

 git-svn.perl    | 45 +++++++++++++++++++++++++++++++--------------
 perl/Git/SVN.pm |  2 +-
 2 files changed, 32 insertions(+), 15 deletions(-)


base-commit: c2b3f2b3cdbf5ad9feb978dd367d77561a1271f7
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1747%2Fav-gal%2Fgit-svn-global-ignores-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1747/av-gal/git-svn-global-ignores-v2
Pull-Request: https://github.com/git/git/pull/1747

Range-diff vs v1:

 1:  27bee8de47b ! 1:  002750ea47a git-svn: add public property `svn:global-ignores`
     @@ Metadata
       ## Commit message ##
          git-svn: add public property `svn:global-ignores`
      
     +    Subversion 1.8 added a new property `svn:global-ignores`. It
     +    contains a list of patterns used to determine what files should
     +    be ignored. If Git-SVN is going to ignore these files as well, it
     +    is important that we do not skip over directories that have this
     +    property set.
     +
          Signed-off-by: Alex Galvin <agalvin@comqi.com>
      
       ## perl/Git/SVN.pm ##
 2:  10e240202f7 ! 2:  7735afb32af git-svn: use `svn:global-ignores` to create .gitignore
     @@ Metadata
       ## Commit message ##
          git-svn: use `svn:global-ignores` to create .gitignore
      
     +    `svn:global-ignores` contains a list of file patterns that should
     +    not be tracked in version control. The syntax of these patterns is
     +    the same as `svn:ignore`. Their semantics differ: patterns in
     +    `svn:global-ignores` apply to all paths under the directory where
     +    they apply, while `svn:ignore` only applies to the directory's
     +    immediate children.
     +
          Signed-off-by: Alex Galvin <agalvin@comqi.com>
      
       ## git-svn.perl ##

-- 
gitgitgadget

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 1/2] git-svn: add public property `svn:global-ignores`
  2024-07-18 20:47 ` [PATCH v2 " Alex Galvin via GitGitGadget
@ 2024-07-18 20:47   ` Alex Galvin via GitGitGadget
  2024-07-18 20:47   ` [PATCH v2 2/2] git-svn: use `svn:global-ignores` to create .gitignore Alex Galvin via GitGitGadget
  2024-08-12 16:58   ` [PATCH v3 0/3] git-svn: use svn:global-ignores when creating .gitignores Alex Galvin via GitGitGadget
  2 siblings, 0 replies; 13+ messages in thread
From: Alex Galvin via GitGitGadget @ 2024-07-18 20:47 UTC (permalink / raw)
  To: git; +Cc: Alex Galvin, Alex Galvin

From: Alex Galvin <agalvin@comqi.com>

Subversion 1.8 added a new property `svn:global-ignores`. It
contains a list of patterns used to determine what files should
be ignored. If Git-SVN is going to ignore these files as well, it
is important that we do not skip over directories that have this
property set.

Signed-off-by: Alex Galvin <agalvin@comqi.com>
---
 perl/Git/SVN.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm
index 7721708ce5d..b0913ca1b63 100644
--- a/perl/Git/SVN.pm
+++ b/perl/Git/SVN.pm
@@ -763,7 +763,7 @@ sub prop_walk {
 		# this needs to be updated.
 		++$interesting_props if /^svn:(?:ignore|keywords|executable
 		                                 |eol-style|mime-type
-						 |externals|needs-lock)$/x;
+						 |externals|needs-lock|global-ignores)$/x;
 	}
 	&$sub($self, $p, $props) if $interesting_props;
 
-- 
gitgitgadget


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 2/2] git-svn: use `svn:global-ignores` to create .gitignore
  2024-07-18 20:47 ` [PATCH v2 " Alex Galvin via GitGitGadget
  2024-07-18 20:47   ` [PATCH v2 1/2] git-svn: add public property `svn:global-ignores` Alex Galvin via GitGitGadget
@ 2024-07-18 20:47   ` Alex Galvin via GitGitGadget
  2024-08-12 16:58   ` [PATCH v3 0/3] git-svn: use svn:global-ignores when creating .gitignores Alex Galvin via GitGitGadget
  2 siblings, 0 replies; 13+ messages in thread
From: Alex Galvin via GitGitGadget @ 2024-07-18 20:47 UTC (permalink / raw)
  To: git; +Cc: Alex Galvin, Alex Galvin

From: Alex Galvin <agalvin@comqi.com>

`svn:global-ignores` contains a list of file patterns that should
not be tracked in version control. The syntax of these patterns is
the same as `svn:ignore`. Their semantics differ: patterns in
`svn:global-ignores` apply to all paths under the directory where
they apply, while `svn:ignore` only applies to the directory's
immediate children.

Signed-off-by: Alex Galvin <agalvin@comqi.com>
---
 git-svn.perl | 45 +++++++++++++++++++++++++++++++--------------
 1 file changed, 31 insertions(+), 14 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index b0d0a50984b..a2a46608c9b 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -1279,12 +1279,20 @@ sub cmd_show_ignore {
 	$gs->prop_walk($gs->path, $r, sub {
 		my ($gs, $path, $props) = @_;
 		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";
+		if (my $s = $props->{'svn:ignore'}) {
+			$s =~ s/[\r\n]+/\n/g;
+			$s =~ s/^\n+//;
+			chomp $s;
+			$s =~ s#^#$path#gm;
+			print STDOUT "$s\n";
+		}
+		if (my $s = $props->{'svn:global-ignores'}) {
+			$s =~ s/[\r\n]+/\n/g;
+			$s =~ s/^\n+//;
+			chomp $s;
+			$s =~ s#^#$path**/#gm;
+			print STDOUT "$s\n";
+		}
 	});
 }
 
@@ -1315,16 +1323,25 @@ sub cmd_create_ignore {
 		# which git won't track
 		mkpath([$path]) unless -d $path;
 		my $ignore = $path . '.gitignore';
-		my $s = $props->{'svn:ignore'} or return;
 		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.
-		$s =~ s#^#/#gm;
-		print GITIGNORE "$s\n";
+		if (my $s = $props->{'svn:ignore'}) {
+			$s =~ s/[\r\n]+/\n/g;
+			$s =~ s/^\n+//;
+			chomp $s;
+			# Prefix all patterns so that the ignore doesn't apply
+			# to sub-directories.
+			$s =~ s#^#/#gm;
+			print GITIGNORE "$s\n";
+		}
+		if (my $s = $props->{'svn:global-ignores'}) {
+			$s =~ s/[\r\n]+/\n/g;
+			$s =~ s/^\n+//;
+			chomp $s;
+			# Global ignores apply to sub-directories, so they are
+			# not prefixed.
+			print GITIGNORE "$s\n";
+		}
 		close(GITIGNORE)
 		  or fatal("Failed to close `$ignore': $!");
 		command_noisy('add', '-f', $ignore);
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v3 0/3] git-svn: use svn:global-ignores when creating .gitignores
  2024-07-18 20:47 ` [PATCH v2 " Alex Galvin via GitGitGadget
  2024-07-18 20:47   ` [PATCH v2 1/2] git-svn: add public property `svn:global-ignores` Alex Galvin via GitGitGadget
  2024-07-18 20:47   ` [PATCH v2 2/2] git-svn: use `svn:global-ignores` to create .gitignore Alex Galvin via GitGitGadget
@ 2024-08-12 16:58   ` Alex Galvin via GitGitGadget
  2024-08-12 16:58     ` [PATCH v3 1/3] git-svn: add public property `svn:global-ignores` Alex Galvin via GitGitGadget
                       ` (3 more replies)
  2 siblings, 4 replies; 13+ messages in thread
From: Alex Galvin via GitGitGadget @ 2024-08-12 16:58 UTC (permalink / raw)
  To: git; +Cc: Alex Galvin

Git-SVN does not currently use the svn:global-ignores property added in
Subversion 1.8 when showing or creating .gitignore files. This causes
Git-SVN to track files that are ignored by this directive in Subversion.

The following patches add svn:global-ignores to the list of public svn
properties, and update git svn show-ignore and git svn create-ignore to use
this attribute (as well as svn:ignore).

Alex Galvin (3):
  git-svn: add public property `svn:global-ignores`
  git-svn: use `svn:global-ignores` to create .gitignore
  git-svn: mention `svn:globalignores` in help

 git-svn.perl    | 49 +++++++++++++++++++++++++++++++++----------------
 perl/Git/SVN.pm |  2 +-
 2 files changed, 34 insertions(+), 17 deletions(-)


base-commit: c2b3f2b3cdbf5ad9feb978dd367d77561a1271f7
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1747%2Fav-gal%2Fgit-svn-global-ignores-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1747/av-gal/git-svn-global-ignores-v3
Pull-Request: https://github.com/git/git/pull/1747

Range-diff vs v2:

 1:  002750ea47a = 1:  002750ea47a git-svn: add public property `svn:global-ignores`
 2:  7735afb32af = 2:  7735afb32af git-svn: use `svn:global-ignores` to create .gitignore
 -:  ----------- > 3:  18dffbe992e git-svn: mention `svn:globalignores` in help

-- 
gitgitgadget

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v3 1/3] git-svn: add public property `svn:global-ignores`
  2024-08-12 16:58   ` [PATCH v3 0/3] git-svn: use svn:global-ignores when creating .gitignores Alex Galvin via GitGitGadget
@ 2024-08-12 16:58     ` Alex Galvin via GitGitGadget
  2024-08-12 16:58     ` [PATCH v3 2/3] git-svn: use `svn:global-ignores` to create .gitignore Alex Galvin via GitGitGadget
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 13+ messages in thread
From: Alex Galvin via GitGitGadget @ 2024-08-12 16:58 UTC (permalink / raw)
  To: git; +Cc: Alex Galvin, Alex Galvin

From: Alex Galvin <agalvin@comqi.com>

Subversion 1.8 added a new property `svn:global-ignores`. It
contains a list of patterns used to determine what files should
be ignored. If Git-SVN is going to ignore these files as well, it
is important that we do not skip over directories that have this
property set.

Signed-off-by: Alex Galvin <agalvin@comqi.com>
---
 perl/Git/SVN.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm
index 7721708ce5d..b0913ca1b63 100644
--- a/perl/Git/SVN.pm
+++ b/perl/Git/SVN.pm
@@ -763,7 +763,7 @@ sub prop_walk {
 		# this needs to be updated.
 		++$interesting_props if /^svn:(?:ignore|keywords|executable
 		                                 |eol-style|mime-type
-						 |externals|needs-lock)$/x;
+						 |externals|needs-lock|global-ignores)$/x;
 	}
 	&$sub($self, $p, $props) if $interesting_props;
 
-- 
gitgitgadget


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v3 2/3] git-svn: use `svn:global-ignores` to create .gitignore
  2024-08-12 16:58   ` [PATCH v3 0/3] git-svn: use svn:global-ignores when creating .gitignores Alex Galvin via GitGitGadget
  2024-08-12 16:58     ` [PATCH v3 1/3] git-svn: add public property `svn:global-ignores` Alex Galvin via GitGitGadget
@ 2024-08-12 16:58     ` Alex Galvin via GitGitGadget
  2024-08-12 16:58     ` [PATCH v3 3/3] git-svn: mention `svn:globalignores` in help Alex Galvin via GitGitGadget
  2024-08-12 20:39     ` [PATCH v3 0/3] git-svn: use svn:global-ignores when creating .gitignores Junio C Hamano
  3 siblings, 0 replies; 13+ messages in thread
From: Alex Galvin via GitGitGadget @ 2024-08-12 16:58 UTC (permalink / raw)
  To: git; +Cc: Alex Galvin, Alex Galvin

From: Alex Galvin <agalvin@comqi.com>

`svn:global-ignores` contains a list of file patterns that should
not be tracked in version control. The syntax of these patterns is
the same as `svn:ignore`. Their semantics differ: patterns in
`svn:global-ignores` apply to all paths under the directory where
they apply, while `svn:ignore` only applies to the directory's
immediate children.

Signed-off-by: Alex Galvin <agalvin@comqi.com>
---
 git-svn.perl | 45 +++++++++++++++++++++++++++++++--------------
 1 file changed, 31 insertions(+), 14 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index b0d0a50984b..a2a46608c9b 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -1279,12 +1279,20 @@ sub cmd_show_ignore {
 	$gs->prop_walk($gs->path, $r, sub {
 		my ($gs, $path, $props) = @_;
 		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";
+		if (my $s = $props->{'svn:ignore'}) {
+			$s =~ s/[\r\n]+/\n/g;
+			$s =~ s/^\n+//;
+			chomp $s;
+			$s =~ s#^#$path#gm;
+			print STDOUT "$s\n";
+		}
+		if (my $s = $props->{'svn:global-ignores'}) {
+			$s =~ s/[\r\n]+/\n/g;
+			$s =~ s/^\n+//;
+			chomp $s;
+			$s =~ s#^#$path**/#gm;
+			print STDOUT "$s\n";
+		}
 	});
 }
 
@@ -1315,16 +1323,25 @@ sub cmd_create_ignore {
 		# which git won't track
 		mkpath([$path]) unless -d $path;
 		my $ignore = $path . '.gitignore';
-		my $s = $props->{'svn:ignore'} or return;
 		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.
-		$s =~ s#^#/#gm;
-		print GITIGNORE "$s\n";
+		if (my $s = $props->{'svn:ignore'}) {
+			$s =~ s/[\r\n]+/\n/g;
+			$s =~ s/^\n+//;
+			chomp $s;
+			# Prefix all patterns so that the ignore doesn't apply
+			# to sub-directories.
+			$s =~ s#^#/#gm;
+			print GITIGNORE "$s\n";
+		}
+		if (my $s = $props->{'svn:global-ignores'}) {
+			$s =~ s/[\r\n]+/\n/g;
+			$s =~ s/^\n+//;
+			chomp $s;
+			# Global ignores apply to sub-directories, so they are
+			# not prefixed.
+			print GITIGNORE "$s\n";
+		}
 		close(GITIGNORE)
 		  or fatal("Failed to close `$ignore': $!");
 		command_noisy('add', '-f', $ignore);
-- 
gitgitgadget


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v3 3/3] git-svn: mention `svn:globalignores` in help
  2024-08-12 16:58   ` [PATCH v3 0/3] git-svn: use svn:global-ignores when creating .gitignores Alex Galvin via GitGitGadget
  2024-08-12 16:58     ` [PATCH v3 1/3] git-svn: add public property `svn:global-ignores` Alex Galvin via GitGitGadget
  2024-08-12 16:58     ` [PATCH v3 2/3] git-svn: use `svn:global-ignores` to create .gitignore Alex Galvin via GitGitGadget
@ 2024-08-12 16:58     ` Alex Galvin via GitGitGadget
  2024-08-12 20:39     ` [PATCH v3 0/3] git-svn: use svn:global-ignores when creating .gitignores Junio C Hamano
  3 siblings, 0 replies; 13+ messages in thread
From: Alex Galvin via GitGitGadget @ 2024-08-12 16:58 UTC (permalink / raw)
  To: git; +Cc: Alex Galvin, Alex Galvin

From: Alex Galvin <alex.v.galvin@gmail.com>

Signed-off-by: Alex Galvin <alex.v.galvin@gmail.com>
---
 git-svn.perl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index a2a46608c9b..b824011154b 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -219,7 +219,7 @@ my %cmd = (
 	                "Set an SVN repository to a git tree-ish",
 			{ 'stdin' => \$_stdin, %cmt_opts, %fc_opts, } ],
 	'create-ignore' => [ \&cmd_create_ignore,
-			     'Create a .gitignore per svn:ignore',
+			     'Create a .gitignore per svn:ignore and svn:globalignores',
 			     { 'revision|r=i' => \$_revision
 			     } ],
 	'mkdirs' => [ \&cmd_mkdirs ,
@@ -234,7 +234,7 @@ my %cmd = (
         'proplist' => [ \&cmd_proplist,
 		       'List all properties of a file or directory',
 		       { 'revision|r=i' => \$_revision } ],
-	'show-ignore' => [ \&cmd_show_ignore, "Show svn:ignore listings",
+	'show-ignore' => [ \&cmd_show_ignore, "Show svn:ignore and svn:globalignores listings",
 			{ 'revision|r=i' => \$_revision
 			} ],
 	'show-externals' => [ \&cmd_show_externals, "Show svn:externals listings",
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 0/3] git-svn: use svn:global-ignores when creating .gitignores
  2024-08-12 16:58   ` [PATCH v3 0/3] git-svn: use svn:global-ignores when creating .gitignores Alex Galvin via GitGitGadget
                       ` (2 preceding siblings ...)
  2024-08-12 16:58     ` [PATCH v3 3/3] git-svn: mention `svn:globalignores` in help Alex Galvin via GitGitGadget
@ 2024-08-12 20:39     ` Junio C Hamano
  3 siblings, 0 replies; 13+ messages in thread
From: Junio C Hamano @ 2024-08-12 20:39 UTC (permalink / raw)
  To: Alex Galvin via GitGitGadget; +Cc: git, Alex Galvin

"Alex Galvin via GitGitGadget" <gitgitgadget@gmail.com> writes:

> Git-SVN does not currently use the svn:global-ignores property added in
> Subversion 1.8 when showing or creating .gitignore files. This causes
> Git-SVN to track files that are ignored by this directive in Subversion.

THe v2 iteration of the topic has already been merged to 'next' last
week, and I was hoping we were done.  Can you make it an incremental 
update on top of d7969a5127, which was the previous round?

Thanks.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-08-12 20:39 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-17 19:57 [PATCH 0/2] git-svn: use svn:global-ignores when creating .gitignores Alex Galvin via GitGitGadget
2024-07-17 19:57 ` [PATCH 1/2] git-svn: add public property `svn:global-ignores` Alex Galvin via GitGitGadget
2024-07-17 19:57 ` [PATCH 2/2] git-svn: use `svn:global-ignores` to create .gitignore Alex Galvin via GitGitGadget
2024-07-17 20:45 ` [PATCH 0/2] git-svn: use svn:global-ignores when creating .gitignores Junio C Hamano
2024-07-18 19:59   ` Alex Galvin
2024-07-18 20:47 ` [PATCH v2 " Alex Galvin via GitGitGadget
2024-07-18 20:47   ` [PATCH v2 1/2] git-svn: add public property `svn:global-ignores` Alex Galvin via GitGitGadget
2024-07-18 20:47   ` [PATCH v2 2/2] git-svn: use `svn:global-ignores` to create .gitignore Alex Galvin via GitGitGadget
2024-08-12 16:58   ` [PATCH v3 0/3] git-svn: use svn:global-ignores when creating .gitignores Alex Galvin via GitGitGadget
2024-08-12 16:58     ` [PATCH v3 1/3] git-svn: add public property `svn:global-ignores` Alex Galvin via GitGitGadget
2024-08-12 16:58     ` [PATCH v3 2/3] git-svn: use `svn:global-ignores` to create .gitignore Alex Galvin via GitGitGadget
2024-08-12 16:58     ` [PATCH v3 3/3] git-svn: mention `svn:globalignores` in help Alex Galvin via GitGitGadget
2024-08-12 20:39     ` [PATCH v3 0/3] git-svn: use svn:global-ignores when creating .gitignores Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).