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
49837fd4
Commit
49837fd4
authored
May 30, 2014
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ignore core.safecrlf=warn until we have a warn infrastructure
parent
58eea5eb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
1 deletions
+48
-1
src/config_cache.c
+7
-1
tests/filter/crlf.c
+41
-0
No files found.
src/config_cache.c
View file @
49837fd4
...
@@ -51,6 +51,12 @@ static git_cvar_map _cvar_map_autocrlf[] = {
...
@@ -51,6 +51,12 @@ static git_cvar_map _cvar_map_autocrlf[] = {
{
GIT_CVAR_STRING
,
"input"
,
GIT_AUTO_CRLF_INPUT
}
{
GIT_CVAR_STRING
,
"input"
,
GIT_AUTO_CRLF_INPUT
}
};
};
static
git_cvar_map
_cvar_map_safecrlf
[]
=
{
{
GIT_CVAR_FALSE
,
NULL
,
GIT_SAFE_CRLF_FALSE
},
{
GIT_CVAR_TRUE
,
NULL
,
GIT_SAFE_CRLF_FAIL
},
{
GIT_CVAR_STRING
,
"warn"
,
GIT_SAFE_CRLF_WARN
}
};
/*
/*
* Generic map for integer values
* Generic map for integer values
*/
*/
...
@@ -68,7 +74,7 @@ static struct map_data _cvar_maps[] = {
...
@@ -68,7 +74,7 @@ static struct map_data _cvar_maps[] = {
{
"core.trustctime"
,
NULL
,
0
,
GIT_TRUSTCTIME_DEFAULT
},
{
"core.trustctime"
,
NULL
,
0
,
GIT_TRUSTCTIME_DEFAULT
},
{
"core.abbrev"
,
_cvar_map_int
,
1
,
GIT_ABBREV_DEFAULT
},
{
"core.abbrev"
,
_cvar_map_int
,
1
,
GIT_ABBREV_DEFAULT
},
{
"core.precomposeunicode"
,
NULL
,
0
,
GIT_PRECOMPOSE_DEFAULT
},
{
"core.precomposeunicode"
,
NULL
,
0
,
GIT_PRECOMPOSE_DEFAULT
},
{
"core.safecrlf"
,
NULL
,
0
,
GIT_SAFE_CRLF_DEFAULT
},
{
"core.safecrlf"
,
_cvar_map_safecrlf
,
ARRAY_SIZE
(
_cvar_map_safecrlf
)
,
GIT_SAFE_CRLF_DEFAULT
},
{
"core.logallrefupdates"
,
NULL
,
0
,
GIT_LOGALLREFUPDATES_DEFAULT
},
{
"core.logallrefupdates"
,
NULL
,
0
,
GIT_LOGALLREFUPDATES_DEFAULT
},
};
};
...
...
tests/filter/crlf.c
View file @
49837fd4
...
@@ -196,3 +196,44 @@ void test_filter_crlf__no_safecrlf(void)
...
@@ -196,3 +196,44 @@ void test_filter_crlf__no_safecrlf(void)
git_buf_free
(
&
out
);
git_buf_free
(
&
out
);
}
}
void
test_filter_crlf__safecrlf_warn
(
void
)
{
git_filter_list
*
fl
;
git_filter
*
crlf
;
git_buf
in
=
{
0
},
out
=
GIT_BUF_INIT
;
cl_repo_set_string
(
g_repo
,
"core.safecrlf"
,
"warn"
);
cl_git_pass
(
git_filter_list_new
(
&
fl
,
g_repo
,
GIT_FILTER_TO_ODB
,
0
));
crlf
=
git_filter_lookup
(
GIT_FILTER_CRLF
);
cl_assert
(
crlf
!=
NULL
);
cl_git_pass
(
git_filter_list_push
(
fl
,
crlf
,
NULL
));
/* Normalized \r\n succeeds with safecrlf=warn */
in
.
ptr
=
"Normal
\r\n
CRLF
\r\n
line-endings.
\r\n
"
;
in
.
size
=
strlen
(
in
.
ptr
);
cl_git_pass
(
git_filter_list_apply_to_data
(
&
out
,
fl
,
&
in
));
cl_assert_equal_s
(
"Normal
\n
CRLF
\n
line-endings.
\n
"
,
out
.
ptr
);
/* Mix of line endings succeeds with safecrlf=warn */
in
.
ptr
=
"Mixed
\n
up
\r\n
LF
\n
and
\r\n
CRLF
\n
line-endings.
\r\n
"
;
in
.
size
=
strlen
(
in
.
ptr
);
cl_git_pass
(
git_filter_list_apply_to_data
(
&
out
,
fl
,
&
in
));
/* TODO: check for warning */
cl_assert_equal_s
(
"Mixed
\n
up
\n
LF
\n
and
\n
CRLF
\n
line-endings.
\n
"
,
out
.
ptr
);
/* Normalized \n is reversible, so does not fail with safecrlf=warn */
in
.
ptr
=
"Normal
\n
LF
\n
only
\n
line-endings.
\n
"
;
in
.
size
=
strlen
(
in
.
ptr
);
cl_git_pass
(
git_filter_list_apply_to_data
(
&
out
,
fl
,
&
in
));
cl_assert_equal_s
(
in
.
ptr
,
out
.
ptr
);
git_filter_list_free
(
fl
);
git_buf_free
(
&
out
);
}
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