Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
80b4536b
Commit
80b4536b
authored
Sep 22, 2015
by
Edward Thomson
Committed by
Carlos Martín Nieto
Nov 04, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32: propogate filename too long errors
parent
1ffa0739
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
8 deletions
+15
-8
src/win32/path_w32.c
+15
-8
No files found.
src/win32/path_w32.c
View file @
80b4536b
...
@@ -198,13 +198,13 @@ int git_win32_path_from_utf8(git_win32_path out, const char *src)
...
@@ -198,13 +198,13 @@ int git_win32_path_from_utf8(git_win32_path out, const char *src)
/* See if this is an absolute path (beginning with a drive letter) */
/* See if this is an absolute path (beginning with a drive letter) */
if
(
path__is_absolute
(
src
))
{
if
(
path__is_absolute
(
src
))
{
if
(
git__utf8_to_16
(
dest
,
MAX_PATH
,
src
)
<
0
)
if
(
git__utf8_to_16
(
dest
,
MAX_PATH
,
src
)
<
0
)
return
-
1
;
goto
on_error
;
}
}
/* File-prefixed NT-style paths beginning with \\?\ */
/* File-prefixed NT-style paths beginning with \\?\ */
else
if
(
path__is_nt_namespace
(
src
))
{
else
if
(
path__is_nt_namespace
(
src
))
{
/* Skip the NT prefix, the destination already contains it */
/* Skip the NT prefix, the destination already contains it */
if
(
git__utf8_to_16
(
dest
,
MAX_PATH
,
src
+
PATH__NT_NAMESPACE_LEN
)
<
0
)
if
(
git__utf8_to_16
(
dest
,
MAX_PATH
,
src
+
PATH__NT_NAMESPACE_LEN
)
<
0
)
return
-
1
;
goto
on_error
;
}
}
/* UNC paths */
/* UNC paths */
else
if
(
path__is_unc
(
src
))
{
else
if
(
path__is_unc
(
src
))
{
...
@@ -213,36 +213,43 @@ int git_win32_path_from_utf8(git_win32_path out, const char *src)
...
@@ -213,36 +213,43 @@ int git_win32_path_from_utf8(git_win32_path out, const char *src)
/* Skip the leading "\\" */
/* Skip the leading "\\" */
if
(
git__utf8_to_16
(
dest
,
MAX_PATH
-
2
,
src
+
2
)
<
0
)
if
(
git__utf8_to_16
(
dest
,
MAX_PATH
-
2
,
src
+
2
)
<
0
)
return
-
1
;
goto
on_error
;
}
}
/* Absolute paths omitting the drive letter */
/* Absolute paths omitting the drive letter */
else
if
(
src
[
0
]
==
'\\'
||
src
[
0
]
==
'/'
)
{
else
if
(
src
[
0
]
==
'\\'
||
src
[
0
]
==
'/'
)
{
if
(
path__cwd
(
dest
,
MAX_PATH
)
<
0
)
if
(
path__cwd
(
dest
,
MAX_PATH
)
<
0
)
return
-
1
;
goto
on_error
;
if
(
!
path__is_absolute
(
dest
))
{
if
(
!
path__is_absolute
(
dest
))
{
errno
=
ENOENT
;
errno
=
ENOENT
;
return
-
1
;
goto
on_error
;
}
}
/* Skip the drive letter specification ("C:") */
/* Skip the drive letter specification ("C:") */
if
(
git__utf8_to_16
(
dest
+
2
,
MAX_PATH
-
2
,
src
)
<
0
)
if
(
git__utf8_to_16
(
dest
+
2
,
MAX_PATH
-
2
,
src
)
<
0
)
return
-
1
;
goto
on_error
;
}
}
/* Relative paths */
/* Relative paths */
else
{
else
{
int
cwd_len
;
int
cwd_len
;
if
((
cwd_len
=
git_win32_path__cwd
(
dest
,
MAX_PATH
))
<
0
)
if
((
cwd_len
=
git_win32_path__cwd
(
dest
,
MAX_PATH
))
<
0
)
return
-
1
;
goto
on_error
;
dest
[
cwd_len
++
]
=
L'\\'
;
dest
[
cwd_len
++
]
=
L'\\'
;
if
(
git__utf8_to_16
(
dest
+
cwd_len
,
MAX_PATH
-
cwd_len
,
src
)
<
0
)
if
(
git__utf8_to_16
(
dest
+
cwd_len
,
MAX_PATH
-
cwd_len
,
src
)
<
0
)
return
-
1
;
goto
on_error
;
}
}
return
git_win32_path_canonicalize
(
out
);
return
git_win32_path_canonicalize
(
out
);
on_error
:
/* set windows error code so we can use its error message */
if
(
errno
==
ENAMETOOLONG
)
SetLastError
(
ERROR_FILENAME_EXCED_RANGE
);
return
-
1
;
}
}
int
git_win32_path_to_utf8
(
git_win32_utf8_path
dest
,
const
wchar_t
*
src
)
int
git_win32_path_to_utf8
(
git_win32_utf8_path
dest
,
const
wchar_t
*
src
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment