summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-06-25 09:40:10 -0700
committerRussell Belfer <rb@github.com>2013-06-25 09:40:10 -0700
commit22ef0c28571dcfe929491483ec32bc7fecd360a2 (patch)
tree6d9d34db89cf785e8ccad77c27f689218632c05f
parenteddc1f1ed78898a4ca41480045b1d0d5b075e773 (diff)
parent4753711235b817082460c2781749c27ef2d9bc78 (diff)
downloadlibgit2-22ef0c28571dcfe929491483ec32bc7fecd360a2.tar.gz
Merge pull request #1680 from csware/win32-junction
Correctly handle win32 junctions
-rw-r--r--src/fileops.c3
-rw-r--r--src/win32/posix_w32.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/fileops.c b/src/fileops.c
index d5f6acfad..1f58fa5cd 100644
--- a/src/fileops.c
+++ b/src/fileops.c
@@ -350,8 +350,7 @@ int git_futils_mkdir(
int tmp_errno = errno;
/* ignore error if directory already exists */
- if (p_stat(make_path.ptr, &st) < 0 ||
- !(S_ISDIR(st.st_mode) || S_ISLNK(st.st_mode))) {
+ if (p_stat(make_path.ptr, &st) < 0 || !S_ISDIR(st.st_mode)) {
errno = tmp_errno;
giterr_set(GITERR_OS, "Failed to make directory '%s'", make_path.ptr);
goto done;
diff --git a/src/win32/posix_w32.c b/src/win32/posix_w32.c
index f04974428..036632e2a 100644
--- a/src/win32/posix_w32.c
+++ b/src/win32/posix_w32.c
@@ -90,6 +90,9 @@ static int do_lstat(
if (fdata.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
fMode |= S_IFLNK;
+ if ((fMode & (S_IFDIR | S_IFLNK)) == (S_IFDIR | S_IFLNK)) // junction
+ fMode ^= S_IFLNK;
+
buf->st_ino = 0;
buf->st_gid = 0;
buf->st_uid = 0;