From 6ed5a4279665baad20f30017adb38c6fcec3c2d3 Mon Sep 17 00:00:00 2001
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Wed, 18 Feb 2015 11:07:17 +0000
Subject: [PATCH 43/N] fixup! Add functionality for converting UNIX paths in
 arguments and environment variables to Windows form for native Win32
 applications.

We do not perform tilde expansion in the MSys2 runtime; let's leave
paths containing '/~' intact for programs that want to expand such paths
themselves.

This addresses the expectations of the following test cases in the test
suite of https://github.com/git/git/tree/v2.43.0:

-t5500.163 fetch-pack --diag-url host:/~repo
-t5500.260 fetch-pack --diag-url host:/~re:po
-t5500.357 fetch-pack --diag-url host:/~re/po
-t5601.65 clone host:/~repo

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 winsup/cygwin/msys2_path_conv.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/winsup/cygwin/msys2_path_conv.cc b/winsup/cygwin/msys2_path_conv.cc
index 2646dc0..b292add 100644
--- a/winsup/cygwin/msys2_path_conv.cc
+++ b/winsup/cygwin/msys2_path_conv.cc
@@ -372,6 +372,10 @@ skip_p2w:
         case '[':
         case ']':
             goto skip_p2w;
+        case '/':
+            if (it + 1 < end && it[1] == '~')
+                goto skip_p2w;
+            break;
         }
         ++it;
     }
