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
005c740b
Commit
005c740b
authored
Sep 20, 2021
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32: ensure content filtering occurs in longpath test
parent
482e3853
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
4 deletions
+23
-4
tests/win32/longpath.c
+23
-4
No files found.
tests/win32/longpath.c
View file @
005c740b
...
...
@@ -65,14 +65,16 @@ void test_win32_longpath__workdir_path_validated(void)
}
#ifdef GIT_WIN32
static
void
assert_longpath_status_and_add
(
git_repository
*
repo
)
{
static
void
assert_longpath_status_and_add
(
git_repository
*
repo
,
const
char
*
wddata
,
const
char
*
repodata
)
{
git_index
*
index
;
git_blob
*
blob
;
git_buf
out
=
GIT_BUF_INIT
;
const
git_index_entry
*
entry
;
unsigned
int
status_flags
;
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_rewritefile
(
out
.
ptr
,
wddata
);
cl_git_pass
(
git_status_file
(
&
status_flags
,
repo
,
LONG_FILENAME
));
cl_assert_equal_i
(
GIT_STATUS_WT_NEW
,
status_flags
);
...
...
@@ -83,6 +85,11 @@ static void assert_longpath_status_and_add(git_repository* repo) {
cl_git_pass
(
git_status_file
(
&
status_flags
,
repo
,
LONG_FILENAME
));
cl_assert_equal_i
(
GIT_STATUS_INDEX_NEW
,
status_flags
);
cl_assert
((
entry
=
git_index_get_bypath
(
index
,
LONG_FILENAME
,
0
))
!=
NULL
);
cl_git_pass
(
git_blob_lookup
(
&
blob
,
repo
,
&
entry
->
id
));
cl_assert_equal_s
(
repodata
,
git_blob_rawcontent
(
blob
));
git_blob_free
(
blob
);
git_index_free
(
index
);
git_buf_dispose
(
&
out
);
}
...
...
@@ -95,7 +102,13 @@ void test_win32_longpath__status_and_add(void)
cl_repo_set_bool
(
repo
,
"core.longpaths"
,
true
);
assert_longpath_status_and_add
(
repo
);
/*
* Doing no content filtering, we expect the data we add
* to be the data in the repository.
*/
assert_longpath_status_and_add
(
repo
,
"This is a long path.
\r\n
"
,
"This is a long path.
\r\n
"
);
#endif
}
...
...
@@ -107,6 +120,12 @@ void test_win32_longpath__status_and_add_with_filter(void)
cl_repo_set_bool
(
repo
,
"core.longpaths"
,
true
);
cl_repo_set_bool
(
repo
,
"core.autocrlf"
,
true
);
assert_longpath_status_and_add
(
repo
);
/*
* With `core.autocrlf`, we expect the data we add to have
* newline conversion performed.
*/
assert_longpath_status_and_add
(
repo
,
"This is a long path.
\r\n
"
,
"This is a long path.
\n
"
);
#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