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
2f1080ea
Commit
2f1080ea
authored
May 19, 2015
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conflict tests: use GIT_IDXENTRY_STAGE_SET
parent
191e97a0
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
26 additions
and
26 deletions
+26
-26
tests/checkout/conflict.c
+1
-1
tests/checkout/index.c
+3
-3
tests/checkout/tree.c
+3
-3
tests/index/collision.c
+5
-5
tests/index/conflicts.c
+10
-10
tests/object/tree/duplicateentries.c
+3
-3
tests/reset/hard.c
+1
-1
No files found.
tests/checkout/conflict.c
View file @
2f1080ea
...
@@ -102,7 +102,7 @@ static void create_index(struct checkout_index_entry *entries, size_t entries_le
...
@@ -102,7 +102,7 @@ static void create_index(struct checkout_index_entry *entries, size_t entries_le
memset
(
&
entry
,
0x0
,
sizeof
(
git_index_entry
));
memset
(
&
entry
,
0x0
,
sizeof
(
git_index_entry
));
entry
.
mode
=
entries
[
i
].
mode
;
entry
.
mode
=
entries
[
i
].
mode
;
entry
.
flags
=
entries
[
i
].
stage
<<
GIT_IDXENTRY_STAGESHIFT
;
GIT_IDXENTRY_STAGE_SET
(
&
entry
,
entries
[
i
].
stage
)
;
git_oid_fromstr
(
&
entry
.
id
,
entries
[
i
].
oid_str
);
git_oid_fromstr
(
&
entry
.
id
,
entries
[
i
].
oid_str
);
entry
.
path
=
entries
[
i
].
path
;
entry
.
path
=
entries
[
i
].
path
;
...
...
tests/checkout/index.c
View file @
2f1080ea
...
@@ -685,15 +685,15 @@ static void add_conflict(git_index *index, const char *path)
...
@@ -685,15 +685,15 @@ static void add_conflict(git_index *index, const char *path)
entry
.
path
=
path
;
entry
.
path
=
path
;
git_oid_fromstr
(
&
entry
.
id
,
"d427e0b2e138501a3d15cc376077a3631e15bd46"
);
git_oid_fromstr
(
&
entry
.
id
,
"d427e0b2e138501a3d15cc376077a3631e15bd46"
);
entry
.
flags
=
(
1
<<
GIT_IDXENTRY_STAGESHIFT
);
GIT_IDXENTRY_STAGE_SET
(
&
entry
,
1
);
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
git_oid_fromstr
(
&
entry
.
id
,
"4e886e602529caa9ab11d71f86634bd1b6e0de10"
);
git_oid_fromstr
(
&
entry
.
id
,
"4e886e602529caa9ab11d71f86634bd1b6e0de10"
);
entry
.
flags
=
(
2
<<
GIT_IDXENTRY_STAGESHIFT
);
GIT_IDXENTRY_STAGE_SET
(
&
entry
,
2
);
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
git_oid_fromstr
(
&
entry
.
id
,
"2bd0a343aeef7a2cf0d158478966a6e587ff3863"
);
git_oid_fromstr
(
&
entry
.
id
,
"2bd0a343aeef7a2cf0d158478966a6e587ff3863"
);
entry
.
flags
=
(
3
<<
GIT_IDXENTRY_STAGESHIFT
);
GIT_IDXENTRY_STAGE_SET
(
&
entry
,
3
);
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
}
}
...
...
tests/checkout/tree.c
View file @
2f1080ea
...
@@ -893,16 +893,16 @@ static void create_conflict(const char *path)
...
@@ -893,16 +893,16 @@ static void create_conflict(const char *path)
memset
(
&
entry
,
0x0
,
sizeof
(
git_index_entry
));
memset
(
&
entry
,
0x0
,
sizeof
(
git_index_entry
));
entry
.
mode
=
0100644
;
entry
.
mode
=
0100644
;
entry
.
flags
=
1
<<
GIT_IDXENTRY_STAGESHIFT
;
GIT_IDXENTRY_STAGE_SET
(
&
entry
,
1
)
;
git_oid_fromstr
(
&
entry
.
id
,
"d427e0b2e138501a3d15cc376077a3631e15bd46"
);
git_oid_fromstr
(
&
entry
.
id
,
"d427e0b2e138501a3d15cc376077a3631e15bd46"
);
entry
.
path
=
path
;
entry
.
path
=
path
;
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
entry
.
flags
=
2
<<
GIT_IDXENTRY_STAGESHIFT
;
GIT_IDXENTRY_STAGE_SET
(
&
entry
,
2
)
;
git_oid_fromstr
(
&
entry
.
id
,
"ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf"
);
git_oid_fromstr
(
&
entry
.
id
,
"ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf"
);
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
entry
.
flags
=
3
<<
GIT_IDXENTRY_STAGESHIFT
;
GIT_IDXENTRY_STAGE_SET
(
&
entry
,
3
)
;
git_oid_fromstr
(
&
entry
.
id
,
"2bd0a343aeef7a2cf0d158478966a6e587ff3863"
);
git_oid_fromstr
(
&
entry
.
id
,
"2bd0a343aeef7a2cf0d158478966a6e587ff3863"
);
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
...
...
tests/index/collision.c
View file @
2f1080ea
...
@@ -57,7 +57,7 @@ void test_index_collision__add_with_highstage_1(void)
...
@@ -57,7 +57,7 @@ void test_index_collision__add_with_highstage_1(void)
git_oid_fromstr
(
&
entry
.
id
,
"e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"
);
git_oid_fromstr
(
&
entry
.
id
,
"e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"
);
entry
.
path
=
"a/b"
;
entry
.
path
=
"a/b"
;
entry
.
flags
=
(
2
<<
GIT_IDXENTRY_STAGESHIFT
);
GIT_IDXENTRY_STAGE_SET
(
&
entry
,
2
);
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
/* create a blob beneath the previous tree entry */
/* create a blob beneath the previous tree entry */
...
@@ -67,7 +67,7 @@ void test_index_collision__add_with_highstage_1(void)
...
@@ -67,7 +67,7 @@ void test_index_collision__add_with_highstage_1(void)
/* create another tree entry above the blob */
/* create another tree entry above the blob */
entry
.
path
=
"a/b"
;
entry
.
path
=
"a/b"
;
entry
.
flags
=
(
1
<<
GIT_IDXENTRY_STAGESHIFT
);
GIT_IDXENTRY_STAGE_SET
(
&
entry
,
1
);
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
git_index_free
(
index
);
git_index_free
(
index
);
...
@@ -89,17 +89,17 @@ void test_index_collision__add_with_highstage_2(void)
...
@@ -89,17 +89,17 @@ void test_index_collision__add_with_highstage_2(void)
git_oid_fromstr
(
&
entry
.
id
,
"e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"
);
git_oid_fromstr
(
&
entry
.
id
,
"e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"
);
entry
.
path
=
"a/b/c"
;
entry
.
path
=
"a/b/c"
;
entry
.
flags
=
(
1
<<
GIT_IDXENTRY_STAGESHIFT
);
GIT_IDXENTRY_STAGE_SET
(
&
entry
,
1
);
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
/* create a blob beneath the previous tree entry */
/* create a blob beneath the previous tree entry */
entry
.
path
=
"a/b/c"
;
entry
.
path
=
"a/b/c"
;
entry
.
flags
=
(
2
<<
GIT_IDXENTRY_STAGESHIFT
);
GIT_IDXENTRY_STAGE_SET
(
&
entry
,
2
);
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
/* create another tree entry above the blob */
/* create another tree entry above the blob */
entry
.
path
=
"a/b"
;
entry
.
path
=
"a/b"
;
entry
.
flags
=
(
3
<<
GIT_IDXENTRY_STAGESHIFT
);
GIT_IDXENTRY_STAGE_SET
(
&
entry
,
3
);
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
git_index_free
(
index
);
git_index_free
(
index
);
...
...
tests/index/conflicts.c
View file @
2f1080ea
...
@@ -48,17 +48,17 @@ void test_index_conflicts__add(void)
...
@@ -48,17 +48,17 @@ void test_index_conflicts__add(void)
ancestor_entry
.
path
=
"test-one.txt"
;
ancestor_entry
.
path
=
"test-one.txt"
;
ancestor_entry
.
mode
=
0100644
;
ancestor_entry
.
mode
=
0100644
;
ancestor_entry
.
flags
|=
(
1
<<
GIT_IDXENTRY_STAGESHIFT
);
GIT_IDXENTRY_STAGE_SET
(
&
ancestor_entry
,
1
);
git_oid_fromstr
(
&
ancestor_entry
.
id
,
TEST_ANCESTOR_OID
);
git_oid_fromstr
(
&
ancestor_entry
.
id
,
TEST_ANCESTOR_OID
);
our_entry
.
path
=
"test-one.txt"
;
our_entry
.
path
=
"test-one.txt"
;
our_entry
.
mode
=
0100644
;
our_entry
.
mode
=
0100644
;
ancestor_entry
.
flags
|=
(
2
<<
GIT_IDXENTRY_STAGESHIFT
);
GIT_IDXENTRY_STAGE_SET
(
&
our_entry
,
2
);
git_oid_fromstr
(
&
our_entry
.
id
,
TEST_OUR_OID
);
git_oid_fromstr
(
&
our_entry
.
id
,
TEST_OUR_OID
);
their_entry
.
path
=
"test-one.txt"
;
their_entry
.
path
=
"test-one.txt"
;
their_entry
.
mode
=
0100644
;
their_entry
.
mode
=
0100644
;
ancestor_entry
.
flags
|=
(
3
<<
GIT_IDXENTRY_STAGESHIFT
);
GIT_IDXENTRY_STAGE_SET
(
&
ancestor_entry
,
2
);
git_oid_fromstr
(
&
their_entry
.
id
,
TEST_THEIR_OID
);
git_oid_fromstr
(
&
their_entry
.
id
,
TEST_THEIR_OID
);
cl_git_pass
(
git_index_conflict_add
(
repo_index
,
&
ancestor_entry
,
&
our_entry
,
&
their_entry
));
cl_git_pass
(
git_index_conflict_add
(
repo_index
,
&
ancestor_entry
,
&
our_entry
,
&
their_entry
));
...
@@ -79,17 +79,17 @@ void test_index_conflicts__add_fixes_incorrect_stage(void)
...
@@ -79,17 +79,17 @@ void test_index_conflicts__add_fixes_incorrect_stage(void)
ancestor_entry
.
path
=
"test-one.txt"
;
ancestor_entry
.
path
=
"test-one.txt"
;
ancestor_entry
.
mode
=
0100644
;
ancestor_entry
.
mode
=
0100644
;
ancestor_entry
.
flags
|=
(
3
<<
GIT_IDXENTRY_STAGESHIFT
);
GIT_IDXENTRY_STAGE_SET
(
&
ancestor_entry
,
3
);
git_oid_fromstr
(
&
ancestor_entry
.
id
,
TEST_ANCESTOR_OID
);
git_oid_fromstr
(
&
ancestor_entry
.
id
,
TEST_ANCESTOR_OID
);
our_entry
.
path
=
"test-one.txt"
;
our_entry
.
path
=
"test-one.txt"
;
our_entry
.
mode
=
0100644
;
our_entry
.
mode
=
0100644
;
ancestor_entry
.
flags
|=
(
1
<<
GIT_IDXENTRY_STAGESHIFT
);
GIT_IDXENTRY_STAGE_SET
(
&
our_entry
,
1
);
git_oid_fromstr
(
&
our_entry
.
id
,
TEST_OUR_OID
);
git_oid_fromstr
(
&
our_entry
.
id
,
TEST_OUR_OID
);
their_entry
.
path
=
"test-one.txt"
;
their_entry
.
path
=
"test-one.txt"
;
their_entry
.
mode
=
0100644
;
their_entry
.
mode
=
0100644
;
ancestor_entry
.
flags
|=
(
2
<<
GIT_IDXENTRY_STAGESHIFT
);
GIT_IDXENTRY_STAGE_SET
(
&
their_entry
,
2
);
git_oid_fromstr
(
&
their_entry
.
id
,
TEST_THEIR_OID
);
git_oid_fromstr
(
&
their_entry
.
id
,
TEST_THEIR_OID
);
cl_git_pass
(
git_index_conflict_add
(
repo_index
,
&
ancestor_entry
,
&
our_entry
,
&
their_entry
));
cl_git_pass
(
git_index_conflict_add
(
repo_index
,
&
ancestor_entry
,
&
our_entry
,
&
their_entry
));
...
@@ -123,17 +123,17 @@ void test_index_conflicts__add_removes_stage_zero(void)
...
@@ -123,17 +123,17 @@ void test_index_conflicts__add_removes_stage_zero(void)
ancestor_entry
.
path
=
"test-one.txt"
;
ancestor_entry
.
path
=
"test-one.txt"
;
ancestor_entry
.
mode
=
0100644
;
ancestor_entry
.
mode
=
0100644
;
ancestor_entry
.
flags
|=
(
3
<<
GIT_IDXENTRY_STAGESHIFT
);
GIT_IDXENTRY_STAGE_SET
(
&
ancestor_entry
,
3
);
git_oid_fromstr
(
&
ancestor_entry
.
id
,
TEST_ANCESTOR_OID
);
git_oid_fromstr
(
&
ancestor_entry
.
id
,
TEST_ANCESTOR_OID
);
our_entry
.
path
=
"test-one.txt"
;
our_entry
.
path
=
"test-one.txt"
;
our_entry
.
mode
=
0100644
;
our_entry
.
mode
=
0100644
;
our_entry
.
flags
|=
(
1
<<
GIT_IDXENTRY_STAGESHIFT
);
GIT_IDXENTRY_STAGE_SET
(
&
our_entry
,
1
);
git_oid_fromstr
(
&
our_entry
.
id
,
TEST_OUR_OID
);
git_oid_fromstr
(
&
our_entry
.
id
,
TEST_OUR_OID
);
their_entry
.
path
=
"test-one.txt"
;
their_entry
.
path
=
"test-one.txt"
;
their_entry
.
mode
=
0100644
;
their_entry
.
mode
=
0100644
;
their_entry
.
flags
|=
(
2
<<
GIT_IDXENTRY_STAGESHIFT
);
GIT_IDXENTRY_STAGE_SET
(
&
their_entry
,
2
);
git_oid_fromstr
(
&
their_entry
.
id
,
TEST_THEIR_OID
);
git_oid_fromstr
(
&
their_entry
.
id
,
TEST_THEIR_OID
);
cl_git_pass
(
git_index_conflict_add
(
repo_index
,
&
ancestor_entry
,
&
our_entry
,
&
their_entry
));
cl_git_pass
(
git_index_conflict_add
(
repo_index
,
&
ancestor_entry
,
&
our_entry
,
&
their_entry
));
...
@@ -329,7 +329,7 @@ void test_index_conflicts__partial(void)
...
@@ -329,7 +329,7 @@ void test_index_conflicts__partial(void)
ancestor_entry
.
path
=
"test-one.txt"
;
ancestor_entry
.
path
=
"test-one.txt"
;
ancestor_entry
.
mode
=
0100644
;
ancestor_entry
.
mode
=
0100644
;
ancestor_entry
.
flags
|=
(
1
<<
GIT_IDXENTRY_STAGESHIFT
);
GIT_IDXENTRY_STAGE_SET
(
&
ancestor_entry
,
1
);
git_oid_fromstr
(
&
ancestor_entry
.
id
,
TEST_ANCESTOR_OID
);
git_oid_fromstr
(
&
ancestor_entry
.
id
,
TEST_ANCESTOR_OID
);
cl_git_pass
(
git_index_conflict_add
(
repo_index
,
&
ancestor_entry
,
NULL
,
NULL
));
cl_git_pass
(
git_index_conflict_add
(
repo_index
,
&
ancestor_entry
,
NULL
,
NULL
));
...
...
tests/object/tree/duplicateentries.c
View file @
2f1080ea
...
@@ -126,17 +126,17 @@ static void add_fake_conflicts(git_index *index)
...
@@ -126,17 +126,17 @@ static void add_fake_conflicts(git_index *index)
ancestor_entry
.
path
=
"duplicate"
;
ancestor_entry
.
path
=
"duplicate"
;
ancestor_entry
.
mode
=
GIT_FILEMODE_BLOB
;
ancestor_entry
.
mode
=
GIT_FILEMODE_BLOB
;
ancestor_entry
.
flags
|=
(
1
<<
GIT_IDXENTRY_STAGESHIFT
);
GIT_IDXENTRY_STAGE_SET
(
&
ancestor_entry
,
1
);
git_oid_fromstr
(
&
ancestor_entry
.
id
,
"a8233120f6ad708f843d861ce2b7228ec4e3dec6"
);
git_oid_fromstr
(
&
ancestor_entry
.
id
,
"a8233120f6ad708f843d861ce2b7228ec4e3dec6"
);
our_entry
.
path
=
"duplicate"
;
our_entry
.
path
=
"duplicate"
;
our_entry
.
mode
=
GIT_FILEMODE_BLOB
;
our_entry
.
mode
=
GIT_FILEMODE_BLOB
;
ancestor_entry
.
flags
|=
(
2
<<
GIT_IDXENTRY_STAGESHIFT
);
GIT_IDXENTRY_STAGE_SET
(
&
our_entry
,
2
);
git_oid_fromstr
(
&
our_entry
.
id
,
"45b983be36b73c0788dc9cbcb76cbb80fc7bb057"
);
git_oid_fromstr
(
&
our_entry
.
id
,
"45b983be36b73c0788dc9cbcb76cbb80fc7bb057"
);
their_entry
.
path
=
"duplicate"
;
their_entry
.
path
=
"duplicate"
;
their_entry
.
mode
=
GIT_FILEMODE_BLOB
;
their_entry
.
mode
=
GIT_FILEMODE_BLOB
;
ancestor_entry
.
flags
|=
(
3
<<
GIT_IDXENTRY_STAGESHIFT
);
GIT_IDXENTRY_STAGE_SET
(
&
their_entry
,
3
);
git_oid_fromstr
(
&
their_entry
.
id
,
"a71586c1dfe8a71c6cbf6c129f404c5642ff31bd"
);
git_oid_fromstr
(
&
their_entry
.
id
,
"a71586c1dfe8a71c6cbf6c129f404c5642ff31bd"
);
cl_git_pass
(
git_index_conflict_add
(
index
,
&
ancestor_entry
,
&
our_entry
,
&
their_entry
));
cl_git_pass
(
git_index_conflict_add
(
index
,
&
ancestor_entry
,
&
our_entry
,
&
their_entry
));
...
...
tests/reset/hard.c
View file @
2f1080ea
...
@@ -108,7 +108,7 @@ static void index_entry_init(git_index *index, int side, git_oid *oid)
...
@@ -108,7 +108,7 @@ static void index_entry_init(git_index *index, int side, git_oid *oid)
memset
(
&
entry
,
0x0
,
sizeof
(
git_index_entry
));
memset
(
&
entry
,
0x0
,
sizeof
(
git_index_entry
));
entry
.
path
=
"conflicting_file"
;
entry
.
path
=
"conflicting_file"
;
entry
.
flags
=
(
side
<<
GIT_IDXENTRY_STAGESHIFT
);
GIT_IDXENTRY_STAGE_SET
(
&
entry
,
side
);
entry
.
mode
=
0100644
;
entry
.
mode
=
0100644
;
git_oid_cpy
(
&
entry
.
id
,
oid
);
git_oid_cpy
(
&
entry
.
id
,
oid
);
...
...
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