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
d541170c
Commit
d541170c
authored
Jan 24, 2014
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
index: rename an entry's id to 'id'
This was not converted when we converted the rest, so do it now.
parent
d0a3de72
Hide whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
118 additions
and
118 deletions
+118
-118
examples/showindex.c
+1
-1
include/git2/index.h
+1
-1
src/attr.c
+2
-2
src/checkout.c
+7
-7
src/crlf.c
+1
-1
src/diff.c
+16
-16
src/index.c
+9
-9
src/iterator.c
+1
-1
src/merge.c
+13
-13
src/merge_file.c
+1
-1
src/notes.c
+1
-1
src/reset.c
+1
-1
src/submodule.c
+6
-6
src/tree.c
+1
-1
tests/attr/repo.c
+1
-1
tests/checkout/conflict.c
+1
-1
tests/checkout/crlf.c
+2
-2
tests/checkout/tree.c
+3
-3
tests/diff/iterator.c
+1
-1
tests/filter/custom.c
+2
-2
tests/index/conflicts.c
+20
-20
tests/index/rename.c
+2
-2
tests/index/tests.c
+4
-4
tests/merge/merge_helpers.c
+2
-2
tests/merge/trees/automerge.c
+1
-1
tests/merge/trees/commits.c
+1
-1
tests/merge/trees/trivial.c
+2
-2
tests/merge/workdir/simple.c
+1
-1
tests/merge/workdir/trivial.c
+2
-2
tests/object/commit/commitstagedfile.c
+1
-1
tests/object/tree/duplicateentries.c
+3
-3
tests/reset/default.c
+1
-1
tests/reset/hard.c
+1
-1
tests/status/worktree.c
+6
-6
No files found.
examples/showindex.c
View file @
d541170c
...
...
@@ -49,7 +49,7 @@ int main (int argc, char** argv)
for
(
i
=
0
;
i
<
ecount
;
++
i
)
{
const
git_index_entry
*
e
=
git_index_get_byindex
(
index
,
i
);
git_oid_fmt
(
out
,
&
e
->
o
id
);
git_oid_fmt
(
out
,
&
e
->
id
);
printf
(
"File Path: %s
\n
"
,
e
->
path
);
printf
(
" Stage: %d
\n
"
,
git_index_entry_stage
(
e
));
...
...
include/git2/index.h
View file @
d541170c
...
...
@@ -56,7 +56,7 @@ typedef struct git_index_entry {
unsigned
int
gid
;
git_off_t
file_size
;
git_oid
o
id
;
git_oid
id
;
unsigned
short
flags
;
unsigned
short
flags_extended
;
...
...
src/attr.c
View file @
d541170c
...
...
@@ -314,10 +314,10 @@ static int load_attr_blob_from_index(
entry
=
git_index_get_byindex
(
index
,
pos
);
if
(
old_oid
&&
git_oid__cmp
(
old_oid
,
&
entry
->
o
id
)
==
0
)
if
(
old_oid
&&
git_oid__cmp
(
old_oid
,
&
entry
->
id
)
==
0
)
return
GIT_ENOTFOUND
;
if
((
error
=
git_blob_lookup
(
blob
,
repo
,
&
entry
->
o
id
))
<
0
)
if
((
error
=
git_blob_lookup
(
blob
,
repo
,
&
entry
->
id
))
<
0
)
return
error
;
*
content
=
git_blob_rawcontent
(
*
blob
);
...
...
src/checkout.c
View file @
d541170c
...
...
@@ -92,7 +92,7 @@ static int checkout_notify(
if
(
wditem
)
{
memset
(
&
wdfile
,
0
,
sizeof
(
wdfile
));
git_oid_cpy
(
&
wdfile
.
oid
,
&
wditem
->
o
id
);
git_oid_cpy
(
&
wdfile
.
oid
,
&
wditem
->
id
);
wdfile
.
path
=
wditem
->
path
;
wdfile
.
size
=
wditem
->
file_size
;
wdfile
.
flags
=
GIT_DIFF_FLAG_VALID_OID
;
...
...
@@ -170,7 +170,7 @@ static bool checkout_is_workdir_modified(
if
(
wditem
->
mtime
.
seconds
==
ie
->
mtime
.
seconds
&&
wditem
->
mtime
.
nanoseconds
==
ie
->
mtime
.
nanoseconds
&&
wditem
->
file_size
==
ie
->
file_size
)
return
(
git_oid__cmp
(
&
baseitem
->
oid
,
&
ie
->
o
id
)
!=
0
);
return
(
git_oid__cmp
(
&
baseitem
->
oid
,
&
ie
->
id
)
!=
0
);
}
/* depending on where base is coming from, we may or may not know
...
...
@@ -700,21 +700,21 @@ GIT_INLINE(int) checkout_conflict_detect_binary(git_repository *repo, checkout_c
return
0
;
if
(
conflict
->
ancestor
)
{
if
((
error
=
git_blob_lookup
(
&
ancestor_blob
,
repo
,
&
conflict
->
ancestor
->
o
id
))
<
0
)
if
((
error
=
git_blob_lookup
(
&
ancestor_blob
,
repo
,
&
conflict
->
ancestor
->
id
))
<
0
)
goto
done
;
conflict
->
binary
=
git_blob_is_binary
(
ancestor_blob
);
}
if
(
!
conflict
->
binary
&&
conflict
->
ours
)
{
if
((
error
=
git_blob_lookup
(
&
our_blob
,
repo
,
&
conflict
->
ours
->
o
id
))
<
0
)
if
((
error
=
git_blob_lookup
(
&
our_blob
,
repo
,
&
conflict
->
ours
->
id
))
<
0
)
goto
done
;
conflict
->
binary
=
git_blob_is_binary
(
our_blob
);
}
if
(
!
conflict
->
binary
&&
conflict
->
theirs
)
{
if
((
error
=
git_blob_lookup
(
&
their_blob
,
repo
,
&
conflict
->
theirs
->
o
id
))
<
0
)
if
((
error
=
git_blob_lookup
(
&
their_blob
,
repo
,
&
conflict
->
theirs
->
id
))
<
0
)
goto
done
;
conflict
->
binary
=
git_blob_is_binary
(
their_blob
);
...
...
@@ -1221,7 +1221,7 @@ static int checkout_update_index(
memset
(
&
entry
,
0
,
sizeof
(
entry
));
entry
.
path
=
(
char
*
)
file
->
path
;
/* cast to prevent warning */
git_index_entry__init_from_stat
(
&
entry
,
st
,
true
);
git_oid_cpy
(
&
entry
.
o
id
,
&
file
->
oid
);
git_oid_cpy
(
&
entry
.
id
,
&
file
->
oid
);
return
git_index_add
(
data
->
index
,
&
entry
);
}
...
...
@@ -1631,7 +1631,7 @@ static int checkout_write_entry(
return
error
;
return
checkout_write_content
(
data
,
&
side
->
o
id
,
git_buf_cstr
(
&
data
->
path
),
hint_path
,
side
->
mode
,
&
st
);
&
side
->
id
,
git_buf_cstr
(
&
data
->
path
),
hint_path
,
side
->
mode
,
&
st
);
}
static
int
checkout_write_entries
(
...
...
src/crlf.c
View file @
d541170c
...
...
@@ -101,7 +101,7 @@ static int has_cr_in_index(const git_filter_source *src)
if
(
!
S_ISREG
(
entry
->
mode
))
/* don't crlf filter non-blobs */
return
true
;
if
(
git_blob_lookup
(
&
blob
,
repo
,
&
entry
->
o
id
)
<
0
)
if
(
git_blob_lookup
(
&
blob
,
repo
,
&
entry
->
id
)
<
0
)
return
false
;
blobcontent
=
git_blob_rawcontent
(
blob
);
...
...
src/diff.c
View file @
d541170c
...
...
@@ -110,11 +110,11 @@ static int diff_delta__from_one(
if
(
delta
->
status
==
GIT_DELTA_DELETED
)
{
delta
->
old_file
.
mode
=
entry
->
mode
;
delta
->
old_file
.
size
=
entry
->
file_size
;
git_oid_cpy
(
&
delta
->
old_file
.
oid
,
&
entry
->
o
id
);
git_oid_cpy
(
&
delta
->
old_file
.
oid
,
&
entry
->
id
);
}
else
/* ADDED, IGNORED, UNTRACKED */
{
delta
->
new_file
.
mode
=
entry
->
mode
;
delta
->
new_file
.
size
=
entry
->
file_size
;
git_oid_cpy
(
&
delta
->
new_file
.
oid
,
&
entry
->
o
id
);
git_oid_cpy
(
&
delta
->
new_file
.
oid
,
&
entry
->
id
);
}
delta
->
old_file
.
flags
|=
GIT_DIFF_FLAG_VALID_OID
;
...
...
@@ -156,12 +156,12 @@ static int diff_delta__from_two(
GITERR_CHECK_ALLOC
(
delta
);
delta
->
nfiles
=
2
;
git_oid_cpy
(
&
delta
->
old_file
.
oid
,
&
old_entry
->
o
id
);
git_oid_cpy
(
&
delta
->
old_file
.
oid
,
&
old_entry
->
id
);
delta
->
old_file
.
size
=
old_entry
->
file_size
;
delta
->
old_file
.
mode
=
old_mode
;
delta
->
old_file
.
flags
|=
GIT_DIFF_FLAG_VALID_OID
;
git_oid_cpy
(
&
delta
->
new_file
.
oid
,
&
new_entry
->
o
id
);
git_oid_cpy
(
&
delta
->
new_file
.
oid
,
&
new_entry
->
id
);
delta
->
new_file
.
size
=
new_entry
->
file_size
;
delta
->
new_file
.
mode
=
new_mode
;
...
...
@@ -172,7 +172,7 @@ static int diff_delta__from_two(
git_oid_cpy
(
&
delta
->
new_file
.
oid
,
new_oid
);
}
if
(
new_oid
||
!
git_oid_iszero
(
&
new_entry
->
o
id
))
if
(
new_oid
||
!
git_oid_iszero
(
&
new_entry
->
id
))
delta
->
new_file
.
flags
|=
GIT_DIFF_FLAG_VALID_OID
;
return
diff_insert_delta
(
diff
,
delta
,
matched_pathspec
);
...
...
@@ -189,21 +189,21 @@ static git_diff_delta *diff_delta__last_for_item(
switch
(
delta
->
status
)
{
case
GIT_DELTA_UNMODIFIED
:
case
GIT_DELTA_DELETED
:
if
(
git_oid__cmp
(
&
delta
->
old_file
.
oid
,
&
item
->
o
id
)
==
0
)
if
(
git_oid__cmp
(
&
delta
->
old_file
.
oid
,
&
item
->
id
)
==
0
)
return
delta
;
break
;
case
GIT_DELTA_ADDED
:
if
(
git_oid__cmp
(
&
delta
->
new_file
.
oid
,
&
item
->
o
id
)
==
0
)
if
(
git_oid__cmp
(
&
delta
->
new_file
.
oid
,
&
item
->
id
)
==
0
)
return
delta
;
break
;
case
GIT_DELTA_UNTRACKED
:
if
(
diff
->
strcomp
(
delta
->
new_file
.
path
,
item
->
path
)
==
0
&&
git_oid__cmp
(
&
delta
->
new_file
.
oid
,
&
item
->
o
id
)
==
0
)
git_oid__cmp
(
&
delta
->
new_file
.
oid
,
&
item
->
id
)
==
0
)
return
delta
;
break
;
case
GIT_DELTA_MODIFIED
:
if
(
git_oid__cmp
(
&
delta
->
old_file
.
oid
,
&
item
->
o
id
)
==
0
||
git_oid__cmp
(
&
delta
->
new_file
.
oid
,
&
item
->
o
id
)
==
0
)
if
(
git_oid__cmp
(
&
delta
->
old_file
.
oid
,
&
item
->
id
)
==
0
||
git_oid__cmp
(
&
delta
->
new_file
.
oid
,
&
item
->
id
)
==
0
)
return
delta
;
break
;
default:
...
...
@@ -629,7 +629,7 @@ static int maybe_modified_submodule(
/* now that we have a HEAD OID, check if HEAD moved */
if
((
sm_status
&
GIT_SUBMODULE_STATUS_IN_WD
)
!=
0
&&
!
git_oid_equal
(
&
info
->
oitem
->
o
id
,
found_oid
))
!
git_oid_equal
(
&
info
->
oitem
->
id
,
found_oid
))
*
status
=
GIT_DELTA_MODIFIED
;
return
0
;
...
...
@@ -689,15 +689,15 @@ static int maybe_modified(
}
/* if oids and modes match (and are valid), then file is unmodified */
else
if
(
git_oid_equal
(
&
oitem
->
oid
,
&
nitem
->
o
id
)
&&
else
if
(
git_oid_equal
(
&
oitem
->
id
,
&
nitem
->
id
)
&&
omode
==
nmode
&&
!
git_oid_iszero
(
&
oitem
->
o
id
))
!
git_oid_iszero
(
&
oitem
->
id
))
status
=
GIT_DELTA_UNMODIFIED
;
/* if we have an unknown OID and a workdir iterator, then check some
* circumstances that can accelerate things or need special handling
*/
else
if
(
git_oid_iszero
(
&
nitem
->
o
id
)
&&
new_is_workdir
)
{
else
if
(
git_oid_iszero
(
&
nitem
->
id
)
&&
new_is_workdir
)
{
bool
use_ctime
=
((
diff
->
diffcaps
&
GIT_DIFFCAPS_TRUST_CTIME
)
!=
0
);
bool
use_nanos
=
((
diff
->
diffcaps
&
GIT_DIFFCAPS_TRUST_NANOSECS
)
!=
0
);
...
...
@@ -732,7 +732,7 @@ static int maybe_modified(
/* if we got here and decided that the files are modified, but we
* haven't calculated the OID of the new item, then calculate it now
*/
if
(
status
==
GIT_DELTA_MODIFIED
&&
git_oid_iszero
(
&
nitem
->
o
id
))
{
if
(
status
==
GIT_DELTA_MODIFIED
&&
git_oid_iszero
(
&
nitem
->
id
))
{
if
(
git_oid_iszero
(
&
noid
))
{
if
((
error
=
git_diff__oid_for_file
(
diff
->
repo
,
nitem
->
path
,
nitem
->
mode
,
nitem
->
file_size
,
&
noid
))
<
0
)
...
...
@@ -744,7 +744,7 @@ static int maybe_modified(
* matches between the index and the workdir HEAD)
*/
if
(
omode
==
nmode
&&
!
S_ISGITLINK
(
omode
)
&&
git_oid_equal
(
&
oitem
->
o
id
,
&
noid
))
git_oid_equal
(
&
oitem
->
id
,
&
noid
))
status
=
GIT_DELTA_UNMODIFIED
;
}
...
...
src/index.c
View file @
d541170c
...
...
@@ -643,7 +643,7 @@ static int index_entry_init(
git_index_entry__init_from_stat
(
entry
,
&
st
,
!
index
->
distrust_filemode
);
entry
->
o
id
=
oid
;
entry
->
id
=
oid
;
entry
->
path
=
git__strdup
(
rel_path
);
GITERR_CHECK_ALLOC
(
entry
->
path
);
...
...
@@ -757,9 +757,9 @@ static int index_conflict_to_reuc(git_index *index, const char *path)
our_mode
=
conflict_entries
[
1
]
==
NULL
?
0
:
conflict_entries
[
1
]
->
mode
;
their_mode
=
conflict_entries
[
2
]
==
NULL
?
0
:
conflict_entries
[
2
]
->
mode
;
ancestor_oid
=
conflict_entries
[
0
]
==
NULL
?
NULL
:
&
conflict_entries
[
0
]
->
o
id
;
our_oid
=
conflict_entries
[
1
]
==
NULL
?
NULL
:
&
conflict_entries
[
1
]
->
o
id
;
their_oid
=
conflict_entries
[
2
]
==
NULL
?
NULL
:
&
conflict_entries
[
2
]
->
o
id
;
ancestor_oid
=
conflict_entries
[
0
]
==
NULL
?
NULL
:
&
conflict_entries
[
0
]
->
id
;
our_oid
=
conflict_entries
[
1
]
==
NULL
?
NULL
:
&
conflict_entries
[
1
]
->
id
;
their_oid
=
conflict_entries
[
2
]
==
NULL
?
NULL
:
&
conflict_entries
[
2
]
->
id
;
if
((
ret
=
git_index_reuc_add
(
index
,
path
,
ancestor_mode
,
ancestor_oid
,
our_mode
,
our_oid
,
their_mode
,
their_oid
))
>=
0
)
...
...
@@ -1515,7 +1515,7 @@ static size_t read_entry(git_index_entry *dest, const void *buffer, size_t buffe
dest
->
uid
=
ntohl
(
source
->
uid
);
dest
->
gid
=
ntohl
(
source
->
gid
);
dest
->
file_size
=
ntohl
(
source
->
file_size
);
git_oid_cpy
(
&
dest
->
o
id
,
&
source
->
oid
);
git_oid_cpy
(
&
dest
->
id
,
&
source
->
oid
);
dest
->
flags
=
ntohs
(
source
->
flags
);
if
(
dest
->
flags
&
GIT_IDXENTRY_EXTENDED
)
{
...
...
@@ -1756,7 +1756,7 @@ static int write_disk_entry(git_filebuf *file, git_index_entry *entry)
ondisk
->
gid
=
htonl
(
entry
->
gid
);
ondisk
->
file_size
=
htonl
((
uint32_t
)
entry
->
file_size
);
git_oid_cpy
(
&
ondisk
->
oid
,
&
entry
->
o
id
);
git_oid_cpy
(
&
ondisk
->
oid
,
&
entry
->
id
);
ondisk
->
flags
=
htons
(
entry
->
flags
);
...
...
@@ -1983,7 +1983,7 @@ static int read_tree_cb(
GITERR_CHECK_ALLOC
(
entry
);
entry
->
mode
=
tentry
->
attr
;
entry
->
o
id
=
tentry
->
oid
;
entry
->
id
=
tentry
->
oid
;
/* look for corresponding old entry and copy data to new entry */
if
(
data
->
old_entries
)
{
...
...
@@ -1997,7 +1997,7 @@ static int read_tree_cb(
&
pos
,
data
->
old_entries
,
data
->
entries_search
,
&
skey
)
&&
(
old_entry
=
git_vector_get
(
data
->
old_entries
,
pos
))
!=
NULL
&&
entry
->
mode
==
old_entry
->
mode
&&
git_oid_equal
(
&
entry
->
oid
,
&
old_entry
->
o
id
))
git_oid_equal
(
&
entry
->
id
,
&
old_entry
->
id
))
{
memcpy
(
entry
,
old_entry
,
sizeof
(
*
entry
));
entry
->
flags_extended
=
0
;
...
...
@@ -2135,7 +2135,7 @@ int git_index_add_all(
error
=
-
1
;
break
;
}
entry
->
o
id
=
blobid
;
entry
->
id
=
blobid
;
/* add working directory item to index */
if
((
error
=
index_insert
(
index
,
entry
,
1
))
<
0
)
{
...
...
src/iterator.c
View file @
d541170c
...
...
@@ -447,7 +447,7 @@ static int tree_iterator__update_entry(tree_iterator *ti)
te
=
tf
->
entries
[
tf
->
current
]
->
te
;
ti
->
entry
.
mode
=
te
->
attr
;
git_oid_cpy
(
&
ti
->
entry
.
o
id
,
&
te
->
oid
);
git_oid_cpy
(
&
ti
->
entry
.
id
,
&
te
->
oid
);
ti
->
entry
.
path
=
tree_iterator__current_filename
(
ti
,
te
);
GITERR_CHECK_ALLOC
(
ti
->
entry
.
path
);
...
...
src/merge.c
View file @
d541170c
...
...
@@ -317,7 +317,7 @@ GIT_INLINE(int) index_entry_cmp(const git_index_entry *a, const git_index_entry
return
(
b
->
path
==
NULL
)
?
0
:
1
;
if
((
value
=
a
->
mode
-
b
->
mode
)
==
0
&&
(
value
=
git_oid__cmp
(
&
a
->
oid
,
&
b
->
o
id
))
==
0
)
(
value
=
git_oid__cmp
(
&
a
->
id
,
&
b
->
id
))
==
0
)
value
=
strcmp
(
a
->
path
,
b
->
path
);
return
value
;
...
...
@@ -478,12 +478,12 @@ static int merge_conflict_resolve_one_renamed(
conflict
->
type
==
GIT_MERGE_DIFF_RENAMED_ADDED
)
return
0
;
ours_changed
=
(
git_oid__cmp
(
&
conflict
->
ancestor_entry
.
oid
,
&
conflict
->
our_entry
.
o
id
)
!=
0
);
theirs_changed
=
(
git_oid__cmp
(
&
conflict
->
ancestor_entry
.
oid
,
&
conflict
->
their_entry
.
o
id
)
!=
0
);
ours_changed
=
(
git_oid__cmp
(
&
conflict
->
ancestor_entry
.
id
,
&
conflict
->
our_entry
.
id
)
!=
0
);
theirs_changed
=
(
git_oid__cmp
(
&
conflict
->
ancestor_entry
.
id
,
&
conflict
->
their_entry
.
id
)
!=
0
);
/* if both are modified (and not to a common target) require a merge */
if
(
ours_changed
&&
theirs_changed
&&
git_oid__cmp
(
&
conflict
->
our_entry
.
oid
,
&
conflict
->
their_entry
.
o
id
)
!=
0
)
git_oid__cmp
(
&
conflict
->
our_entry
.
id
,
&
conflict
->
their_entry
.
id
)
!=
0
)
return
0
;
if
((
merged
=
git_pool_malloc
(
&
diff_list
->
pool
,
sizeof
(
git_index_entry
)))
==
NULL
)
...
...
@@ -575,7 +575,7 @@ static int merge_conflict_resolve_automerge(
index_entry
->
file_size
=
result
.
len
;
index_entry
->
mode
=
result
.
mode
;
git_oid_cpy
(
&
index_entry
->
o
id
,
&
automerge_oid
);
git_oid_cpy
(
&
index_entry
->
id
,
&
automerge_oid
);
git_vector_insert
(
&
diff_list
->
staged
,
index_entry
);
git_vector_insert
(
&
diff_list
->
resolved
,
(
git_merge_diff
*
)
conflict
);
...
...
@@ -643,7 +643,7 @@ static int index_entry_similarity_exact(
GIT_UNUSED
(
cache
);
GIT_UNUSED
(
opts
);
if
(
git_oid__cmp
(
&
a
->
oid
,
&
b
->
o
id
)
==
0
)
if
(
git_oid__cmp
(
&
a
->
id
,
&
b
->
id
)
==
0
)
return
100
;
return
0
;
...
...
@@ -662,10 +662,10 @@ static int index_entry_similarity_calc(
*
out
=
NULL
;
if
((
error
=
git_blob_lookup
(
&
blob
,
repo
,
&
entry
->
o
id
))
<
0
)
if
((
error
=
git_blob_lookup
(
&
blob
,
repo
,
&
entry
->
id
))
<
0
)
return
error
;
git_oid_cpy
(
&
diff_file
.
oid
,
&
entry
->
o
id
);
git_oid_cpy
(
&
diff_file
.
oid
,
&
entry
->
id
);
diff_file
.
path
=
entry
->
path
;
diff_file
.
size
=
entry
->
file_size
;
diff_file
.
mode
=
entry
->
mode
;
...
...
@@ -1163,7 +1163,7 @@ GIT_INLINE(int) merge_diff_detect_binary(
int
error
=
0
;
if
(
GIT_MERGE_INDEX_ENTRY_ISFILE
(
conflict
->
ancestor_entry
))
{
if
((
error
=
git_blob_lookup
(
&
ancestor_blob
,
repo
,
&
conflict
->
ancestor_entry
.
o
id
))
<
0
)
if
((
error
=
git_blob_lookup
(
&
ancestor_blob
,
repo
,
&
conflict
->
ancestor_entry
.
id
))
<
0
)
goto
done
;
conflict
->
binary
=
git_blob_is_binary
(
ancestor_blob
);
...
...
@@ -1171,7 +1171,7 @@ GIT_INLINE(int) merge_diff_detect_binary(
if
(
!
conflict
->
binary
&&
GIT_MERGE_INDEX_ENTRY_ISFILE
(
conflict
->
our_entry
))
{
if
((
error
=
git_blob_lookup
(
&
our_blob
,
repo
,
&
conflict
->
our_entry
.
o
id
))
<
0
)
if
((
error
=
git_blob_lookup
(
&
our_blob
,
repo
,
&
conflict
->
our_entry
.
id
))
<
0
)
goto
done
;
conflict
->
binary
=
git_blob_is_binary
(
our_blob
);
...
...
@@ -1179,7 +1179,7 @@ GIT_INLINE(int) merge_diff_detect_binary(
if
(
!
conflict
->
binary
&&
GIT_MERGE_INDEX_ENTRY_ISFILE
(
conflict
->
their_entry
))
{
if
((
error
=
git_blob_lookup
(
&
their_blob
,
repo
,
&
conflict
->
their_entry
.
o
id
))
<
0
)
if
((
error
=
git_blob_lookup
(
&
their_blob
,
repo
,
&
conflict
->
their_entry
.
id
))
<
0
)
goto
done
;
conflict
->
binary
=
git_blob_is_binary
(
their_blob
);
...
...
@@ -1222,7 +1222,7 @@ GIT_INLINE(int) merge_delta_type_from_index_entries(
return
GIT_DELTA_TYPECHANGE
;
else
if
(
S_ISLNK
(
ancestor
->
mode
)
^
S_ISLNK
(
other
->
mode
))
return
GIT_DELTA_TYPECHANGE
;
else
if
(
git_oid__cmp
(
&
ancestor
->
oid
,
&
other
->
o
id
)
||
else
if
(
git_oid__cmp
(
&
ancestor
->
id
,
&
other
->
id
)
||
ancestor
->
mode
!=
other
->
mode
)
return
GIT_DELTA_MODIFIED
;
...
...
@@ -1497,7 +1497,7 @@ static int merge_index_insert_reuc(
}
mode
[
idx
]
=
entry
->
mode
;
oid
[
idx
]
=
&
entry
->
o
id
;
oid
[
idx
]
=
&
entry
->
id
;
return
git_index_reuc_add
(
index
,
entry
->
path
,
mode
[
0
],
oid
[
0
],
mode
[
1
],
oid
[
1
],
mode
[
2
],
oid
[
2
]);
...
...
src/merge_file.c
View file @
d541170c
...
...
@@ -77,7 +77,7 @@ int git_merge_file_input_from_index_entry(
return
0
;
if
((
error
=
git_repository_odb
(
&
odb
,
repo
))
<
0
||
(
error
=
git_odb_read
(
&
input
->
odb_object
,
odb
,
&
entry
->
o
id
))
<
0
)
(
error
=
git_odb_read
(
&
input
->
odb_object
,
odb
,
&
entry
->
id
))
<
0
)
goto
done
;
input
->
mode
=
entry
->
mode
;
...
...
src/notes.c
View file @
d541170c
...
...
@@ -640,7 +640,7 @@ int git_note_next(
if
((
error
=
git_iterator_current
(
&
item
,
it
))
<
0
)
return
error
;
git_oid_cpy
(
note_id
,
&
item
->
o
id
);
git_oid_cpy
(
note_id
,
&
item
->
id
);
if
(
!
(
error
=
process_entry_path
(
item
->
path
,
annotated_id
)))
git_iterator_advance
(
NULL
,
it
);
...
...
src/reset.c
View file @
d541170c
...
...
@@ -72,7 +72,7 @@ int git_reset_default(
goto
cleanup
;
}
else
{
entry
.
mode
=
delta
->
new_file
.
mode
;
git_oid_cpy
(
&
entry
.
o
id
,
&
delta
->
new_file
.
oid
);
git_oid_cpy
(
&
entry
.
id
,
&
delta
->
new_file
.
oid
);
entry
.
path
=
(
char
*
)
delta
->
new_file
.
path
;
if
((
error
=
git_index_add
(
index
,
&
entry
))
<
0
)
...
...
src/submodule.c
View file @
d541170c
...
...
@@ -387,7 +387,7 @@ int git_submodule_add_to_index(git_submodule *sm, int write_index)
error
=
-
1
;
goto
cleanup
;
}
git_oid_cpy
(
&
entry
.
o
id
,
&
sm
->
wd_oid
);
git_oid_cpy
(
&
entry
.
id
,
&
sm
->
wd_oid
);
if
((
error
=
git_commit_lookup
(
&
head
,
sm_repo
,
&
sm
->
wd_oid
))
<
0
)
goto
cleanup
;
...
...
@@ -780,7 +780,7 @@ static void submodule_update_from_index_entry(
if
(
already_found
)
sm
->
flags
|=
GIT_SUBMODULE_STATUS__INDEX_MULTIPLE_ENTRIES
;
else
git_oid_cpy
(
&
sm
->
index_oid
,
&
ie
->
o
id
);
git_oid_cpy
(
&
sm
->
index_oid
,
&
ie
->
id
);
sm
->
flags
|=
GIT_SUBMODULE_STATUS_IN_INDEX
|
GIT_SUBMODULE_STATUS__INDEX_OID_VALID
;
...
...
@@ -1281,7 +1281,7 @@ static int load_submodule_config_from_index(
if
(
!
submodule_get
(
&
sm
,
repo
,
entry
->
path
,
NULL
))
submodule_update_from_index_entry
(
sm
,
entry
);
}
else
if
(
strcmp
(
entry
->
path
,
GIT_MODULES_FILE
)
==
0
)
git_oid_cpy
(
gitmodules_oid
,
&
entry
->
o
id
);
git_oid_cpy
(
gitmodules_oid
,
&
entry
->
id
);
}
if
(
error
==
GIT_ITEROVER
)
...
...
@@ -1320,16 +1320,16 @@ static int load_submodule_config_from_head(
if
(
S_ISGITLINK
(
entry
->
mode
))
submodule_update_from_head_data
(
sm
,
entry
->
mode
,
&
entry
->
o
id
);
sm
,
entry
->
mode
,
&
entry
->
id
);
else
sm
->
flags
|=
GIT_SUBMODULE_STATUS__HEAD_NOT_SUBMODULE
;
}
else
if
(
S_ISGITLINK
(
entry
->
mode
))
{
if
(
!
submodule_get
(
&
sm
,
repo
,
entry
->
path
,
NULL
))
submodule_update_from_head_data
(
sm
,
entry
->
mode
,
&
entry
->
o
id
);
sm
,
entry
->
mode
,
&
entry
->
id
);
}
else
if
(
strcmp
(
entry
->
path
,
GIT_MODULES_FILE
)
==
0
&&
git_oid_iszero
(
gitmodules_oid
))
{
git_oid_cpy
(
gitmodules_oid
,
&
entry
->
o
id
);
git_oid_cpy
(
gitmodules_oid
,
&
entry
->
id
);
}
}
...
...
src/tree.c
View file @
d541170c
...
...
@@ -551,7 +551,7 @@ static int write_tree(
if
(
error
<
0
)
goto
on_error
;
}
else
{
error
=
append_entry
(
bld
,
filename
,
&
entry
->
o
id
,
entry
->
mode
);
error
=
append_entry
(
bld
,
filename
,
&
entry
->
id
,
entry
->
mode
);
if
(
error
<
0
)
goto
on_error
;
}
...
...
tests/attr/repo.c
View file @
d541170c
...
...
@@ -293,7 +293,7 @@ static void assert_proper_normalization(git_index *index, const char *filename,
cl_assert
(
!
git_index_find
(
&
index_pos
,
index
,
filename
));
entry
=
git_index_get_byindex
(
index
,
index_pos
);
cl_assert_equal_i
(
0
,
git_oid_streq
(
&
entry
->
o
id
,
expected_sha
));
cl_assert_equal_i
(
0
,
git_oid_streq
(
&
entry
->
id
,
expected_sha
));
}
void
test_attr_repo__staging_properly_normalizes_line_endings_according_to_gitattributes_directives
(
void
)
...
...
tests/checkout/conflict.c
View file @
d541170c
...
...
@@ -96,7 +96,7 @@ static void create_index(struct checkout_index_entry *entries, size_t entries_le
entry
.
mode
=
entries
[
i
].
mode
;
entry
.
flags
=
entries
[
i
].
stage
<<
GIT_IDXENTRY_STAGESHIFT
;
git_oid_fromstr
(
&
entry
.
o
id
,
entries
[
i
].
oid_str
);
git_oid_fromstr
(
&
entry
.
id
,
entries
[
i
].
oid_str
);
entry
.
path
=
entries
[
i
].
path
;
cl_git_pass
(
git_index_add
(
g_index
,
&
entry
));
...
...
tests/checkout/crlf.c
View file @
d541170c
...
...
@@ -174,13 +174,13 @@ void test_checkout_crlf__with_ident(void)
/* check that blobs have $Id$ */
cl_git_pass
(
git_blob_lookup
(
&
blob
,
g_repo
,
&
git_index_get_bypath
(
index
,
"lf.ident"
,
0
)
->
o
id
));
&
git_index_get_bypath
(
index
,
"lf.ident"
,
0
)
->
id
));
cl_assert_equal_s
(
ALL_LF_TEXT_RAW
"
\n
$Id$
\n
"
,
git_blob_rawcontent
(
blob
));
git_blob_free
(
blob
);
cl_git_pass
(
git_blob_lookup
(
&
blob
,
g_repo
,
&
git_index_get_bypath
(
index
,
"more2.identcrlf"
,
0
)
->
o
id
));
&
git_index_get_bypath
(
index
,
"more2.identcrlf"
,
0
)
->
id
));
cl_assert_equal_s
(
"
\n
$Id$
\n
"
MORE_CRLF_TEXT_AS_LF
,
git_blob_rawcontent
(
blob
));
git_blob_free
(
blob
);
...
...
tests/checkout/tree.c
View file @
d541170c
...
...
@@ -892,16 +892,16 @@ static void create_conflict(void)
memset
(
&
entry
,
0x0
,
sizeof
(
git_index_entry
));
entry
.
mode
=
0100644
;
entry
.
flags
=
1
<<
GIT_IDXENTRY_STAGESHIFT
;
git_oid_fromstr
(
&
entry
.
o
id
,
"d427e0b2e138501a3d15cc376077a3631e15bd46"
);
git_oid_fromstr
(
&
entry
.
id
,
"d427e0b2e138501a3d15cc376077a3631e15bd46"
);
entry
.
path
=
"conflicts.txt"
;
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
entry
.
flags
=
2
<<
GIT_IDXENTRY_STAGESHIFT
;
git_oid_fromstr
(
&
entry
.
o
id
,
"ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf"
);
git_oid_fromstr
(
&
entry
.
id
,
"ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf"
);
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
entry
.
flags
=
3
<<
GIT_IDXENTRY_STAGESHIFT
;
git_oid_fromstr
(
&
entry
.
o
id
,
"2bd0a343aeef7a2cf0d158478966a6e587ff3863"
);
git_oid_fromstr
(
&
entry
.
id
,
"2bd0a343aeef7a2cf0d158478966a6e587ff3863"
);
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
git_index_write
(
index
);
...
...
tests/diff/iterator.c
View file @
d541170c
...
...
@@ -377,7 +377,7 @@ static void index_iterator_test(
if
(
expected_oids
!=
NULL
)
{
git_oid
oid
;
cl_git_pass
(
git_oid_fromstr
(
&
oid
,
expected_oids
[
count
]));
cl_assert_equal_i
(
git_oid_cmp
(
&
oid
,
&
entry
->
o
id
),
0
);
cl_assert_equal_i
(
git_oid_cmp
(
&
oid
,
&
entry
->
id
),
0
);
}
count
++
;
...
...
tests/filter/custom.c
View file @
d541170c
...
...
@@ -299,7 +299,7 @@ void test_filter_custom__order_dependency(void)
git_index_free
(
index
);
cl_git_pass
(
git_blob_lookup
(
&
blob
,
g_repo
,
&
git_index_get_bypath
(
index
,
"hero.1.rev-ident"
,
0
)
->
o
id
));
&
git_index_get_bypath
(
index
,
"hero.1.rev-ident"
,
0
)
->
id
));
cl_assert_equal_s
(
"
\n
!nuf evaH
\n
$dI$
\n
tset a si sihT"
,
git_blob_rawcontent
(
blob
));
cl_git_pass
(
git_blob_filtered_content
(
&
buf
,
blob
,
"hero.1.rev-ident"
,
0
));
...
...
@@ -310,7 +310,7 @@ void test_filter_custom__order_dependency(void)
git_blob_free
(
blob
);
cl_git_pass
(
git_blob_lookup
(
&
blob
,
g_repo
,
&
git_index_get_bypath
(
index
,
"hero.2.rev-ident"
,
0
)
->
o
id
));
&
git_index_get_bypath
(
index
,
"hero.2.rev-ident"
,
0
)
->
id
));
cl_assert_equal_s
(
"
\n
!yzarC
\n
$Id$
\n
tset rehtonA"
,
git_blob_rawcontent
(
blob
));
cl_git_pass
(
git_blob_filtered_content
(
&
buf
,
blob
,
"hero.2.rev-ident"
,
0
));
...
...
tests/index/conflicts.c
View file @
d541170c
...
...
@@ -47,15 +47,15 @@ void test_index_conflicts__add(void)
ancestor_entry
.
path
=
"test-one.txt"
;
ancestor_entry
.
flags
|=
(
1
<<
GIT_IDXENTRY_STAGESHIFT
);
git_oid_fromstr
(
&
ancestor_entry
.
o
id
,
TEST_ANCESTOR_OID
);
git_oid_fromstr
(
&
ancestor_entry
.
id
,
TEST_ANCESTOR_OID
);
our_entry
.
path
=
"test-one.txt"
;
ancestor_entry
.
flags
|=
(
2
<<
GIT_IDXENTRY_STAGESHIFT
);
git_oid_fromstr
(
&
our_entry
.
o
id
,
TEST_OUR_OID
);
git_oid_fromstr
(
&
our_entry
.
id
,
TEST_OUR_OID
);
their_entry
.
path
=
"test-one.txt"
;
ancestor_entry
.
flags
|=
(
3
<<
GIT_IDXENTRY_STAGESHIFT
);
git_oid_fromstr
(
&
their_entry
.
o
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
));
...
...
@@ -75,15 +75,15 @@ void test_index_conflicts__add_fixes_incorrect_stage(void)
ancestor_entry
.
path
=
"test-one.txt"
;
ancestor_entry
.
flags
|=
(
3
<<
GIT_IDXENTRY_STAGESHIFT
);
git_oid_fromstr
(
&
ancestor_entry
.
o
id
,
TEST_ANCESTOR_OID
);
git_oid_fromstr
(
&
ancestor_entry
.
id
,
TEST_ANCESTOR_OID
);
our_entry
.
path
=
"test-one.txt"
;
ancestor_entry
.
flags
|=
(
1
<<
GIT_IDXENTRY_STAGESHIFT
);
git_oid_fromstr
(
&
our_entry
.
o
id
,
TEST_OUR_OID
);
git_oid_fromstr
(
&
our_entry
.
id
,
TEST_OUR_OID
);
their_entry
.
path
=
"test-one.txt"
;
ancestor_entry
.
flags
|=
(
2
<<
GIT_IDXENTRY_STAGESHIFT
);
git_oid_fromstr
(
&
their_entry
.
o
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
));
...
...
@@ -107,13 +107,13 @@ void test_index_conflicts__get(void)
cl_assert_equal_s
(
"conflicts-one.txt"
,
conflict_entry
[
0
]
->
path
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_ONE_ANCESTOR_OID
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
0
]
->
o
id
,
&
oid
)
==
0
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
0
]
->
id
,
&
oid
)
==
0
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_ONE_OUR_OID
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
1
]
->
o
id
,
&
oid
)
==
0
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
1
]
->
id
,
&
oid
)
==
0
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_ONE_THEIR_OID
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
2
]
->
o
id
,
&
oid
)
==
0
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
2
]
->
id
,
&
oid
)
==
0
);
cl_git_pass
(
git_index_conflict_get
(
&
conflict_entry
[
0
],
&
conflict_entry
[
1
],
&
conflict_entry
[
2
],
repo_index
,
"conflicts-two.txt"
));
...
...
@@ -121,13 +121,13 @@ void test_index_conflicts__get(void)
cl_assert_equal_s
(
"conflicts-two.txt"
,
conflict_entry
[
0
]
->
path
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_TWO_ANCESTOR_OID
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
0
]
->
o
id
,
&
oid
)
==
0
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
0
]
->
id
,
&
oid
)
==
0
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_TWO_OUR_OID
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
1
]
->
o
id
,
&
oid
)
==
0
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
1
]
->
id
,
&
oid
)
==
0
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_TWO_THEIR_OID
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
2
]
->
o
id
,
&
oid
)
==
0
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
2
]
->
id
,
&
oid
)
==
0
);
}
void
test_index_conflicts__iterate
(
void
)
...
...
@@ -141,29 +141,29 @@ void test_index_conflicts__iterate(void)
cl_git_pass
(
git_index_conflict_next
(
&
conflict_entry
[
0
],
&
conflict_entry
[
1
],
&
conflict_entry
[
2
],
iterator
));
git_oid_fromstr
(
&
oid
,
CONFLICTS_ONE_ANCESTOR_OID
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
0
]
->
o
id
,
&
oid
)
==
0
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
0
]
->
id
,
&
oid
)
==
0
);
cl_assert
(
git__strcmp
(
conflict_entry
[
0
]
->
path
,
"conflicts-one.txt"
)
==
0
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_ONE_OUR_OID
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
1
]
->
o
id
,
&
oid
)
==
0
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
1
]
->
id
,
&
oid
)
==
0
);
cl_assert
(
git__strcmp
(
conflict_entry
[
0
]
->
path
,
"conflicts-one.txt"
)
==
0
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_ONE_THEIR_OID
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
2
]
->
o
id
,
&
oid
)
==
0
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
2
]
->
id
,
&
oid
)
==
0
);
cl_assert
(
git__strcmp
(
conflict_entry
[
0
]
->
path
,
"conflicts-one.txt"
)
==
0
);
cl_git_pass
(
git_index_conflict_next
(
&
conflict_entry
[
0
],
&
conflict_entry
[
1
],
&
conflict_entry
[
2
],
iterator
));
git_oid_fromstr
(
&
oid
,
CONFLICTS_TWO_ANCESTOR_OID
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
0
]
->
o
id
,
&
oid
)
==
0
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
0
]
->
id
,
&
oid
)
==
0
);
cl_assert
(
git__strcmp
(
conflict_entry
[
0
]
->
path
,
"conflicts-two.txt"
)
==
0
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_TWO_OUR_OID
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
1
]
->
o
id
,
&
oid
)
==
0
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
1
]
->
id
,
&
oid
)
==
0
);
cl_assert
(
git__strcmp
(
conflict_entry
[
0
]
->
path
,
"conflicts-two.txt"
)
==
0
);
git_oid_fromstr
(
&
oid
,
CONFLICTS_TWO_THEIR_OID
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
2
]
->
o
id
,
&
oid
)
==
0
);
cl_assert
(
git_oid_cmp
(
&
conflict_entry
[
2
]
->
id
,
&
oid
)
==
0
);
cl_assert
(
git__strcmp
(
conflict_entry
[
0
]
->
path
,
"conflicts-two.txt"
)
==
0
);
cl_assert
(
git_index_conflict_next
(
&
conflict_entry
[
0
],
&
conflict_entry
[
1
],
&
conflict_entry
[
2
],
iterator
)
==
GIT_ITEROVER
);
...
...
@@ -273,7 +273,7 @@ void test_index_conflicts__partial(void)
ancestor_entry
.
path
=
"test-one.txt"
;
ancestor_entry
.
flags
|=
(
1
<<
GIT_IDXENTRY_STAGESHIFT
);
git_oid_fromstr
(
&
ancestor_entry
.
o
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_assert
(
git_index_entrycount
(
repo_index
)
==
9
);
...
...
@@ -281,7 +281,7 @@ void test_index_conflicts__partial(void)
cl_git_pass
(
git_index_conflict_get
(
&
conflict_entry
[
0
],
&
conflict_entry
[
1
],
&
conflict_entry
[
2
],
repo_index
,
"test-one.txt"
));
cl_assert
(
git_oid_cmp
(
&
ancestor_entry
.
oid
,
&
conflict_entry
[
0
]
->
o
id
)
==
0
);
cl_assert
(
git_oid_cmp
(
&
ancestor_entry
.
id
,
&
conflict_entry
[
0
]
->
id
)
==
0
);
cl_assert
(
conflict_entry
[
1
]
==
NULL
);
cl_assert
(
conflict_entry
[
2
]
==
NULL
);
}
tests/index/rename.c
View file @
d541170c
...
...
@@ -27,7 +27,7 @@ void test_index_rename__single_file(void)
cl_assert
(
!
git_index_find
(
&
position
,
index
,
"lame.name.txt"
));
entry
=
git_index_get_byindex
(
index
,
position
);
cl_assert
(
git_oid_cmp
(
&
expected
,
&
entry
->
o
id
)
==
0
);
cl_assert
(
git_oid_cmp
(
&
expected
,
&
entry
->
id
)
==
0
);
/* This removes the entry from the index, but not from the object database */
cl_git_pass
(
git_index_remove
(
index
,
"lame.name.txt"
,
0
));
...
...
@@ -41,7 +41,7 @@ void test_index_rename__single_file(void)
cl_assert
(
!
git_index_find
(
&
position
,
index
,
"fancy.name.txt"
));
entry
=
git_index_get_byindex
(
index
,
position
);
cl_assert
(
git_oid_cmp
(
&
expected
,
&
entry
->
o
id
)
==
0
);
cl_assert
(
git_oid_cmp
(
&
expected
,
&
entry
->
id
)
==
0
);
git_index_free
(
index
);
git_repository_free
(
repo
);
...
...
tests/index/tests.c
View file @
d541170c
...
...
@@ -243,11 +243,11 @@ void test_index_tests__add(void)
entry
=
git_index_get_byindex
(
index
,
0
);
/* And the built-in hashing mechanism worked as expected */
cl_assert
(
git_oid_cmp
(
&
id1
,
&
entry
->
o
id
)
==
0
);
cl_assert
(
git_oid_cmp
(
&
id1
,
&
entry
->
id
)
==
0
);
/* Test access by path instead of index */
cl_assert
((
entry
=
git_index_get_bypath
(
index
,
"test.txt"
,
0
))
!=
NULL
);
cl_assert
(
git_oid_cmp
(
&
id1
,
&
entry
->
o
id
)
==
0
);
cl_assert
(
git_oid_cmp
(
&
id1
,
&
entry
->
id
)
==
0
);
git_index_free
(
index
);
git_repository_free
(
repo
);
...
...
@@ -283,14 +283,14 @@ void test_index_tests__add_issue_1397(void)
/* Make sure the initial SHA-1 is correct */
cl_assert
((
entry
=
git_index_get_bypath
(
index
,
"crlf_file.txt"
,
0
))
!=
NULL
);
cl_assert_
(
git_oid_cmp
(
&
id1
,
&
entry
->
o
id
)
==
0
,
"first oid check"
);
cl_assert_
(
git_oid_cmp
(
&
id1
,
&
entry
->
id
)
==
0
,
"first oid check"
);
/* Update the index */
cl_git_pass
(
git_index_add_bypath
(
index
,
"crlf_file.txt"
));
/* Check the new SHA-1 */
cl_assert
((
entry
=
git_index_get_bypath
(
index
,
"crlf_file.txt"
,
0
))
!=
NULL
);
cl_assert_
(
git_oid_cmp
(
&
id1
,
&
entry
->
o
id
)
==
0
,
"second oid check"
);
cl_assert_
(
git_oid_cmp
(
&
id1
,
&
entry
->
id
)
==
0
,
"second oid check"
);
git_index_free
(
index
);
}
...
...
tests/merge/merge_helpers.c
View file @
d541170c
...
...
@@ -112,7 +112,7 @@ void merge__dump_index_entries(git_vector *index_entries)
index_entry
=
index_entries
->
contents
[
i
];
printf
(
"%o "
,
index_entry
->
mode
);
printf
(
"%s "
,
git_oid_allocfmt
(
&
index_entry
->
o
id
));
printf
(
"%s "
,
git_oid_allocfmt
(
&
index_entry
->
id
));
printf
(
"%d "
,
git_index_entry_stage
(
index_entry
));
printf
(
"%s "
,
index_entry
->
path
);
printf
(
"
\n
"
);
...
...
@@ -166,7 +166,7 @@ static int index_entry_eq_merge_index_entry(const struct merge_index_entry *expe
test_oid
=
0
;
if
(
actual
->
mode
!=
expected
->
mode
||
(
test_oid
&&
git_oid_cmp
(
&
actual
->
o
id
,
&
expected_oid
)
!=
0
)
||
(
test_oid
&&
git_oid_cmp
(
&
actual
->
id
,
&
expected_oid
)
!=
0
)
||
git_index_entry_stage
(
actual
)
!=
expected
->
stage
)
return
0
;
...
...
tests/merge/trees/automerge.c
View file @
d541170c
...
...
@@ -121,7 +121,7 @@ void test_merge_trees_automerge__automerge(void)
cl_assert
((
entry
=
git_index_get_bypath
(
index
,
"automergeable.txt"
,
0
))
!=
NULL
);
cl_assert
(
entry
->
file_size
==
strlen
(
AUTOMERGEABLE_MERGED_FILE
));
cl_git_pass
(
git_object_lookup
((
git_object
**
)
&
blob
,
repo
,
&
entry
->
o
id
,
GIT_OBJ_BLOB
));
cl_git_pass
(
git_object_lookup
((
git_object
**
)
&
blob
,
repo
,
&
entry
->
id
,
GIT_OBJ_BLOB
));
cl_assert
(
memcmp
(
git_blob_rawcontent
(
blob
),
AUTOMERGEABLE_MERGED_FILE
,
(
size_t
)
entry
->
file_size
)
==
0
);
git_index_free
(
index
);
...
...
tests/merge/trees/commits.c
View file @
d541170c
...
...
@@ -72,7 +72,7 @@ void test_merge_trees_commits__automerge(void)
cl_assert
((
entry
=
git_index_get_bypath
(
index
,
"automergeable.txt"
,
0
))
!=
NULL
);
cl_assert
(
entry
->
file_size
==
strlen
(
AUTOMERGEABLE_MERGED_FILE
));
cl_git_pass
(
git_object_lookup
((
git_object
**
)
&
blob
,
repo
,
&
entry
->
o
id
,
GIT_OBJ_BLOB
));
cl_git_pass
(
git_object_lookup
((
git_object
**
)
&
blob
,
repo
,
&
entry
->
id
,
GIT_OBJ_BLOB
));
cl_assert
(
memcmp
(
git_blob_rawcontent
(
blob
),
AUTOMERGEABLE_MERGED_FILE
,
(
size_t
)
entry
->
file_size
)
==
0
);
git_index_free
(
index
);
...
...
tests/merge/trees/trivial.c
View file @
d541170c
...
...
@@ -259,7 +259,7 @@ void test_merge_trees_trivial__13(void)
cl_assert
(
entry
=
git_index_get_bypath
(
result
,
"modified-in-13.txt"
,
0
));
cl_git_pass
(
git_oid_fromstr
(
&
expected_oid
,
"1cff9ec6a47a537380dedfdd17c9e76d74259a2b"
));
cl_assert
(
git_oid_cmp
(
&
entry
->
o
id
,
&
expected_oid
)
==
0
);
cl_assert
(
git_oid_cmp
(
&
entry
->
id
,
&
expected_oid
)
==
0
);
cl_assert
(
git_index_reuc_entrycount
(
result
)
==
0
);
cl_assert
(
merge_trivial_conflict_entrycount
(
result
)
==
0
);
...
...
@@ -278,7 +278,7 @@ void test_merge_trees_trivial__14(void)
cl_assert
(
entry
=
git_index_get_bypath
(
result
,
"modified-in-14-branch.txt"
,
0
));
cl_git_pass
(
git_oid_fromstr
(
&
expected_oid
,
"26153a3ff3649b6c2bb652d3f06878c6e0a172f9"
));
cl_assert
(
git_oid_cmp
(
&
entry
->
o
id
,
&
expected_oid
)
==
0
);
cl_assert
(
git_oid_cmp
(
&
entry
->
id
,
&
expected_oid
)
==
0
);
cl_assert
(
git_index_reuc_entrycount
(
result
)
==
0
);
cl_assert
(
merge_trivial_conflict_entrycount
(
result
)
==
0
);
...
...
tests/merge/workdir/simple.c
View file @
d541170c
...
...
@@ -696,7 +696,7 @@ void test_merge_workdir_simple__binary(void)
cl_assert
((
binary_entry
=
git_index_get_bypath
(
repo_index
,
"binary"
,
0
))
!=
NULL
);
cl_git_pass
(
git_oid_fromstr
(
&
our_file_oid
,
"23ed141a6ae1e798b2f721afedbe947c119111ba"
));
cl_assert
(
git_oid_cmp
(
&
binary_entry
->
o
id
,
&
our_file_oid
)
==
0
);
cl_assert
(
git_oid_cmp
(
&
binary_entry
->
id
,
&
our_file_oid
)
==
0
);
git_merge_head_free
(
their_head
);
git_merge_result_free
(
result
);
...
...
tests/merge/workdir/trivial.c
View file @
d541170c
...
...
@@ -226,7 +226,7 @@ void test_merge_workdir_trivial__13(void)
cl_assert
(
entry
=
git_index_get_bypath
(
repo_index
,
"modified-in-13.txt"
,
0
));
cl_git_pass
(
git_oid_fromstr
(
&
expected_oid
,
"1cff9ec6a47a537380dedfdd17c9e76d74259a2b"
));
cl_assert
(
git_oid_cmp
(
&
entry
->
o
id
,
&
expected_oid
)
==
0
);
cl_assert
(
git_oid_cmp
(
&
entry
->
id
,
&
expected_oid
)
==
0
);
cl_assert
(
git_index_reuc_entrycount
(
repo_index
)
==
0
);
cl_assert
(
merge_trivial_conflict_entrycount
()
==
0
);
...
...
@@ -242,7 +242,7 @@ void test_merge_workdir_trivial__14(void)
cl_assert
(
entry
=
git_index_get_bypath
(
repo_index
,
"modified-in-14-branch.txt"
,
0
));
cl_git_pass
(
git_oid_fromstr
(
&
expected_oid
,
"26153a3ff3649b6c2bb652d3f06878c6e0a172f9"
));
cl_assert
(
git_oid_cmp
(
&
entry
->
o
id
,
&
expected_oid
)
==
0
);
cl_assert
(
git_oid_cmp
(
&
entry
->
id
,
&
expected_oid
)
==
0
);
cl_assert
(
git_index_reuc_entrycount
(
repo_index
)
==
0
);
cl_assert
(
merge_trivial_conflict_entrycount
()
==
0
);
...
...
tests/object/commit/commitstagedfile.c
View file @
d541170c
...
...
@@ -77,7 +77,7 @@ void test_object_commit_commitstagedfile__generate_predictable_object_ids(void)
entry
=
git_index_get_byindex
(
index
,
0
);
cl_assert
(
git_oid_cmp
(
&
expected_blob_oid
,
&
entry
->
o
id
)
==
0
);
cl_assert
(
git_oid_cmp
(
&
expected_blob_oid
,
&
entry
->
id
)
==
0
);
/*
* Information about index entry should match test file
...
...
tests/object/tree/duplicateentries.c
View file @
d541170c
...
...
@@ -127,17 +127,17 @@ static void add_fake_conflicts(git_index *index)
ancestor_entry
.
path
=
"duplicate"
;
ancestor_entry
.
mode
=
GIT_FILEMODE_BLOB
;
ancestor_entry
.
flags
|=
(
1
<<
GIT_IDXENTRY_STAGESHIFT
);
git_oid_fromstr
(
&
ancestor_entry
.
o
id
,
"a8233120f6ad708f843d861ce2b7228ec4e3dec6"
);
git_oid_fromstr
(
&
ancestor_entry
.
id
,
"a8233120f6ad708f843d861ce2b7228ec4e3dec6"
);
our_entry
.
path
=
"duplicate"
;
our_entry
.
mode
=
GIT_FILEMODE_BLOB
;
ancestor_entry
.
flags
|=
(
2
<<
GIT_IDXENTRY_STAGESHIFT
);
git_oid_fromstr
(
&
our_entry
.
o
id
,
"45b983be36b73c0788dc9cbcb76cbb80fc7bb057"
);
git_oid_fromstr
(
&
our_entry
.
id
,
"45b983be36b73c0788dc9cbcb76cbb80fc7bb057"
);
their_entry
.
path
=
"duplicate"
;
their_entry
.
mode
=
GIT_FILEMODE_BLOB
;
ancestor_entry
.
flags
|=
(
3
<<
GIT_IDXENTRY_STAGESHIFT
);
git_oid_fromstr
(
&
their_entry
.
o
id
,
"a71586c1dfe8a71c6cbf6c129f404c5642ff31bd"
);
git_oid_fromstr
(
&
their_entry
.
id
,
"a71586c1dfe8a71c6cbf6c129f404c5642ff31bd"
);
cl_git_pass
(
git_index_conflict_add
(
index
,
&
ancestor_entry
,
&
our_entry
,
&
their_entry
));
}
...
...
tests/reset/default.c
View file @
d541170c
...
...
@@ -57,7 +57,7 @@ static void assert_content_in_index(
if
(
!
expected_shas
)
continue
;
cl_git_pass
(
git_oid_streq
(
&
entry
->
o
id
,
expected_shas
->
strings
[
i
]));
cl_git_pass
(
git_oid_streq
(
&
entry
->
id
,
expected_shas
->
strings
[
i
]));
}
else
cl_assert_equal_i
(
should_exist
,
error
!=
GIT_ENOTFOUND
);
}
...
...
tests/reset/hard.c
View file @
d541170c
...
...
@@ -111,7 +111,7 @@ static void index_entry_init(git_index *index, int side, git_oid *oid)
entry
.
path
=
"conflicting_file"
;
entry
.
flags
=
(
side
<<
GIT_IDXENTRY_STAGESHIFT
);
entry
.
mode
=
0100644
;
git_oid_cpy
(
&
entry
.
o
id
,
oid
);
git_oid_cpy
(
&
entry
.
id
,
oid
);
cl_git_pass
(
git_index_add
(
index
,
&
entry
));
}
...
...
tests/status/worktree.c
View file @
d541170c
...
...
@@ -455,15 +455,15 @@ void test_status_worktree__conflict_with_diff3(void)
memset
(
&
their_entry
,
0x0
,
sizeof
(
git_index_entry
));
ancestor_entry
.
path
=
"modified_file"
;
git_oid_fromstr
(
&
ancestor_entry
.
o
id
,
git_oid_fromstr
(
&
ancestor_entry
.
id
,
"452e4244b5d083ddf0460acf1ecc74db9dcfa11a"
);
our_entry
.
path
=
"modified_file"
;
git_oid_fromstr
(
&
our_entry
.
o
id
,
git_oid_fromstr
(
&
our_entry
.
id
,
"452e4244b5d083ddf0460acf1ecc74db9dcfa11a"
);
their_entry
.
path
=
"modified_file"
;
git_oid_fromstr
(
&
their_entry
.
o
id
,
git_oid_fromstr
(
&
their_entry
.
id
,
"452e4244b5d083ddf0460acf1ecc74db9dcfa11a"
);
cl_git_pass
(
git_status_file
(
&
status
,
repo
,
"modified_file"
));
...
...
@@ -605,15 +605,15 @@ void test_status_worktree__conflicted_item(void)
memset
(
&
their_entry
,
0x0
,
sizeof
(
git_index_entry
));
ancestor_entry
.
path
=
"modified_file"
;
git_oid_fromstr
(
&
ancestor_entry
.
o
id
,
git_oid_fromstr
(
&
ancestor_entry
.
id
,
"452e4244b5d083ddf0460acf1ecc74db9dcfa11a"
);
our_entry
.
path
=
"modified_file"
;
git_oid_fromstr
(
&
our_entry
.
o
id
,
git_oid_fromstr
(
&
our_entry
.
id
,
"452e4244b5d083ddf0460acf1ecc74db9dcfa11a"
);
their_entry
.
path
=
"modified_file"
;
git_oid_fromstr
(
&
their_entry
.
o
id
,
git_oid_fromstr
(
&
their_entry
.
id
,
"452e4244b5d083ddf0460acf1ecc74db9dcfa11a"
);
cl_git_pass
(
git_status_file
(
&
status
,
repo
,
"modified_file"
));
...
...
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