Merge branch 'pw/p4-various'
[gitweb.git] / git-svn.perl
index 570504cee760c678e52349a6967bba499bd629c0..427da9e7a1a10ad9949eaa0c97d7fd0aa3436c3e 100755 (executable)
 $| = 1; # unbuffer STDOUT
 
 sub fatal (@) { print STDERR "@_\n"; exit 1 }
+
+# All SVN commands do it.  Otherwise we may die on SIGPIPE when the remote
+# repository decides to close the connection which we expect to be kept alive.
+$SIG{PIPE} = 'IGNORE';
+
 sub _req_svn {
        require SVN::Core; # use()-ing this causes segfaults for me... *shrug*
        require SVN::Ra;
@@ -4065,7 +4070,7 @@ sub rev_map_set {
        if ($update_ref) {
                $sigmask = POSIX::SigSet->new();
                my $signew = POSIX::SigSet->new(SIGINT, SIGHUP, SIGTERM,
-                       SIGALRM, SIGPIPE, SIGUSR1, SIGUSR2);
+                       SIGALRM, SIGUSR1, SIGUSR2);
                sigprocmask(SIG_BLOCK, $signew, $sigmask) or
                        croak "Can't block signals: $!";
        }
@@ -5439,7 +5444,7 @@ BEGIN
 }
 
 sub _auth_providers () {
-       [
+       my @rv = (
          SVN::Client::get_simple_provider(),
          SVN::Client::get_ssl_server_trust_file_provider(),
          SVN::Client::get_simple_prompt_provider(
@@ -5455,7 +5460,23 @@ ()
            \&Git::SVN::Prompt::ssl_server_trust),
          SVN::Client::get_username_prompt_provider(
            \&Git::SVN::Prompt::username, 2)
-       ]
+       );
+
+       # earlier 1.6.x versions would segfault, and <= 1.5.x didn't have
+       # this function
+       if ($SVN::Core::VERSION gt '1.6.12') {
+               my $config = SVN::Core::config_get_config($config_dir);
+               my ($p, @a);
+               # config_get_config returns all config files from
+               # ~/.subversion, auth_get_platform_specific_client_providers
+               # just wants the config "file".
+               @a = ($config->{'config'}, undef);
+               $p = SVN::Core::auth_get_platform_specific_client_providers(@a);
+               # Insert the return value from
+               # auth_get_platform_specific_providers
+               unshift @rv, @$p;
+       }
+       \@rv;
 }
 
 sub escape_uri_only {