cygwin: allow pushing to UNC paths
cygwin can use an UNC path like //server/share/repo $ cd //server/share/dir $ mkdir test $ cd test $ git init --bare However, when we try to push from a local Git repository to this repo, there is a problem: Git converts the leading "//" into a single "/". As cygwin handles an UNC path so well, Git can support them better: - Introduce cygwin_offset_1st_component() which keeps the leading "//", similar to what Git for Windows does. - Move CYGWIN out of the POSIX in the tests for path normalization in t0060 Signed-off-by: Torsten Bögershausen <tboegi@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
8c8e978f57
commit
496f256989
|
@ -0,0 +1,19 @@
|
||||||
|
#include "../git-compat-util.h"
|
||||||
|
#include "../cache.h"
|
||||||
|
|
||||||
|
int cygwin_offset_1st_component(const char *path)
|
||||||
|
{
|
||||||
|
const char *pos = path;
|
||||||
|
/* unc paths */
|
||||||
|
if (is_dir_sep(pos[0]) && is_dir_sep(pos[1])) {
|
||||||
|
/* skip server name */
|
||||||
|
pos = strchr(pos + 2, '/');
|
||||||
|
if (!pos)
|
||||||
|
return 0; /* Error: malformed unc path */
|
||||||
|
|
||||||
|
do {
|
||||||
|
pos++;
|
||||||
|
} while (*pos && pos[0] != '/');
|
||||||
|
}
|
||||||
|
return pos + is_dir_sep(*pos) - path;
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
int cygwin_offset_1st_component(const char *path);
|
||||||
|
#define offset_1st_component cygwin_offset_1st_component
|
|
@ -181,6 +181,7 @@ ifeq ($(uname_O),Cygwin)
|
||||||
UNRELIABLE_FSTAT = UnfortunatelyYes
|
UNRELIABLE_FSTAT = UnfortunatelyYes
|
||||||
SPARSE_FLAGS = -isystem /usr/include/w32api -Wno-one-bit-signed-bitfield
|
SPARSE_FLAGS = -isystem /usr/include/w32api -Wno-one-bit-signed-bitfield
|
||||||
OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
|
OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
|
||||||
|
COMPAT_OBJS += compat/cygwin.o
|
||||||
endif
|
endif
|
||||||
ifeq ($(uname_S),FreeBSD)
|
ifeq ($(uname_S),FreeBSD)
|
||||||
NEEDS_LIBICONV = YesPlease
|
NEEDS_LIBICONV = YesPlease
|
||||||
|
|
|
@ -189,6 +189,9 @@
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__CYGWIN__)
|
||||||
|
#include "compat/cygwin.h"
|
||||||
|
#endif
|
||||||
#if defined(__MINGW32__)
|
#if defined(__MINGW32__)
|
||||||
/* pull in Windows compatibility stuff */
|
/* pull in Windows compatibility stuff */
|
||||||
#include "compat/mingw.h"
|
#include "compat/mingw.h"
|
||||||
|
|
|
@ -70,6 +70,8 @@ ancestor() {
|
||||||
case $(uname -s) in
|
case $(uname -s) in
|
||||||
*MINGW*)
|
*MINGW*)
|
||||||
;;
|
;;
|
||||||
|
*CYGWIN*)
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
test_set_prereq POSIX
|
test_set_prereq POSIX
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in New Issue