From c94cf814671d0c2891d9f82495c42608b39ef5bd 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 44/N] fixup! Add functionality for converting UNIX paths in
 arguments and environment variables to Windows form for native Win32
 applications.

This skips posix-to-windows conversion when '::' is seen: The substring
'::' most often found in an IPv6 address, never in a path (and only in
bogus path lists that contain empty elements).

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

-t0060.197 test_submodule_relative_url: (null) helper:://hostname/repo ../subrepo => helper:://hostname/subrepo
-t0060.198 test_submodule_relative_url: (null) helper:://hostname/repo ../../subrepo => helper:://subrepo
-t0060.199 test_submodule_relative_url: (null) helper:://hostname/repo ../../../subrepo => helper::/subrepo
-t0060.200 test_submodule_relative_url: (null) helper:://hostname/repo ../../../../subrepo => helper::subrepo
-t0060.201 test_submodule_relative_url: (null) helper:://hostname/repo ../../../../../subrepo => helper:subrepo
-t0060.202 test_submodule_relative_url: (null) helper:://hostname/repo ../../../../../../subrepo => .:subrepo
-t5801.2 cloning from local repo
-t5801.4 pulling from local repo
-t5801.5 pushing to local repo
-t5801.6 fetch new branch
-t5801.7 fetch multiple branches
-t5801.8 push when remote has extra refs
-t5801.9 push new branch by name
-t5801.10 push new branch with old:new refspec
-t5801.11 push new branch with HEAD:new refspec
-t5801.12 push delete branch
-t5801.13 forced push
-t5801.14 cloning without refspec
-t5801.15 pulling without refspecs
-t5801.16 pushing without refspecs
-t5801.17 pulling without marks
-t5801.19 push all with existing object
-t5801.20 push ref with existing object
-t5801.23 push update refs
-t5801.24 push update refs disabled by no-private-update
-t5801.25 push update refs failure
-t5801.26 proper failure checks for fetching
-t5801.27 proper failure checks for pushing
-t5801.28 push messages
-t5801.29 fetch HEAD
-t5801.30 fetch url
-t5801.31 fetch tag
-t7400.80 ../subrepo works with helper URL- helper:://hostname/repo

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

diff --git a/winsup/cygwin/msys2_path_conv.cc b/winsup/cygwin/msys2_path_conv.cc
index b292add..71c4735 100644
--- a/winsup/cygwin/msys2_path_conv.cc
+++ b/winsup/cygwin/msys2_path_conv.cc
@@ -376,6 +376,11 @@ skip_p2w:
             if (it + 1 < end && it[1] == '~')
                 goto skip_p2w;
             break;
+        case ':':
+            // Avoid mangling IPv6 addresses
+            if (it + 1 < end && it[1] == ':')
+                goto skip_p2w;
+            break;
         }
         ++it;
     }
