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
93954245
Commit
93954245
authored
Jan 27, 2014
by
Vicent Marti
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2075 from libgit2/cmn/leftover-oid
Leftover OID -> ID changes
parents
46e7fc18
a1bbc0ce
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
53 changed files
with
238 additions
and
238 deletions
+238
-238
examples/showindex.c
+1
-1
include/git2/diff.h
+3
-3
include/git2/index.h
+1
-1
include/git2/merge.h
+4
-4
include/git2/notes.h
+3
-3
include/git2/sys/commit.h
+1
-1
include/git2/tree.h
+3
-3
src/attr.c
+2
-2
src/checkout.c
+11
-11
src/commit.c
+2
-2
src/crlf.c
+1
-1
src/diff.c
+23
-23
src/diff.h
+1
-1
src/diff_file.c
+13
-13
src/diff_patch.c
+5
-5
src/diff_print.c
+8
-8
src/diff_tform.c
+14
-14
src/index.c
+9
-9
src/iterator.c
+1
-1
src/merge.c
+16
-16
src/merge_file.c
+2
-2
src/notes.c
+4
-4
src/notes.h
+1
-1
src/reset.c
+1
-1
src/status.c
+9
-9
src/submodule.c
+6
-6
src/tree.c
+4
-4
tests/attr/repo.c
+1
-1
tests/checkout/conflict.c
+1
-1
tests/checkout/crlf.c
+2
-2
tests/checkout/index.c
+2
-2
tests/checkout/tree.c
+3
-3
tests/diff/blob.c
+16
-16
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/fastforward.c
+5
-5
tests/merge/workdir/setup.c
+0
-0
tests/merge/workdir/simple.c
+6
-6
tests/merge/workdir/trivial.c
+2
-2
tests/notes/notes.c
+2
-2
tests/notes/notesref.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 @
93954245
...
...
@@ -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/diff.h
View file @
93954245
...
...
@@ -203,7 +203,7 @@ typedef struct git_diff git_diff;
typedef
enum
{
GIT_DIFF_FLAG_BINARY
=
(
1u
<<
0
),
/** file(s) treated as binary data */
GIT_DIFF_FLAG_NOT_BINARY
=
(
1u
<<
1
),
/** file(s) treated as text data */
GIT_DIFF_FLAG_VALID_
OID
=
(
1u
<<
2
),
/** `o
id` value is known correct */
GIT_DIFF_FLAG_VALID_
ID
=
(
1u
<<
2
),
/** `
id` value is known correct */
}
git_diff_flag_t
;
/**
...
...
@@ -250,7 +250,7 @@ typedef enum {
* be restricted to one of the `git_filemode_t` values.
*/
typedef
struct
{
git_oid
o
id
;
git_oid
id
;
const
char
*
path
;
git_off_t
size
;
uint32_t
flags
;
...
...
@@ -361,7 +361,7 @@ typedef struct {
uint16_t
context_lines
;
/**< defaults to 3 */
uint16_t
interhunk_lines
;
/**< defaults to 0 */
uint16_t
o
id_abbrev
;
/**< default 'core.abbrev' or 7 if unset */
uint16_t
id_abbrev
;
/**< default 'core.abbrev' or 7 if unset */
git_off_t
max_size
;
/**< defaults to 512MB */
const
char
*
old_prefix
;
/**< defaults to "a" */
const
char
*
new_prefix
;
/**< defaults to "b" */
...
...
include/git2/index.h
View file @
93954245
...
...
@@ -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
;
...
...
include/git2/merge.h
View file @
93954245
...
...
@@ -160,13 +160,13 @@ GIT_EXTERN(int) git_merge_head_from_fetchhead(
*
* @param out pointer to store the git_merge_head result in
* @param repo repository that contains the given commit
* @param
o
id the commit object id to use as a merge input
* @param id the commit object id to use as a merge input
* @return zero on success, -1 on failure.
*/
GIT_EXTERN
(
int
)
git_merge_head_from_
o
id
(
GIT_EXTERN
(
int
)
git_merge_head_from_id
(
git_merge_head
**
out
,
git_repository
*
repo
,
const
git_oid
*
o
id
);
const
git_oid
*
id
);
/**
* Frees a `git_merge_head`
...
...
@@ -251,7 +251,7 @@ GIT_EXTERN(int) git_merge_result_is_fastforward(git_merge_result *merge_result);
* @param out the OID of the fast-forward
* @param merge_result the results of the merge
*/
GIT_EXTERN
(
int
)
git_merge_result_fastforward_
o
id
(
git_oid
*
out
,
git_merge_result
*
merge_result
);
GIT_EXTERN
(
int
)
git_merge_result_fastforward_id
(
git_oid
*
out
,
git_merge_result
*
merge_result
);
GIT_EXTERN
(
void
)
git_merge_result_free
(
git_merge_result
*
merge_result
);
...
...
include/git2/notes.h
View file @
93954245
...
...
@@ -106,12 +106,12 @@ GIT_EXTERN(const char *) git_note_message(const git_note *note);
/**
* Get the note object
OID
* Get the note object
's id
*
* @param note the note
* @return the note object
OID
* @return the note object
's id
*/
GIT_EXTERN
(
const
git_oid
*
)
git_note_
o
id
(
const
git_note
*
note
);
GIT_EXTERN
(
const
git_oid
*
)
git_note_id
(
const
git_note
*
note
);
/**
* Add a note for an object
...
...
include/git2/sys/commit.h
View file @
93954245
...
...
@@ -29,7 +29,7 @@ GIT_BEGIN_DECL
* the `tree`, neither the `parents` list of `git_oid`s are checked for
* validity.
*/
GIT_EXTERN
(
int
)
git_commit_create_from_
o
ids
(
GIT_EXTERN
(
int
)
git_commit_create_from_ids
(
git_oid
*
oid
,
git_repository
*
repo
,
const
char
*
update_ref
,
...
...
include/git2/tree.h
View file @
93954245
...
...
@@ -121,11 +121,11 @@ GIT_EXTERN(const git_tree_entry *) git_tree_entry_byindex(
* Warning: this must examine every entry in the tree, so it is not fast.
*
* @param tree a previously loaded tree.
* @param
o
id the sha being looked for
* @param id the sha being looked for
* @return the tree entry; NULL if not found
*/
GIT_EXTERN
(
const
git_tree_entry
*
)
git_tree_entry_by
o
id
(
const
git_tree
*
tree
,
const
git_oid
*
o
id
);
GIT_EXTERN
(
const
git_tree_entry
*
)
git_tree_entry_byid
(
const
git_tree
*
tree
,
const
git_oid
*
id
);
/**
* Retrieve a tree entry contained in a tree or in any of its subtrees,
...
...
src/attr.c
View file @
93954245
...
...
@@ -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 @
93954245
...
...
@@ -92,10 +92,10 @@ static int checkout_notify(
if
(
wditem
)
{
memset
(
&
wdfile
,
0
,
sizeof
(
wdfile
));
git_oid_cpy
(
&
wdfile
.
oid
,
&
wditem
->
o
id
);
git_oid_cpy
(
&
wdfile
.
id
,
&
wditem
->
id
);
wdfile
.
path
=
wditem
->
path
;
wdfile
.
size
=
wditem
->
file_size
;
wdfile
.
flags
=
GIT_DIFF_FLAG_VALID_
O
ID
;
wdfile
.
flags
=
GIT_DIFF_FLAG_VALID_ID
;
wdfile
.
mode
=
wditem
->
mode
;
workdir
=
&
wdfile
;
...
...
@@ -159,7 +159,7 @@ static bool checkout_is_workdir_modified(
if
(
!
sm_oid
)
return
false
;
return
(
git_oid__cmp
(
&
baseitem
->
o
id
,
sm_oid
)
!=
0
);
return
(
git_oid__cmp
(
&
baseitem
->
id
,
sm_oid
)
!=
0
);
}
/* Look at the cache to decide if the workdir is modified. If not,
...
...
@@ -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
->
id
,
&
ie
->
id
)
!=
0
);
}
/* depending on where base is coming from, we may or may not know
...
...
@@ -184,7 +184,7 @@ static bool checkout_is_workdir_modified(
wditem
->
file_size
,
&
oid
)
<
0
)
return
false
;
return
(
git_oid__cmp
(
&
baseitem
->
o
id
,
&
oid
)
!=
0
);
return
(
git_oid__cmp
(
&
baseitem
->
id
,
&
oid
)
!=
0
);
}
#define CHECKOUT_ACTION_IF(FLAG,YES,NO) \
...
...
@@ -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
.
oid
,
&
file
->
o
id
);
git_oid_cpy
(
&
entry
.
id
,
&
file
->
id
);
return
git_index_add
(
data
->
index
,
&
entry
);
}
...
...
@@ -1378,7 +1378,7 @@ static int checkout_blob(
}
error
=
checkout_write_content
(
data
,
&
file
->
o
id
,
git_buf_cstr
(
&
data
->
path
),
NULL
,
file
->
mode
,
&
st
);
data
,
&
file
->
id
,
git_buf_cstr
(
&
data
->
path
),
NULL
,
file
->
mode
,
&
st
);
/* update the index unless prevented */
if
(
!
error
&&
(
data
->
strategy
&
GIT_CHECKOUT_DONT_UPDATE_INDEX
)
==
0
)
...
...
@@ -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/commit.c
View file @
93954245
...
...
@@ -69,7 +69,7 @@ int git_commit_create_v(
return
res
;
}
int
git_commit_create_from_
o
ids
(
int
git_commit_create_from_ids
(
git_oid
*
oid
,
git_repository
*
repo
,
const
char
*
update_ref
,
...
...
@@ -148,7 +148,7 @@ int git_commit_create(
parent_oids
[
i
]
=
git_object_id
((
const
git_object
*
)
parents
[
i
]);
}
retval
=
git_commit_create_from_
o
ids
(
retval
=
git_commit_create_from_ids
(
oid
,
repo
,
update_ref
,
author
,
committer
,
message_encoding
,
message
,
git_object_id
((
const
git_object
*
)
tree
),
parent_count
,
parent_oids
);
...
...
src/crlf.c
View file @
93954245
...
...
@@ -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 @
93954245
...
...
@@ -110,18 +110,18 @@ 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
.
id
,
&
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
.
id
,
&
entry
->
id
);
}
delta
->
old_file
.
flags
|=
GIT_DIFF_FLAG_VALID_
O
ID
;
delta
->
old_file
.
flags
|=
GIT_DIFF_FLAG_VALID_ID
;
if
(
delta
->
status
==
GIT_DELTA_DELETED
||
!
git_oid_iszero
(
&
delta
->
new_file
.
o
id
))
delta
->
new_file
.
flags
|=
GIT_DIFF_FLAG_VALID_
O
ID
;
!
git_oid_iszero
(
&
delta
->
new_file
.
id
))
delta
->
new_file
.
flags
|=
GIT_DIFF_FLAG_VALID_ID
;
return
diff_insert_delta
(
diff
,
delta
,
matched_pathspec
);
}
...
...
@@ -156,24 +156,24 @@ 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
.
id
,
&
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_
O
ID
;
delta
->
old_file
.
flags
|=
GIT_DIFF_FLAG_VALID_ID
;
git_oid_cpy
(
&
delta
->
new_file
.
oid
,
&
new_entry
->
o
id
);
git_oid_cpy
(
&
delta
->
new_file
.
id
,
&
new_entry
->
id
);
delta
->
new_file
.
size
=
new_entry
->
file_size
;
delta
->
new_file
.
mode
=
new_mode
;
if
(
new_oid
)
{
if
(
DIFF_FLAG_IS_SET
(
diff
,
GIT_DIFF_REVERSE
))
git_oid_cpy
(
&
delta
->
old_file
.
o
id
,
new_oid
);
git_oid_cpy
(
&
delta
->
old_file
.
id
,
new_oid
);
else
git_oid_cpy
(
&
delta
->
new_file
.
o
id
,
new_oid
);
git_oid_cpy
(
&
delta
->
new_file
.
id
,
new_oid
);
}
if
(
new_oid
||
!
git_oid_iszero
(
&
new_entry
->
o
id
))
delta
->
new_file
.
flags
|=
GIT_DIFF_FLAG_VALID_
O
ID
;
if
(
new_oid
||
!
git_oid_iszero
(
&
new_entry
->
id
))
delta
->
new_file
.
flags
|=
GIT_DIFF_FLAG_VALID_ID
;
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
.
id
,
&
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
.
id
,
&
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
.
id
,
&
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
.
id
,
&
item
->
id
)
==
0
||
git_oid__cmp
(
&
delta
->
new_file
.
id
,
&
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/diff.h
View file @
93954245
...
...
@@ -134,7 +134,7 @@ GIT_INLINE(int) git_diff_file__resolve_zero_size(
return
error
;
error
=
git_odb__read_header_or_object
(
odb_obj
,
&
len
,
&
type
,
odb
,
&
file
->
o
id
);
odb_obj
,
&
len
,
&
type
,
odb
,
&
file
->
id
);
git_odb_free
(
odb
);
...
...
src/diff_file.c
View file @
93954245
...
...
@@ -143,10 +143,10 @@ int git_diff_file_content__init_from_blob(
fc
->
flags
|=
GIT_DIFF_FLAG__NO_DATA
;
}
else
{
fc
->
flags
|=
GIT_DIFF_FLAG__LOADED
;
fc
->
file
->
flags
|=
GIT_DIFF_FLAG_VALID_
O
ID
;
fc
->
file
->
flags
|=
GIT_DIFF_FLAG_VALID_ID
;
fc
->
file
->
size
=
git_blob_rawsize
(
blob
);
fc
->
file
->
mode
=
GIT_FILEMODE_BLOB
;
git_oid_cpy
(
&
fc
->
file
->
o
id
,
git_blob_id
(
blob
));
git_oid_cpy
(
&
fc
->
file
->
id
,
git_blob_id
(
blob
));
fc
->
map
.
len
=
(
size_t
)
fc
->
file
->
size
;
fc
->
map
.
data
=
(
char
*
)
git_blob_rawcontent
(
blob
);
...
...
@@ -171,10 +171,10 @@ int git_diff_file_content__init_from_raw(
fc
->
flags
|=
GIT_DIFF_FLAG__NO_DATA
;
}
else
{
fc
->
flags
|=
GIT_DIFF_FLAG__LOADED
;
fc
->
file
->
flags
|=
GIT_DIFF_FLAG_VALID_
O
ID
;
fc
->
file
->
flags
|=
GIT_DIFF_FLAG_VALID_ID
;
fc
->
file
->
size
=
buflen
;
fc
->
file
->
mode
=
GIT_FILEMODE_BLOB
;
git_odb_hash
(
&
fc
->
file
->
o
id
,
buf
,
buflen
,
GIT_OBJ_BLOB
);
git_odb_hash
(
&
fc
->
file
->
id
,
buf
,
buflen
,
GIT_OBJ_BLOB
);
fc
->
map
.
len
=
buflen
;
fc
->
map
.
data
=
(
char
*
)
buf
;
...
...
@@ -205,19 +205,19 @@ static int diff_file_content_commit_to_str(
}
/* update OID if we didn't have it previously */
if
((
fc
->
file
->
flags
&
GIT_DIFF_FLAG_VALID_
O
ID
)
==
0
&&
if
((
fc
->
file
->
flags
&
GIT_DIFF_FLAG_VALID_ID
)
==
0
&&
((
sm_head
=
git_submodule_wd_id
(
sm
))
!=
NULL
||
(
sm_head
=
git_submodule_head_id
(
sm
))
!=
NULL
))
{
git_oid_cpy
(
&
fc
->
file
->
o
id
,
sm_head
);
fc
->
file
->
flags
|=
GIT_DIFF_FLAG_VALID_
O
ID
;
git_oid_cpy
(
&
fc
->
file
->
id
,
sm_head
);
fc
->
file
->
flags
|=
GIT_DIFF_FLAG_VALID_ID
;
}
if
(
GIT_SUBMODULE_STATUS_IS_WD_DIRTY
(
sm_status
))
status
=
"-dirty"
;
}
git_oid_tostr
(
oid
,
sizeof
(
oid
),
&
fc
->
file
->
o
id
);
git_oid_tostr
(
oid
,
sizeof
(
oid
),
&
fc
->
file
->
id
);
if
(
git_buf_printf
(
&
content
,
"Subproject commit %s%s
\n
"
,
oid
,
status
)
<
0
)
return
-
1
;
...
...
@@ -233,7 +233,7 @@ static int diff_file_content_load_blob(git_diff_file_content *fc)
int
error
=
0
;
git_odb_object
*
odb_obj
=
NULL
;
if
(
git_oid_iszero
(
&
fc
->
file
->
o
id
))
if
(
git_oid_iszero
(
&
fc
->
file
->
id
))
return
0
;
if
(
fc
->
file
->
mode
==
GIT_FILEMODE_COMMIT
)
...
...
@@ -255,7 +255,7 @@ static int diff_file_content_load_blob(git_diff_file_content *fc)
git_odb_object_free
(
odb_obj
);
}
else
{
error
=
git_blob_lookup
(
(
git_blob
**
)
&
fc
->
blob
,
fc
->
repo
,
&
fc
->
file
->
o
id
);
(
git_blob
**
)
&
fc
->
blob
,
fc
->
repo
,
&
fc
->
file
->
id
);
}
if
(
!
error
)
{
...
...
@@ -368,10 +368,10 @@ static int diff_file_content_load_workdir(git_diff_file_content *fc)
error
=
diff_file_content_load_workdir_file
(
fc
,
&
path
);
/* once data is loaded, update OID if we didn't have it previously */
if
(
!
error
&&
(
fc
->
file
->
flags
&
GIT_DIFF_FLAG_VALID_
O
ID
)
==
0
)
{
if
(
!
error
&&
(
fc
->
file
->
flags
&
GIT_DIFF_FLAG_VALID_ID
)
==
0
)
{
error
=
git_odb_hash
(
&
fc
->
file
->
o
id
,
fc
->
map
.
data
,
fc
->
map
.
len
,
GIT_OBJ_BLOB
);
fc
->
file
->
flags
|=
GIT_DIFF_FLAG_VALID_
O
ID
;
&
fc
->
file
->
id
,
fc
->
map
.
data
,
fc
->
map
.
len
,
GIT_OBJ_BLOB
);
fc
->
file
->
flags
|=
GIT_DIFF_FLAG_VALID_ID
;
}
git_buf_free
(
&
path
);
...
...
src/diff_patch.c
View file @
93954245
...
...
@@ -133,9 +133,9 @@ static int diff_patch_load(git_patch *patch, git_diff_output *output)
incomplete_data
=
(((
patch
->
ofile
.
flags
&
GIT_DIFF_FLAG__NO_DATA
)
!=
0
||
(
patch
->
ofile
.
file
->
flags
&
GIT_DIFF_FLAG_VALID_
O
ID
)
!=
0
)
&&
(
patch
->
ofile
.
file
->
flags
&
GIT_DIFF_FLAG_VALID_ID
)
!=
0
)
&&
((
patch
->
nfile
.
flags
&
GIT_DIFF_FLAG__NO_DATA
)
!=
0
||
(
patch
->
nfile
.
file
->
flags
&
GIT_DIFF_FLAG_VALID_
O
ID
)
!=
0
));
(
patch
->
nfile
.
file
->
flags
&
GIT_DIFF_FLAG_VALID_ID
)
!=
0
));
/* always try to load workdir content first because filtering may
* need 2x data size and this minimizes peak memory footprint
...
...
@@ -169,7 +169,7 @@ static int diff_patch_load(git_patch *patch, git_diff_output *output)
if
(
incomplete_data
&&
patch
->
ofile
.
file
->
mode
==
patch
->
nfile
.
file
->
mode
&&
patch
->
ofile
.
file
->
mode
!=
GIT_FILEMODE_COMMIT
&&
git_oid_equal
(
&
patch
->
ofile
.
file
->
oid
,
&
patch
->
nfile
.
file
->
o
id
)
&&
git_oid_equal
(
&
patch
->
ofile
.
file
->
id
,
&
patch
->
nfile
.
file
->
id
)
&&
patch
->
delta
->
status
==
GIT_DELTA_MODIFIED
)
/* not RENAMED/COPIED! */
patch
->
delta
->
status
=
GIT_DELTA_UNMODIFIED
;
...
...
@@ -184,7 +184,7 @@ cleanup:
patch
->
delta
->
status
!=
GIT_DELTA_UNMODIFIED
&&
(
patch
->
ofile
.
map
.
len
||
patch
->
nfile
.
map
.
len
)
&&
(
patch
->
ofile
.
map
.
len
!=
patch
->
nfile
.
map
.
len
||
!
git_oid_equal
(
&
patch
->
ofile
.
file
->
oid
,
&
patch
->
nfile
.
file
->
o
id
)))
!
git_oid_equal
(
&
patch
->
ofile
.
file
->
id
,
&
patch
->
nfile
.
file
->
id
)))
patch
->
flags
|=
GIT_DIFF_PATCH_DIFFABLE
;
patch
->
flags
|=
GIT_DIFF_PATCH_LOADED
;
...
...
@@ -315,7 +315,7 @@ static int diff_single_generate(diff_patch_with_delta *pd, git_xdiff_output *xo)
(
has_old
?
GIT_DELTA_MODIFIED
:
GIT_DELTA_ADDED
)
:
(
has_old
?
GIT_DELTA_DELETED
:
GIT_DELTA_UNTRACKED
);
if
(
git_oid_equal
(
&
patch
->
nfile
.
file
->
oid
,
&
patch
->
ofile
.
file
->
o
id
))
if
(
git_oid_equal
(
&
patch
->
nfile
.
file
->
id
,
&
patch
->
ofile
.
file
->
id
))
pd
->
delta
.
status
=
GIT_DELTA_UNMODIFIED
;
patch
->
delta
=
&
pd
->
delta
;
...
...
src/diff_print.c
View file @
93954245
...
...
@@ -37,8 +37,8 @@ static int diff_print_info_init(
if
(
diff
)
pi
->
flags
=
diff
->
opts
.
flags
;
if
(
diff
&&
diff
->
opts
.
o
id_abbrev
!=
0
)
pi
->
oid_strlen
=
diff
->
opts
.
o
id_abbrev
;
if
(
diff
&&
diff
->
opts
.
id_abbrev
!=
0
)
pi
->
oid_strlen
=
diff
->
opts
.
id_abbrev
;
else
if
(
!
diff
||
!
diff
->
repo
)
pi
->
oid_strlen
=
GIT_ABBREV_DEFAULT
;
else
if
(
git_repository__cvar
(
...
...
@@ -170,8 +170,8 @@ static int diff_print_one_raw(
git_buf_clear
(
out
);
git_oid_tostr
(
start_oid
,
pi
->
oid_strlen
,
&
delta
->
old_file
.
o
id
);
git_oid_tostr
(
end_oid
,
pi
->
oid_strlen
,
&
delta
->
new_file
.
o
id
);
git_oid_tostr
(
start_oid
,
pi
->
oid_strlen
,
&
delta
->
old_file
.
id
);
git_oid_tostr
(
end_oid
,
pi
->
oid_strlen
,
&
delta
->
new_file
.
id
);
git_buf_printf
(
out
,
":%06o %06o %s... %s... %c"
,
...
...
@@ -203,8 +203,8 @@ static int diff_print_oid_range(
{
char
start_oid
[
GIT_OID_HEXSZ
+
1
],
end_oid
[
GIT_OID_HEXSZ
+
1
];
git_oid_tostr
(
start_oid
,
oid_strlen
,
&
delta
->
old_file
.
o
id
);
git_oid_tostr
(
end_oid
,
oid_strlen
,
&
delta
->
new_file
.
o
id
);
git_oid_tostr
(
start_oid
,
oid_strlen
,
&
delta
->
old_file
.
id
);
git_oid_tostr
(
end_oid
,
oid_strlen
,
&
delta
->
new_file
.
id
);
/* TODO: Match git diff more closely */
if
(
delta
->
old_file
.
mode
==
delta
->
new_file
.
mode
)
{
...
...
@@ -235,11 +235,11 @@ static int diff_delta_format_with_paths(
const
char
*
oldpath
=
delta
->
old_file
.
path
;
const
char
*
newpath
=
delta
->
new_file
.
path
;
if
(
git_oid_iszero
(
&
delta
->
old_file
.
o
id
))
{
if
(
git_oid_iszero
(
&
delta
->
old_file
.
id
))
{
oldpfx
=
""
;
oldpath
=
"/dev/null"
;
}
if
(
git_oid_iszero
(
&
delta
->
new_file
.
o
id
))
{
if
(
git_oid_iszero
(
&
delta
->
new_file
.
id
))
{
newpfx
=
""
;
newpath
=
"/dev/null"
;
}
...
...
src/diff_tform.c
View file @
93954245
...
...
@@ -91,7 +91,7 @@ static git_diff_delta *diff_delta__merge_like_cgit(
dup
->
status
=
a
->
status
;
}
git_oid_cpy
(
&
dup
->
old_file
.
oid
,
&
a
->
old_file
.
o
id
);
git_oid_cpy
(
&
dup
->
old_file
.
id
,
&
a
->
old_file
.
id
);
dup
->
old_file
.
mode
=
a
->
old_file
.
mode
;
dup
->
old_file
.
size
=
a
->
old_file
.
size
;
dup
->
old_file
.
flags
=
a
->
old_file
.
flags
;
...
...
@@ -124,7 +124,7 @@ static git_diff_delta *diff_delta__merge_like_cgit_reversed(
dup
->
status
=
b
->
status
;
}
git_oid_cpy
(
&
dup
->
old_file
.
oid
,
&
b
->
old_file
.
o
id
);
git_oid_cpy
(
&
dup
->
old_file
.
id
,
&
b
->
old_file
.
id
);
dup
->
old_file
.
mode
=
b
->
old_file
.
mode
;
dup
->
old_file
.
size
=
b
->
old_file
.
size
;
dup
->
old_file
.
flags
=
b
->
old_file
.
flags
;
...
...
@@ -375,7 +375,7 @@ static int insert_delete_side_of_split(
deleted
->
nfiles
=
1
;
memset
(
&
deleted
->
new_file
,
0
,
sizeof
(
deleted
->
new_file
));
deleted
->
new_file
.
path
=
deleted
->
old_file
.
path
;
deleted
->
new_file
.
flags
|=
GIT_DIFF_FLAG_VALID_
O
ID
;
deleted
->
new_file
.
flags
|=
GIT_DIFF_FLAG_VALID_ID
;
return
git_vector_insert
(
onto
,
deleted
);
}
...
...
@@ -408,7 +408,7 @@ static int apply_splits_and_deletes(
delta
->
nfiles
=
1
;
memset
(
&
delta
->
old_file
,
0
,
sizeof
(
delta
->
old_file
));
delta
->
old_file
.
path
=
delta
->
new_file
.
path
;
delta
->
old_file
.
flags
|=
GIT_DIFF_FLAG_VALID_
O
ID
;
delta
->
old_file
.
flags
|=
GIT_DIFF_FLAG_VALID_ID
;
}
/* clean up delta before inserting into new list */
...
...
@@ -510,7 +510,7 @@ static int similarity_sig(
(
git_object
**
)
&
info
->
blob
,
info
->
repo
,
info
->
odb_obj
,
GIT_OBJ_BLOB
);
else
error
=
git_blob_lookup
(
&
info
->
blob
,
info
->
repo
,
&
file
->
o
id
);
error
=
git_blob_lookup
(
&
info
->
blob
,
info
->
repo
,
&
file
->
id
);
if
(
error
<
0
)
{
/* if lookup fails, just skip this item in similarity calc */
...
...
@@ -572,21 +572,21 @@ static int similarity_measure(
/* if exact match is requested, force calculation of missing OIDs now */
if
(
exact_match
)
{
if
(
git_oid_iszero
(
&
a_file
->
o
id
)
&&
if
(
git_oid_iszero
(
&
a_file
->
id
)
&&
diff
->
old_src
==
GIT_ITERATOR_TYPE_WORKDIR
&&
!
git_diff__oid_for_file
(
diff
->
repo
,
a_file
->
path
,
a_file
->
mode
,
a_file
->
size
,
&
a_file
->
o
id
))
a_file
->
flags
|=
GIT_DIFF_FLAG_VALID_
O
ID
;
a_file
->
mode
,
a_file
->
size
,
&
a_file
->
id
))
a_file
->
flags
|=
GIT_DIFF_FLAG_VALID_ID
;
if
(
git_oid_iszero
(
&
b_file
->
o
id
)
&&
if
(
git_oid_iszero
(
&
b_file
->
id
)
&&
diff
->
new_src
==
GIT_ITERATOR_TYPE_WORKDIR
&&
!
git_diff__oid_for_file
(
diff
->
repo
,
b_file
->
path
,
b_file
->
mode
,
b_file
->
size
,
&
b_file
->
o
id
))
b_file
->
flags
|=
GIT_DIFF_FLAG_VALID_
O
ID
;
b_file
->
mode
,
b_file
->
size
,
&
b_file
->
id
))
b_file
->
flags
|=
GIT_DIFF_FLAG_VALID_ID
;
}
/* check OID match as a quick test */
if
(
git_oid__cmp
(
&
a_file
->
oid
,
&
b_file
->
o
id
)
==
0
)
{
if
(
git_oid__cmp
(
&
a_file
->
id
,
&
b_file
->
id
)
==
0
)
{
*
score
=
100
;
return
0
;
}
...
...
@@ -999,7 +999,7 @@ find_best_matches:
memcpy
(
&
src
->
old_file
,
&
swap
,
sizeof
(
src
->
old_file
));
memset
(
&
src
->
new_file
,
0
,
sizeof
(
src
->
new_file
));
src
->
new_file
.
path
=
src
->
old_file
.
path
;
src
->
new_file
.
flags
|=
GIT_DIFF_FLAG_VALID_
O
ID
;
src
->
new_file
.
flags
|=
GIT_DIFF_FLAG_VALID_ID
;
num_updates
++
;
...
...
@@ -1024,7 +1024,7 @@ find_best_matches:
src
->
nfiles
=
1
;
memset
(
&
src
->
old_file
,
0
,
sizeof
(
src
->
old_file
));
src
->
old_file
.
path
=
src
->
new_file
.
path
;
src
->
old_file
.
flags
|=
GIT_DIFF_FLAG_VALID_
O
ID
;
src
->
old_file
.
flags
|=
GIT_DIFF_FLAG_VALID_ID
;
src
->
flags
&=
~
GIT_DIFF_FLAG__TO_SPLIT
;
num_rewrites
--
;
...
...
src/index.c
View file @
93954245
...
...
@@ -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 @
93954245
...
...
@@ -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 @
93954245
...
...
@@ -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
.
id
,
&
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
]);
...
...
@@ -2111,7 +2111,7 @@ static int merge_ancestor_head(
if
((
error
=
git_merge_base_many
(
&
ancestor_oid
,
repo
,
their_heads_len
+
1
,
oids
))
<
0
)
goto
on_error
;
error
=
git_merge_head_from_
o
id
(
ancestor_head
,
repo
,
&
ancestor_oid
);
error
=
git_merge_head_from_id
(
ancestor_head
,
repo
,
&
ancestor_oid
);
on_error:
git__free
(
oids
);
...
...
@@ -2615,7 +2615,7 @@ int git_merge_result_is_fastforward(git_merge_result *merge_result)
return
merge_result
->
is_fastforward
;
}
int
git_merge_result_fastforward_
o
id
(
git_oid
*
out
,
git_merge_result
*
merge_result
)
int
git_merge_result_fastforward_id
(
git_oid
*
out
,
git_merge_result
*
merge_result
)
{
assert
(
out
&&
merge_result
);
...
...
@@ -2699,7 +2699,7 @@ int git_merge_head_from_ref(
return
error
;
}
int
git_merge_head_from_
o
id
(
int
git_merge_head_from_id
(
git_merge_head
**
out
,
git_repository
*
repo
,
const
git_oid
*
oid
)
...
...
src/merge_file.c
View file @
93954245
...
...
@@ -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
;
...
...
@@ -108,7 +108,7 @@ int git_merge_file_input_from_diff_file(
return
0
;
if
((
error
=
git_repository_odb
(
&
odb
,
repo
))
<
0
||
(
error
=
git_odb_read
(
&
input
->
odb_object
,
odb
,
&
file
->
o
id
))
<
0
)
(
error
=
git_odb_read
(
&
input
->
odb_object
,
odb
,
&
file
->
id
))
<
0
)
goto
done
;
input
->
mode
=
file
->
mode
;
...
...
src/notes.c
View file @
93954245
...
...
@@ -313,7 +313,7 @@ static int note_new(git_note **out, git_oid *note_oid, git_blob *blob)
note
=
(
git_note
*
)
git__malloc
(
sizeof
(
git_note
));
GITERR_CHECK_ALLOC
(
note
);
git_oid_cpy
(
&
note
->
o
id
,
note_oid
);
git_oid_cpy
(
&
note
->
id
,
note_oid
);
note
->
message
=
git__strdup
((
char
*
)
git_blob_rawcontent
(
blob
));
GITERR_CHECK_ALLOC
(
note
->
message
);
...
...
@@ -508,10 +508,10 @@ const char * git_note_message(const git_note *note)
return
note
->
message
;
}
const
git_oid
*
git_note_
o
id
(
const
git_note
*
note
)
const
git_oid
*
git_note_id
(
const
git_note
*
note
)
{
assert
(
note
);
return
&
note
->
o
id
;
return
&
note
->
id
;
}
void
git_note_free
(
git_note
*
note
)
...
...
@@ -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/notes.h
View file @
93954245
...
...
@@ -21,7 +21,7 @@
"Notes removed by 'git_note_remove' from libgit2"
struct
git_note
{
git_oid
o
id
;
git_oid
id
;
char
*
message
;
};
...
...
src/reset.c
View file @
93954245
...
...
@@ -72,7 +72,7 @@ int git_reset_default(
goto
cleanup
;
}
else
{
entry
.
mode
=
delta
->
new_file
.
mode
;
git_oid_cpy
(
&
entry
.
oid
,
&
delta
->
new_file
.
o
id
);
git_oid_cpy
(
&
entry
.
id
,
&
delta
->
new_file
.
id
);
entry
.
path
=
(
char
*
)
delta
->
new_file
.
path
;
if
((
error
=
git_index_add
(
index
,
&
entry
))
<
0
)
...
...
src/status.c
View file @
93954245
...
...
@@ -38,7 +38,7 @@ static unsigned int index_delta2status(const git_diff_delta *head2idx)
case
GIT_DELTA_RENAMED
:
st
=
GIT_STATUS_INDEX_RENAMED
;
if
(
!
git_oid_equal
(
&
head2idx
->
old_file
.
oid
,
&
head2idx
->
new_file
.
o
id
))
if
(
!
git_oid_equal
(
&
head2idx
->
old_file
.
id
,
&
head2idx
->
new_file
.
id
))
st
|=
GIT_STATUS_INDEX_MODIFIED
;
break
;
case
GIT_DELTA_TYPECHANGE
:
...
...
@@ -74,25 +74,25 @@ static unsigned int workdir_delta2status(
case
GIT_DELTA_RENAMED
:
st
=
GIT_STATUS_WT_RENAMED
;
if
(
!
git_oid_equal
(
&
idx2wd
->
old_file
.
oid
,
&
idx2wd
->
new_file
.
o
id
))
{
if
(
!
git_oid_equal
(
&
idx2wd
->
old_file
.
id
,
&
idx2wd
->
new_file
.
id
))
{
/* if OIDs don't match, we might need to calculate them now to
* discern between RENAMED vs RENAMED+MODIFED
*/
if
(
git_oid_iszero
(
&
idx2wd
->
old_file
.
o
id
)
&&
if
(
git_oid_iszero
(
&
idx2wd
->
old_file
.
id
)
&&
diff
->
old_src
==
GIT_ITERATOR_TYPE_WORKDIR
&&
!
git_diff__oid_for_file
(
diff
->
repo
,
idx2wd
->
old_file
.
path
,
idx2wd
->
old_file
.
mode
,
idx2wd
->
old_file
.
size
,
&
idx2wd
->
old_file
.
o
id
))
idx2wd
->
old_file
.
flags
|=
GIT_DIFF_FLAG_VALID_
O
ID
;
idx2wd
->
old_file
.
size
,
&
idx2wd
->
old_file
.
id
))
idx2wd
->
old_file
.
flags
|=
GIT_DIFF_FLAG_VALID_ID
;
if
(
git_oid_iszero
(
&
idx2wd
->
new_file
.
o
id
)
&&
if
(
git_oid_iszero
(
&
idx2wd
->
new_file
.
id
)
&&
diff
->
new_src
==
GIT_ITERATOR_TYPE_WORKDIR
&&
!
git_diff__oid_for_file
(
diff
->
repo
,
idx2wd
->
new_file
.
path
,
idx2wd
->
new_file
.
mode
,
idx2wd
->
new_file
.
size
,
&
idx2wd
->
new_file
.
o
id
))
idx2wd
->
new_file
.
flags
|=
GIT_DIFF_FLAG_VALID_
O
ID
;
idx2wd
->
new_file
.
size
,
&
idx2wd
->
new_file
.
id
))
idx2wd
->
new_file
.
flags
|=
GIT_DIFF_FLAG_VALID_ID
;
if
(
!
git_oid_equal
(
&
idx2wd
->
old_file
.
oid
,
&
idx2wd
->
new_file
.
o
id
))
if
(
!
git_oid_equal
(
&
idx2wd
->
old_file
.
id
,
&
idx2wd
->
new_file
.
id
))
st
|=
GIT_STATUS_WT_MODIFIED
;
}
break
;
...
...
src/submodule.c
View file @
93954245
...
...
@@ -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 @
93954245
...
...
@@ -305,8 +305,8 @@ const git_tree_entry *git_tree_entry_byindex(
return
git_vector_get
(
&
tree
->
entries
,
idx
);
}
const
git_tree_entry
*
git_tree_entry_by
o
id
(
const
git_tree
*
tree
,
const
git_oid
*
o
id
)
const
git_tree_entry
*
git_tree_entry_byid
(
const
git_tree
*
tree
,
const
git_oid
*
id
)
{
size_t
i
;
const
git_tree_entry
*
e
;
...
...
@@ -314,7 +314,7 @@ const git_tree_entry *git_tree_entry_byoid(
assert
(
tree
);
git_vector_foreach
(
&
tree
->
entries
,
i
,
e
)
{
if
(
memcmp
(
&
e
->
oid
.
id
,
&
oid
->
id
,
sizeof
(
o
id
->
id
))
==
0
)
if
(
memcmp
(
&
e
->
oid
.
id
,
&
id
->
id
,
sizeof
(
id
->
id
))
==
0
)
return
e
;
}
...
...
@@ -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 @
93954245
...
...
@@ -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 @
93954245
...
...
@@ -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 @
93954245
...
...
@@ -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/index.c
View file @
93954245
...
...
@@ -307,8 +307,8 @@ static int test_checkout_notify_cb(
cl_assert_equal_i
(
GIT_CHECKOUT_NOTIFY_CONFLICT
,
why
);
cl_assert_equal_s
(
expectations
->
file
,
path
);
cl_assert_equal_i
(
0
,
git_oid_streq
(
&
baseline
->
o
id
,
expectations
->
sha
));
cl_assert_equal_i
(
0
,
git_oid_streq
(
&
target
->
o
id
,
expectations
->
sha
));
cl_assert_equal_i
(
0
,
git_oid_streq
(
&
baseline
->
id
,
expectations
->
sha
));
cl_assert_equal_i
(
0
,
git_oid_streq
(
&
target
->
id
,
expectations
->
sha
));
return
0
;
}
...
...
tests/checkout/tree.c
View file @
93954245
...
...
@@ -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/blob.c
View file @
93954245
...
...
@@ -167,9 +167,9 @@ void test_diff_blob__can_compare_text_blobs_with_patch(void)
delta
=
git_patch_get_delta
(
p
);
cl_assert
(
delta
!=
NULL
);
cl_assert_equal_i
(
GIT_DELTA_MODIFIED
,
delta
->
status
);
cl_assert
(
git_oid_equal
(
git_blob_id
(
a
),
&
delta
->
old_file
.
o
id
));
cl_assert
(
git_oid_equal
(
git_blob_id
(
a
),
&
delta
->
old_file
.
id
));
cl_assert_equal_sz
(
git_blob_rawsize
(
a
),
delta
->
old_file
.
size
);
cl_assert
(
git_oid_equal
(
git_blob_id
(
b
),
&
delta
->
new_file
.
o
id
));
cl_assert
(
git_oid_equal
(
git_blob_id
(
b
),
&
delta
->
new_file
.
id
));
cl_assert_equal_sz
(
git_blob_rawsize
(
b
),
delta
->
new_file
.
size
);
cl_assert_equal_i
(
1
,
(
int
)
git_patch_num_hunks
(
p
));
...
...
@@ -190,9 +190,9 @@ void test_diff_blob__can_compare_text_blobs_with_patch(void)
delta
=
git_patch_get_delta
(
p
);
cl_assert
(
delta
!=
NULL
);
cl_assert_equal_i
(
GIT_DELTA_MODIFIED
,
delta
->
status
);
cl_assert
(
git_oid_equal
(
git_blob_id
(
b
),
&
delta
->
old_file
.
o
id
));
cl_assert
(
git_oid_equal
(
git_blob_id
(
b
),
&
delta
->
old_file
.
id
));
cl_assert_equal_sz
(
git_blob_rawsize
(
b
),
delta
->
old_file
.
size
);
cl_assert
(
git_oid_equal
(
git_blob_id
(
c
),
&
delta
->
new_file
.
o
id
));
cl_assert
(
git_oid_equal
(
git_blob_id
(
c
),
&
delta
->
new_file
.
id
));
cl_assert_equal_sz
(
git_blob_rawsize
(
c
),
delta
->
new_file
.
size
);
cl_assert_equal_i
(
1
,
(
int
)
git_patch_num_hunks
(
p
));
...
...
@@ -213,9 +213,9 @@ void test_diff_blob__can_compare_text_blobs_with_patch(void)
delta
=
git_patch_get_delta
(
p
);
cl_assert
(
delta
!=
NULL
);
cl_assert_equal_i
(
GIT_DELTA_MODIFIED
,
delta
->
status
);
cl_assert
(
git_oid_equal
(
git_blob_id
(
a
),
&
delta
->
old_file
.
o
id
));
cl_assert
(
git_oid_equal
(
git_blob_id
(
a
),
&
delta
->
old_file
.
id
));
cl_assert_equal_sz
(
git_blob_rawsize
(
a
),
delta
->
old_file
.
size
);
cl_assert
(
git_oid_equal
(
git_blob_id
(
c
),
&
delta
->
new_file
.
o
id
));
cl_assert
(
git_oid_equal
(
git_blob_id
(
c
),
&
delta
->
new_file
.
id
));
cl_assert_equal_sz
(
git_blob_rawsize
(
c
),
delta
->
new_file
.
size
);
cl_git_pass
(
git_patch_line_stats
(
&
tc
,
&
ta
,
&
td
,
p
));
...
...
@@ -233,9 +233,9 @@ void test_diff_blob__can_compare_text_blobs_with_patch(void)
delta
=
git_patch_get_delta
(
p
);
cl_assert
(
delta
!=
NULL
);
cl_assert_equal_i
(
GIT_DELTA_MODIFIED
,
delta
->
status
);
cl_assert
(
git_oid_equal
(
git_blob_id
(
c
),
&
delta
->
old_file
.
o
id
));
cl_assert
(
git_oid_equal
(
git_blob_id
(
c
),
&
delta
->
old_file
.
id
));
cl_assert_equal_sz
(
git_blob_rawsize
(
c
),
delta
->
old_file
.
size
);
cl_assert
(
git_oid_equal
(
git_blob_id
(
d
),
&
delta
->
new_file
.
o
id
));
cl_assert
(
git_oid_equal
(
git_blob_id
(
d
),
&
delta
->
new_file
.
id
));
cl_assert_equal_sz
(
git_blob_rawsize
(
d
),
delta
->
new_file
.
size
);
cl_assert_equal_i
(
2
,
(
int
)
git_patch_num_hunks
(
p
));
...
...
@@ -328,9 +328,9 @@ void test_diff_blob__can_compare_against_null_blobs_with_patch(void)
delta
=
git_patch_get_delta
(
p
);
cl_assert
(
delta
!=
NULL
);
cl_assert_equal_i
(
GIT_DELTA_DELETED
,
delta
->
status
);
cl_assert
(
git_oid_equal
(
git_blob_id
(
d
),
&
delta
->
old_file
.
o
id
));
cl_assert
(
git_oid_equal
(
git_blob_id
(
d
),
&
delta
->
old_file
.
id
));
cl_assert_equal_sz
(
git_blob_rawsize
(
d
),
delta
->
old_file
.
size
);
cl_assert
(
git_oid_iszero
(
&
delta
->
new_file
.
o
id
));
cl_assert
(
git_oid_iszero
(
&
delta
->
new_file
.
id
));
cl_assert_equal_sz
(
0
,
delta
->
new_file
.
size
);
cl_assert_equal_i
(
1
,
(
int
)
git_patch_num_hunks
(
p
));
...
...
@@ -353,9 +353,9 @@ void test_diff_blob__can_compare_against_null_blobs_with_patch(void)
delta
=
git_patch_get_delta
(
p
);
cl_assert
(
delta
!=
NULL
);
cl_assert_equal_i
(
GIT_DELTA_ADDED
,
delta
->
status
);
cl_assert
(
git_oid_iszero
(
&
delta
->
old_file
.
o
id
));
cl_assert
(
git_oid_iszero
(
&
delta
->
old_file
.
id
));
cl_assert_equal_sz
(
0
,
delta
->
old_file
.
size
);
cl_assert
(
git_oid_equal
(
git_blob_id
(
d
),
&
delta
->
new_file
.
o
id
));
cl_assert
(
git_oid_equal
(
git_blob_id
(
d
),
&
delta
->
new_file
.
id
));
cl_assert_equal_sz
(
git_blob_rawsize
(
d
),
delta
->
new_file
.
size
);
cl_assert_equal_i
(
1
,
(
int
)
git_patch_num_hunks
(
p
));
...
...
@@ -446,9 +446,9 @@ void test_diff_blob__can_compare_identical_blobs_with_patch(void)
cl_assert
(
delta
!=
NULL
);
cl_assert_equal_i
(
GIT_DELTA_UNMODIFIED
,
delta
->
status
);
cl_assert_equal_sz
(
delta
->
old_file
.
size
,
git_blob_rawsize
(
d
));
cl_assert
(
git_oid_equal
(
git_blob_id
(
d
),
&
delta
->
old_file
.
o
id
));
cl_assert
(
git_oid_equal
(
git_blob_id
(
d
),
&
delta
->
old_file
.
id
));
cl_assert_equal_sz
(
delta
->
new_file
.
size
,
git_blob_rawsize
(
d
));
cl_assert
(
git_oid_equal
(
git_blob_id
(
d
),
&
delta
->
new_file
.
o
id
));
cl_assert
(
git_oid_equal
(
git_blob_id
(
d
),
&
delta
->
new_file
.
id
));
cl_assert_equal_i
(
0
,
(
int
)
git_patch_num_hunks
(
p
));
git_patch_free
(
p
);
...
...
@@ -460,9 +460,9 @@ void test_diff_blob__can_compare_identical_blobs_with_patch(void)
cl_assert
(
delta
!=
NULL
);
cl_assert_equal_i
(
GIT_DELTA_UNMODIFIED
,
delta
->
status
);
cl_assert_equal_sz
(
0
,
delta
->
old_file
.
size
);
cl_assert
(
git_oid_iszero
(
&
delta
->
old_file
.
o
id
));
cl_assert
(
git_oid_iszero
(
&
delta
->
old_file
.
id
));
cl_assert_equal_sz
(
0
,
delta
->
new_file
.
size
);
cl_assert
(
git_oid_iszero
(
&
delta
->
new_file
.
o
id
));
cl_assert
(
git_oid_iszero
(
&
delta
->
new_file
.
id
));
cl_assert_equal_i
(
0
,
(
int
)
git_patch_num_hunks
(
p
));
git_patch_free
(
p
);
...
...
tests/diff/iterator.c
View file @
93954245
...
...
@@ -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 @
93954245
...
...
@@ -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 @
93954245
...
...
@@ -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 @
93954245
...
...
@@ -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 @
93954245
...
...
@@ -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 @
93954245
...
...
@@ -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 @
93954245
...
...
@@ -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 @
93954245
...
...
@@ -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 @
93954245
...
...
@@ -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/fastforward.c
View file @
93954245
...
...
@@ -13,10 +13,10 @@ static git_index *repo_index;
#define TEST_INDEX_PATH TEST_REPO_PATH "/.git/index"
#define THEIRS_FASTFORWARD_BRANCH "ff_branch"
#define THEIRS_FASTFORWARD_
O
ID "fd89f8cffb663ac89095a0f9764902e93ceaca6a"
#define THEIRS_FASTFORWARD_ID "fd89f8cffb663ac89095a0f9764902e93ceaca6a"
#define THEIRS_NOFASTFORWARD_BRANCH "branch"
#define THEIRS_NOFASTFORWARD_
O
ID "7cb63eed597130ba4abb87b3e544b85021905520"
#define THEIRS_NOFASTFORWARD_ID "7cb63eed597130ba4abb87b3e544b85021905520"
// Fixture setup and teardown
...
...
@@ -57,11 +57,11 @@ void test_merge_workdir_fastforward__fastforward(void)
git_merge_result
*
result
;
git_oid
expected
,
ff_oid
;
cl_git_pass
(
git_oid_fromstr
(
&
expected
,
THEIRS_FASTFORWARD_
O
ID
));
cl_git_pass
(
git_oid_fromstr
(
&
expected
,
THEIRS_FASTFORWARD_ID
));
cl_assert
(
result
=
merge_fastforward_branch
(
0
));
cl_assert
(
git_merge_result_is_fastforward
(
result
));
cl_git_pass
(
git_merge_result_fastforward_
o
id
(
&
ff_oid
,
result
));
cl_git_pass
(
git_merge_result_fastforward_id
(
&
ff_oid
,
result
));
cl_assert
(
git_oid_cmp
(
&
ff_oid
,
&
expected
)
==
0
);
git_merge_result_free
(
result
);
...
...
@@ -136,7 +136,7 @@ void test_merge_workdir_fastforward__uptodate_merging_prev_commit(void)
git_merge_result
*
result
;
cl_git_pass
(
git_oid_fromstr
(
&
their_oid
,
"c607fc30883e335def28cd686b51f6cfa02b06ec"
));
cl_git_pass
(
git_merge_head_from_
o
id
(
&
their_heads
[
0
],
repo
,
&
their_oid
));
cl_git_pass
(
git_merge_head_from_id
(
&
their_heads
[
0
],
repo
,
&
their_oid
));
cl_git_pass
(
git_merge
(
&
result
,
repo
,
(
const
git_merge_head
**
)
their_heads
,
1
,
NULL
));
...
...
tests/merge/workdir/setup.c
View file @
93954245
This diff is collapsed.
Click to expand it.
tests/merge/workdir/simple.c
View file @
93954245
...
...
@@ -134,7 +134,7 @@ static git_merge_result *merge_simple_branch(int merge_file_favor, int checkout_
git_merge_opts
opts
=
GIT_MERGE_OPTS_INIT
;
cl_git_pass
(
git_oid_fromstr
(
&
their_oids
[
0
],
THEIRS_SIMPLE_OID
));
cl_git_pass
(
git_merge_head_from_
o
id
(
&
their_heads
[
0
],
repo
,
&
their_oids
[
0
]));
cl_git_pass
(
git_merge_head_from_id
(
&
their_heads
[
0
],
repo
,
&
their_oids
[
0
]));
opts
.
merge_tree_opts
.
file_favor
=
merge_file_favor
;
opts
.
checkout_opts
.
checkout_strategy
=
checkout_strategy
;
...
...
@@ -588,7 +588,7 @@ void test_merge_workdir_simple__directory_file(void)
cl_git_pass
(
git_reset
(
repo
,
(
git_object
*
)
head_commit
,
GIT_RESET_HARD
));
cl_git_pass
(
git_oid_fromstr
(
&
their_oids
[
0
],
THEIRS_DIRECTORY_FILE
));
cl_git_pass
(
git_merge_head_from_
o
id
(
&
their_heads
[
0
],
repo
,
&
their_oids
[
0
]));
cl_git_pass
(
git_merge_head_from_id
(
&
their_heads
[
0
],
repo
,
&
their_oids
[
0
]));
opts
.
merge_tree_opts
.
file_favor
=
0
;
cl_git_pass
(
git_merge
(
&
result
,
repo
,
(
const
git_merge_head
**
)
their_heads
,
1
,
&
opts
));
...
...
@@ -621,7 +621,7 @@ void test_merge_workdir_simple__unrelated(void)
};
cl_git_pass
(
git_oid_fromstr
(
&
their_oids
[
0
],
THEIRS_UNRELATED_PARENT
));
cl_git_pass
(
git_merge_head_from_
o
id
(
&
their_heads
[
0
],
repo
,
&
their_oids
[
0
]));
cl_git_pass
(
git_merge_head_from_id
(
&
their_heads
[
0
],
repo
,
&
their_oids
[
0
]));
opts
.
merge_tree_opts
.
file_favor
=
0
;
cl_git_pass
(
git_merge
(
&
result
,
repo
,
(
const
git_merge_head
**
)
their_heads
,
1
,
&
opts
));
...
...
@@ -654,7 +654,7 @@ void test_merge_workdir_simple__unrelated_with_conflicts(void)
};
cl_git_pass
(
git_oid_fromstr
(
&
their_oids
[
0
],
THEIRS_UNRELATED_OID
));
cl_git_pass
(
git_merge_head_from_
o
id
(
&
their_heads
[
0
],
repo
,
&
their_oids
[
0
]));
cl_git_pass
(
git_merge_head_from_id
(
&
their_heads
[
0
],
repo
,
&
their_oids
[
0
]));
opts
.
merge_tree_opts
.
file_favor
=
0
;
cl_git_pass
(
git_merge
(
&
result
,
repo
,
(
const
git_merge_head
**
)
their_heads
,
1
,
&
opts
));
...
...
@@ -686,7 +686,7 @@ void test_merge_workdir_simple__binary(void)
cl_git_pass
(
git_commit_lookup
(
&
our_commit
,
repo
,
&
our_oid
));
cl_git_pass
(
git_reset
(
repo
,
(
git_object
*
)
our_commit
,
GIT_RESET_HARD
));
cl_git_pass
(
git_merge_head_from_
o
id
(
&
their_head
,
repo
,
&
their_oid
));
cl_git_pass
(
git_merge_head_from_id
(
&
their_head
,
repo
,
&
their_oid
));
cl_git_pass
(
git_merge
(
&
result
,
repo
,
(
const
git_merge_head
**
)
&
their_head
,
1
,
&
opts
));
...
...
@@ -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 @
93954245
...
...
@@ -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/notes/notes.c
View file @
93954245
...
...
@@ -21,7 +21,7 @@ static void assert_note_equal(git_note *note, char *message, git_oid *note_oid)
git_blob
*
blob
;
cl_assert_equal_s
(
git_note_message
(
note
),
message
);
cl_assert
(
!
git_oid_cmp
(
git_note_
o
id
(
note
),
note_oid
));
cl_assert
(
!
git_oid_cmp
(
git_note_id
(
note
),
note_oid
));
cl_git_pass
(
git_blob_lookup
(
&
blob
,
_repo
,
note_oid
));
cl_assert_equal_s
(
git_note_message
(
note
),
(
const
char
*
)
git_blob_rawcontent
(
blob
));
...
...
@@ -290,7 +290,7 @@ void test_notes_notes__can_read_a_note_in_an_existing_fanout(void)
cl_git_pass
(
git_note_read
(
&
note
,
_repo
,
"refs/notes/fanout"
,
&
target_oid
));
cl_git_pass
(
git_oid_fromstr
(
&
note_oid
,
"08b041783f40edfe12bb406c9c9a8a040177c125"
));
cl_assert
(
!
git_oid_cmp
(
git_note_
o
id
(
note
),
&
note_oid
));
cl_assert
(
!
git_oid_cmp
(
git_note_id
(
note
),
&
note_oid
));
git_note_free
(
note
);
}
...
...
tests/notes/notesref.c
View file @
93954245
...
...
@@ -46,13 +46,13 @@ void test_notes_notesref__config_corenotesref(void)
cl_git_pass
(
git_note_read
(
&
_note
,
_repo
,
NULL
,
&
oid
));
cl_assert_equal_s
(
"test123test
\n
"
,
git_note_message
(
_note
));
cl_assert
(
!
git_oid_cmp
(
git_note_
o
id
(
_note
),
&
note_oid
));
cl_assert
(
!
git_oid_cmp
(
git_note_id
(
_note
),
&
note_oid
));
git_note_free
(
_note
);
cl_git_pass
(
git_note_read
(
&
_note
,
_repo
,
"refs/notes/mydefaultnotesref"
,
&
oid
));
cl_assert_equal_s
(
"test123test
\n
"
,
git_note_message
(
_note
));
cl_assert
(
!
git_oid_cmp
(
git_note_
o
id
(
_note
),
&
note_oid
));
cl_assert
(
!
git_oid_cmp
(
git_note_id
(
_note
),
&
note_oid
));
cl_git_pass
(
git_note_default_ref
(
&
default_ref
,
_repo
));
cl_assert_equal_s
(
"refs/notes/mydefaultnotesref"
,
default_ref
);
...
...
tests/object/commit/commitstagedfile.c
View file @
93954245
...
...
@@ -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 @
93954245
...
...
@@ -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 @
93954245
...
...
@@ -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 @
93954245
...
...
@@ -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 @
93954245
...
...
@@ -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