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
33667c14
Commit
33667c14
authored
May 05, 2021
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32: add file and get status on a long path
parent
f8921ab9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
1 deletions
+31
-1
tests/win32/longpath.c
+31
-1
No files found.
tests/win32/longpath.c
View file @
33667c14
...
@@ -8,6 +8,8 @@
...
@@ -8,6 +8,8 @@
static
git_buf
path
=
GIT_BUF_INIT
;
static
git_buf
path
=
GIT_BUF_INIT
;
#define LONG_FILENAME "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.txt"
void
test_win32_longpath__initialize
(
void
)
void
test_win32_longpath__initialize
(
void
)
{
{
#ifdef GIT_WIN32
#ifdef GIT_WIN32
...
@@ -52,11 +54,39 @@ void test_win32_longpath__workdir_path_validated(void)
...
@@ -52,11 +54,39 @@ void test_win32_longpath__workdir_path_validated(void)
cl_git_pass
(
git_repository_workdir_path
(
&
out
,
repo
,
"a.txt"
));
cl_git_pass
(
git_repository_workdir_path
(
&
out
,
repo
,
"a.txt"
));
/* even if the repo path is a drive letter, this is too long */
/* even if the repo path is a drive letter, this is too long */
cl_git_fail
(
git_repository_workdir_path
(
&
out
,
repo
,
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.txt"
));
cl_git_fail
(
git_repository_workdir_path
(
&
out
,
repo
,
LONG_FILENAME
));
cl_assert
(
git__prefixcmp
(
git_error_last
()
->
message
,
"path too long"
)
==
0
);
cl_assert
(
git__prefixcmp
(
git_error_last
()
->
message
,
"path too long"
)
==
0
);
cl_repo_set_bool
(
repo
,
"core.longpaths"
,
true
);
cl_repo_set_bool
(
repo
,
"core.longpaths"
,
true
);
cl_git_pass
(
git_repository_workdir_path
(
&
out
,
repo
,
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.txt"
));
cl_git_pass
(
git_repository_workdir_path
(
&
out
,
repo
,
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.txt"
));
cl_git_pass
(
git_repository_workdir_path
(
&
out
,
repo
,
LONG_FILENAME
));
git_buf_dispose
(
&
out
);
#endif
}
void
test_win32_longpath__status_and_add
(
void
)
{
#ifdef GIT_WIN32
git_repository
*
repo
=
cl_git_sandbox_init
(
"testrepo"
);
git_index
*
index
;
git_buf
out
=
GIT_BUF_INIT
;
unsigned
int
status_flags
;
cl_repo_set_bool
(
repo
,
"core.longpaths"
,
true
);
cl_git_pass
(
git_repository_workdir_path
(
&
out
,
repo
,
LONG_FILENAME
));
cl_git_rewritefile
(
out
.
ptr
,
"This is a long path.
\r\n
"
);
cl_git_pass
(
git_status_file
(
&
status_flags
,
repo
,
LONG_FILENAME
));
cl_assert_equal_i
(
GIT_STATUS_WT_NEW
,
status_flags
);
cl_git_pass
(
git_repository_index
(
&
index
,
repo
));
cl_git_pass
(
git_index_add_bypath
(
index
,
LONG_FILENAME
));
cl_git_pass
(
git_status_file
(
&
status_flags
,
repo
,
LONG_FILENAME
));
cl_assert_equal_i
(
GIT_STATUS_INDEX_NEW
,
status_flags
);
git_index_free
(
index
);
git_buf_dispose
(
&
out
);
git_buf_dispose
(
&
out
);
#endif
#endif
}
}
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