From 3ca0990da15ae8c9928b06d7e7f8bfb3a230981e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= <vcunat@gmail.com>
Date: Sun, 19 Mar 2017 10:42:13 +0100
Subject: [PATCH] fetchsvn: fixup name guessing after #23851

I can't see any unfixed differences due to that PR,
at least in nix-env -qa output for the four Hydra platforms.
---
 pkgs/build-support/fetchsvn/default.nix | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/pkgs/build-support/fetchsvn/default.nix b/pkgs/build-support/fetchsvn/default.nix
index 05ed0505f81c..747052c1cb70 100644
--- a/pkgs/build-support/fetchsvn/default.nix
+++ b/pkgs/build-support/fetchsvn/default.nix
@@ -8,7 +8,9 @@ let
       fst = head;
       snd = l: head (tail l);
       trd = l: head (tail (tail l));
-      path_ = reverseList (splitString "/" url);
+      path_ =
+        (p: if head p == "" then tail p else p) # ~ drop final slash if any
+        (reverseList (splitString "/" url));
       path = [ (removeSuffix "/" (head path_)) ] ++ (tail path_);
     in
       # ../repo/trunk -> repo
@@ -31,7 +33,7 @@ stdenv.mkDerivation {
   outputHashAlgo = if sha256 == "" then "md5" else "sha256";
   outputHashMode = "recursive";
   outputHash = if sha256 == "" then md5 else sha256;
-  
+
   inherit url rev sshSupport openssh ignoreExternals ignoreKeywords;
 
   impureEnvVars = stdenv.lib.fetchers.proxyImpureEnvVars;