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
1314af8d
Commit
1314af8d
authored
Aug 26, 2014
by
nulltoken
Committed by
Carlos Martín Nieto
Nov 12, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Failing test for case sensitive conflicts in the index
parent
1c34b717
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
91 additions
and
0 deletions
+91
-0
tests/index/conflicts.c
+91
-0
No files found.
tests/index/conflicts.c
View file @
1314af8d
...
@@ -342,3 +342,94 @@ void test_index_conflicts__partial(void)
...
@@ -342,3 +342,94 @@ void test_index_conflicts__partial(void)
cl_assert
(
conflict_entry
[
1
]
==
NULL
);
cl_assert
(
conflict_entry
[
1
]
==
NULL
);
cl_assert
(
conflict_entry
[
2
]
==
NULL
);
cl_assert
(
conflict_entry
[
2
]
==
NULL
);
}
}
void
test_index_conflicts__case_matters
(
void
)
{
const
git_index_entry
*
conflict_entry
[
3
];
git_oid
oid
;
const
char
*
upper_case
=
"DIFFERS-IN-CASE.TXT"
;
const
char
*
mixed_case
=
"Differs-In-Case.txt"
;
const
char
*
correct_case
;
bool
ignorecase
=
cl_repo_get_bool
(
repo
,
"core.ignorecase"
);
git_index_entry
ancestor_entry
,
our_entry
,
their_entry
;
memset
(
&
ancestor_entry
,
0x0
,
sizeof
(
git_index_entry
));
memset
(
&
our_entry
,
0x0
,
sizeof
(
git_index_entry
));
memset
(
&
their_entry
,
0x0
,
sizeof
(
git_index_entry
));
ancestor_entry
.
path
=
upper_case
;
GIT_IDXENTRY_STAGE_SET
(
&
ancestor_entry
,
GIT_INDEX_STAGE_ANCESTOR
);
git_oid_fromstr
(
&
ancestor_entry
.
id
,
CONFLICTS_ONE_ANCESTOR_OID
);
ancestor_entry
.
mode
=
GIT_FILEMODE_BLOB
;
our_entry
.
path
=
upper_case
;
GIT_IDXENTRY_STAGE_SET
(
&
our_entry
,
GIT_INDEX_STAGE_OURS
);
git_oid_fromstr
(
&
our_entry
.
id
,
CONFLICTS_ONE_OUR_OID
);
our_entry
.
mode
=
GIT_FILEMODE_BLOB
;
their_entry
.
path
=
upper_case
;
GIT_IDXENTRY_STAGE_SET
(
&
their_entry
,
GIT_INDEX_STAGE_THEIRS
);
git_oid_fromstr
(
&
their_entry
.
id
,
CONFLICTS_ONE_THEIR_OID
);
their_entry
.
mode
=
GIT_FILEMODE_BLOB
;
cl_git_pass
(
git_index_conflict_add
(
repo_index
,
&
ancestor_entry
,
&
our_entry
,
&
their_entry
));
ancestor_entry
.
path
=
mixed_case
;
GIT_IDXENTRY_STAGE_SET
(
&
ancestor_entry
,
GIT_INDEX_STAGE_ANCESTOR
);
git_oid_fromstr
(
&
ancestor_entry
.
id
,
CONFLICTS_TWO_ANCESTOR_OID
);
ancestor_entry
.
mode
=
GIT_FILEMODE_BLOB
;
our_entry
.
path
=
mixed_case
;
GIT_IDXENTRY_STAGE_SET
(
&
ancestor_entry
,
GIT_INDEX_STAGE_ANCESTOR
);
git_oid_fromstr
(
&
our_entry
.
id
,
CONFLICTS_TWO_OUR_OID
);
ancestor_entry
.
mode
=
GIT_FILEMODE_BLOB
;
their_entry
.
path
=
mixed_case
;
GIT_IDXENTRY_STAGE_SET
(
&
their_entry
,
GIT_INDEX_STAGE_THEIRS
);
git_oid_fromstr
(
&
their_entry
.
id
,
CONFLICTS_TWO_THEIR_OID
);
their_entry
.
mode
=
GIT_FILEMODE_BLOB
;
cl_git_pass
(
git_index_conflict_add
(
repo_index
,
&
ancestor_entry
,
&
our_entry
,
&
their_entry
));
cl_git_pass
(
git_index_conflict_get
(
&
conflict_entry
[
0
],
&
conflict_entry
[
1
],
&
conflict_entry
[
2
],
repo_index
,
upper_case
));
/*
* We inserted with mixed case last, so on a case-insensitive
* fs we should get the mixed case.
*/
if
(
ignorecase
)
correct_case
=
mixed_case
;
else
correct_case
=
upper_case
;
cl_assert_equal_s
(
correct_case
,
conflict_entry
[
0
]
->
path
);
git_oid_fromstr
(
&
oid
,
ignorecase
?
CONFLICTS_TWO_ANCESTOR_OID
:
CONFLICTS_ONE_ANCESTOR_OID
);
cl_assert_equal_oid
(
&
oid
,
&
conflict_entry
[
0
]
->
id
);
cl_assert_equal_s
(
correct_case
,
conflict_entry
[
1
]
->
path
);
git_oid_fromstr
(
&
oid
,
ignorecase
?
CONFLICTS_TWO_OUR_OID
:
CONFLICTS_ONE_OUR_OID
);
cl_assert_equal_oid
(
&
oid
,
&
conflict_entry
[
1
]
->
id
);
cl_assert_equal_s
(
correct_case
,
conflict_entry
[
2
]
->
path
);
git_oid_fromstr
(
&
oid
,
ignorecase
?
CONFLICTS_TWO_THEIR_OID
:
CONFLICTS_ONE_THEIR_OID
);
cl_assert_equal_oid
(
&
oid
,
&
conflict_entry
[
2
]
->
id
);
cl_git_pass
(
git_index_conflict_get
(
&
conflict_entry
[
0
],
&
conflict_entry
[
1
],
&
conflict_entry
[
2
],
repo_index
,
mixed_case
));
cl_assert_equal_s
(
mixed_case
,
conflict_entry
[
0
]
->
path
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_TWO_ANCESTOR_OID
);
cl_assert_equal_oid
(
&
oid
,
&
conflict_entry
[
0
]
->
id
);
cl_assert_equal_s
(
mixed_case
,
conflict_entry
[
1
]
->
path
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_TWO_OUR_OID
);
cl_assert_equal_oid
(
&
oid
,
&
conflict_entry
[
1
]
->
id
);
cl_assert_equal_s
(
mixed_case
,
conflict_entry
[
2
]
->
path
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_TWO_THEIR_OID
);
cl_assert_equal_oid
(
&
oid
,
&
conflict_entry
[
2
]
->
id
);
}
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