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
a8122b5d
Commit
a8122b5d
authored
Nov 21, 2012
by
Russell Belfer
Committed by
Ben Straub
Nov 27, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix warnings on Win64 build
parent
4604a654
Show whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
134 additions
and
123 deletions
+134
-123
include/git2/index.h
+1
-1
src/delta.c
+12
-9
src/delta.h
+14
-12
src/diff_output.c
+9
-5
src/hash/hash_win32.c
+2
-2
src/index.c
+11
-10
src/iterator.c
+1
-1
src/pack-objects.c
+12
-11
src/reflog.c
+11
-8
src/revparse.c
+13
-14
src/stash.c
+1
-1
src/transports/cred.c
+3
-1
src/transports/smart.c
+1
-1
src/transports/smart.h
+1
-1
src/transports/smart_protocol.c
+2
-2
src/transports/winhttp.c
+1
-1
src/tree.c
+7
-11
src/vector.c
+1
-1
src/win32/posix_w32.c
+3
-3
tests-clar/diff/patch.c
+1
-1
tests-clar/index/conflicts.c
+0
-0
tests-clar/index/filemodes.c
+1
-1
tests-clar/index/inmemory.c
+1
-1
tests-clar/index/tests.c
+4
-4
tests-clar/network/fetch.c
+2
-2
tests-clar/network/fetchlocal.c
+3
-3
tests-clar/object/blob/filter.c
+2
-2
tests-clar/object/tree/duplicateentries.c
+1
-1
tests-clar/refs/reflog/drop.c
+9
-9
tests-clar/refs/reflog/reflog.c
+2
-2
tests-clar/stash/drop.c
+1
-1
tests-clar/status/worktree.c
+1
-1
No files found.
include/git2/index.h
View file @
a8122b5d
...
@@ -258,7 +258,7 @@ GIT_EXTERN(int) git_index_write_tree_to(git_oid *out, git_index *index, git_repo
...
@@ -258,7 +258,7 @@ GIT_EXTERN(int) git_index_write_tree_to(git_oid *out, git_index *index, git_repo
* @param index an existing index object
* @param index an existing index object
* @return integer of count of current entries
* @return integer of count of current entries
*/
*/
GIT_EXTERN
(
unsigned
in
t
)
git_index_entrycount
(
const
git_index
*
index
);
GIT_EXTERN
(
size_
t
)
git_index_entrycount
(
const
git_index
*
index
);
/**
/**
* Clear the contents (all the entries) of an index object.
* Clear the contents (all the entries) of an index object.
...
...
src/delta.c
View file @
a8122b5d
...
@@ -148,7 +148,7 @@ git_delta_create_index(const void *buf, unsigned long bufsize)
...
@@ -148,7 +148,7 @@ git_delta_create_index(const void *buf, unsigned long bufsize)
/* Determine index hash size. Note that indexing skips the
/* Determine index hash size. Note that indexing skips the
first byte to allow for optimizing the Rabin's polynomial
first byte to allow for optimizing the Rabin's polynomial
initialization in create_delta(). */
initialization in create_delta(). */
entries
=
(
bufsize
-
1
)
/
RABIN_WINDOW
;
entries
=
(
unsigned
int
)(
bufsize
-
1
)
/
RABIN_WINDOW
;
if
(
bufsize
>=
0xffffffffUL
)
{
if
(
bufsize
>=
0xffffffffUL
)
{
/*
/*
* Current delta format can't encode offsets into
* Current delta format can't encode offsets into
...
@@ -317,9 +317,12 @@ unsigned long git_delta_sizeof_index(struct git_delta_index *index)
...
@@ -317,9 +317,12 @@ unsigned long git_delta_sizeof_index(struct git_delta_index *index)
#define MAX_OP_SIZE (5 + 5 + 1 + RABIN_WINDOW + 7)
#define MAX_OP_SIZE (5 + 5 + 1 + RABIN_WINDOW + 7)
void
*
void
*
git_delta_create
(
const
struct
git_delta_index
*
index
,
git_delta_create
(
const
void
*
trg_buf
,
unsigned
long
trg_size
,
const
struct
git_delta_index
*
index
,
unsigned
long
*
delta_size
,
unsigned
long
max_size
)
const
void
*
trg_buf
,
unsigned
long
trg_size
,
unsigned
long
*
delta_size
,
unsigned
long
max_size
)
{
{
unsigned
int
i
,
outpos
,
outsize
,
moff
,
msize
,
val
;
unsigned
int
i
,
outpos
,
outsize
,
moff
,
msize
,
val
;
int
inscnt
;
int
inscnt
;
...
@@ -332,7 +335,7 @@ git_delta_create(const struct git_delta_index *index,
...
@@ -332,7 +335,7 @@ git_delta_create(const struct git_delta_index *index,
outpos
=
0
;
outpos
=
0
;
outsize
=
8192
;
outsize
=
8192
;
if
(
max_size
&&
outsize
>=
max_size
)
if
(
max_size
&&
outsize
>=
max_size
)
outsize
=
max_size
+
MAX_OP_SIZE
+
1
;
outsize
=
(
unsigned
int
)(
max_size
+
MAX_OP_SIZE
+
1
)
;
out
=
git__malloc
(
outsize
);
out
=
git__malloc
(
outsize
);
if
(
!
out
)
if
(
!
out
)
return
NULL
;
return
NULL
;
...
@@ -377,19 +380,19 @@ git_delta_create(const struct git_delta_index *index,
...
@@ -377,19 +380,19 @@ git_delta_create(const struct git_delta_index *index,
for
(
entry
=
index
->
hash
[
i
];
entry
<
index
->
hash
[
i
+
1
];
entry
++
)
{
for
(
entry
=
index
->
hash
[
i
];
entry
<
index
->
hash
[
i
+
1
];
entry
++
)
{
const
unsigned
char
*
ref
=
entry
->
ptr
;
const
unsigned
char
*
ref
=
entry
->
ptr
;
const
unsigned
char
*
src
=
data
;
const
unsigned
char
*
src
=
data
;
unsigned
int
ref_size
=
ref_top
-
ref
;
unsigned
int
ref_size
=
(
unsigned
int
)(
ref_top
-
ref
)
;
if
(
entry
->
val
!=
val
)
if
(
entry
->
val
!=
val
)
continue
;
continue
;
if
(
ref_size
>
(
unsigned
int
)(
top
-
src
))
if
(
ref_size
>
(
unsigned
int
)(
top
-
src
))
ref_size
=
top
-
src
;
ref_size
=
(
unsigned
int
)(
top
-
src
)
;
if
(
ref_size
<=
msize
)
if
(
ref_size
<=
msize
)
break
;
break
;
while
(
ref_size
--
&&
*
src
++
==
*
ref
)
while
(
ref_size
--
&&
*
src
++
==
*
ref
)
ref
++
;
ref
++
;
if
(
msize
<
(
unsigned
int
)(
ref
-
entry
->
ptr
))
{
if
(
msize
<
(
unsigned
int
)(
ref
-
entry
->
ptr
))
{
/* this is our best match so far */
/* this is our best match so far */
msize
=
ref
-
entry
->
ptr
;
msize
=
(
unsigned
int
)(
ref
-
entry
->
ptr
)
;
moff
=
entry
->
ptr
-
ref_data
;
moff
=
(
unsigned
int
)(
entry
->
ptr
-
ref_data
)
;
if
(
msize
>=
4096
)
/* good enough */
if
(
msize
>=
4096
)
/* good enough */
break
;
break
;
}
}
...
...
src/delta.h
View file @
a8122b5d
...
@@ -46,9 +46,10 @@ extern unsigned long git_delta_sizeof_index(struct git_delta_index *index);
...
@@ -46,9 +46,10 @@ extern unsigned long git_delta_sizeof_index(struct git_delta_index *index);
* returned and *delta_size is updated with its size. The returned buffer
* returned and *delta_size is updated with its size. The returned buffer
* must be freed by the caller.
* must be freed by the caller.
*/
*/
extern
void
*
extern
void
*
git_delta_create
(
git_delta_create
(
const
struct
git_delta_index
*
index
,
const
struct
git_delta_index
*
index
,
const
void
*
buf
,
unsigned
long
bufsize
,
const
void
*
buf
,
unsigned
long
bufsize
,
unsigned
long
*
delta_size
,
unsigned
long
*
delta_size
,
unsigned
long
max_delta_size
);
unsigned
long
max_delta_size
);
...
@@ -60,15 +61,16 @@ git_delta_create(const struct git_delta_index *index,
...
@@ -60,15 +61,16 @@ git_delta_create(const struct git_delta_index *index,
* pointer to the buffer with the delta data is returned and *delta_size is
* pointer to the buffer with the delta data is returned and *delta_size is
* updated with its size. The returned buffer must be freed by the caller.
* updated with its size. The returned buffer must be freed by the caller.
*/
*/
GIT_INLINE
(
void
*
)
GIT_INLINE
(
void
*
)
git_delta
(
git_delta
(
const
void
*
src_buf
,
unsigned
long
src_bufsize
,
const
void
*
src_buf
,
unsigned
long
src_bufsize
,
const
void
*
trg_buf
,
unsigned
long
trg_bufsize
,
const
void
*
trg_buf
,
unsigned
long
trg_bufsize
,
unsigned
long
*
delta_size
,
unsigned
long
max_delta_size
)
unsigned
long
*
delta_size
,
unsigned
long
max_delta_size
)
{
{
struct
git_delta_index
*
index
=
git_delta_create_index
(
src_buf
,
src_bufsize
);
struct
git_delta_index
*
index
=
git_delta_create_index
(
src_buf
,
src_bufsize
);
if
(
index
)
{
if
(
index
)
{
void
*
delta
=
git_delta_create
(
index
,
trg_buf
,
trg_bufsize
,
void
*
delta
=
git_delta_create
(
delta_size
,
max_delta_size
);
index
,
trg_buf
,
trg_bufsize
,
delta_size
,
max_delta_size
);
git_delta_free_index
(
index
);
git_delta_free_index
(
index
);
return
delta
;
return
delta
;
}
}
...
@@ -82,7 +84,8 @@ git_delta(const void *src_buf, unsigned long src_bufsize,
...
@@ -82,7 +84,8 @@ git_delta(const void *src_buf, unsigned long src_bufsize,
* *trg_bufsize is updated with its size. On failure a NULL pointer is
* *trg_bufsize is updated with its size. On failure a NULL pointer is
* returned. The returned buffer must be freed by the caller.
* returned. The returned buffer must be freed by the caller.
*/
*/
extern
void
*
git_delta_patch
(
const
void
*
src_buf
,
unsigned
long
src_size
,
extern
void
*
git_delta_patch
(
const
void
*
src_buf
,
unsigned
long
src_size
,
const
void
*
delta_buf
,
unsigned
long
delta_size
,
const
void
*
delta_buf
,
unsigned
long
delta_size
,
unsigned
long
*
dst_size
);
unsigned
long
*
dst_size
);
...
@@ -93,9 +96,8 @@ extern void *git_delta_patch(const void *src_buf, unsigned long src_size,
...
@@ -93,9 +96,8 @@ extern void *git_delta_patch(const void *src_buf, unsigned long src_size,
* This must be called twice on the delta data buffer, first to get the
* This must be called twice on the delta data buffer, first to get the
* expected source buffer size, and again to get the target buffer size.
* expected source buffer size, and again to get the target buffer size.
*/
*/
GIT_INLINE
(
unsigned
long
)
GIT_INLINE
(
unsigned
long
)
git_delta_get_hdr_size
(
git_delta_get_hdr_size
(
const
unsigned
char
**
datap
,
const
unsigned
char
**
datap
,
const
unsigned
char
*
top
)
const
unsigned
char
*
top
)
{
{
const
unsigned
char
*
data
=
*
datap
;
const
unsigned
char
*
data
=
*
datap
;
unsigned
long
cmd
,
size
=
0
;
unsigned
long
cmd
,
size
=
0
;
...
...
src/diff_output.c
View file @
a8122b5d
...
@@ -262,7 +262,7 @@ static int get_blob_content(
...
@@ -262,7 +262,7 @@ static int get_blob_content(
return
error
;
return
error
;
map
->
data
=
(
void
*
)
git_blob_rawcontent
(
*
blob
);
map
->
data
=
(
void
*
)
git_blob_rawcontent
(
*
blob
);
map
->
len
=
git_blob_rawsize
(
*
blob
);
map
->
len
=
(
size_t
)
git_blob_rawsize
(
*
blob
);
return
diff_delta_is_binary_by_content
(
ctxt
,
delta
,
file
,
map
);
return
diff_delta_is_binary_by_content
(
ctxt
,
delta
,
file
,
map
);
}
}
...
@@ -1236,14 +1236,18 @@ static void set_data_from_blob(
...
@@ -1236,14 +1236,18 @@ static void set_data_from_blob(
git_blob
*
blob
,
git_map
*
map
,
git_diff_file
*
file
)
git_blob
*
blob
,
git_map
*
map
,
git_diff_file
*
file
)
{
{
if
(
blob
)
{
if
(
blob
)
{
map
->
data
=
(
char
*
)
git_blob_rawcontent
(
blob
);
file
->
size
=
git_blob_rawsize
(
blob
);
file
->
size
=
map
->
len
=
git_blob_rawsize
(
blob
);
git_oid_cpy
(
&
file
->
oid
,
git_object_id
((
const
git_object
*
)
blob
));
git_oid_cpy
(
&
file
->
oid
,
git_object_id
((
const
git_object
*
)
blob
));
file
->
mode
=
0644
;
file
->
mode
=
0644
;
map
->
len
=
(
size_t
)
file
->
size
;
map
->
data
=
(
char
*
)
git_blob_rawcontent
(
blob
);
}
else
{
}
else
{
map
->
data
=
""
;
file
->
size
=
0
;
file
->
size
=
map
->
len
=
0
;
file
->
flags
|=
GIT_DIFF_FILE_NO_DATA
;
file
->
flags
|=
GIT_DIFF_FILE_NO_DATA
;
map
->
len
=
0
;
map
->
data
=
""
;
}
}
}
}
...
...
src/hash/hash_win32.c
View file @
a8122b5d
...
@@ -155,7 +155,7 @@ GIT_INLINE(int) hash_cryptoapi_update(git_hash_ctx *ctx, const void *data, size_
...
@@ -155,7 +155,7 @@ GIT_INLINE(int) hash_cryptoapi_update(git_hash_ctx *ctx, const void *data, size_
{
{
assert
(
ctx
->
ctx
.
cryptoapi
.
valid
);
assert
(
ctx
->
ctx
.
cryptoapi
.
valid
);
if
(
!
CryptHashData
(
ctx
->
ctx
.
cryptoapi
.
hash_handle
,
(
const
BYTE
*
)
data
,
len
,
0
))
if
(
!
CryptHashData
(
ctx
->
ctx
.
cryptoapi
.
hash_handle
,
(
const
BYTE
*
)
data
,
(
DWORD
)
len
,
0
))
return
-
1
;
return
-
1
;
return
0
;
return
0
;
...
@@ -219,7 +219,7 @@ GIT_INLINE(int) hash_cng_init(git_hash_ctx *ctx)
...
@@ -219,7 +219,7 @@ GIT_INLINE(int) hash_cng_init(git_hash_ctx *ctx)
GIT_INLINE
(
int
)
hash_cng_update
(
git_hash_ctx
*
ctx
,
const
void
*
data
,
size_t
len
)
GIT_INLINE
(
int
)
hash_cng_update
(
git_hash_ctx
*
ctx
,
const
void
*
data
,
size_t
len
)
{
{
if
(
ctx
->
prov
->
prov
.
cng
.
hash_data
(
ctx
->
ctx
.
cng
.
hash_handle
,
(
PBYTE
)
data
,
len
,
0
)
<
0
)
if
(
ctx
->
prov
->
prov
.
cng
.
hash_data
(
ctx
->
ctx
.
cng
.
hash_handle
,
(
PBYTE
)
data
,
(
ULONG
)
len
,
0
)
<
0
)
return
-
1
;
return
-
1
;
return
0
;
return
0
;
...
...
src/index.c
View file @
a8122b5d
...
@@ -488,10 +488,10 @@ int git_index_write_tree_to(git_oid *oid, git_index *index, git_repository *repo
...
@@ -488,10 +488,10 @@ int git_index_write_tree_to(git_oid *oid, git_index *index, git_repository *repo
return
git_tree__write_index
(
oid
,
index
,
repo
);
return
git_tree__write_index
(
oid
,
index
,
repo
);
}
}
unsigned
in
t
git_index_entrycount
(
const
git_index
*
index
)
size_
t
git_index_entrycount
(
const
git_index
*
index
)
{
{
assert
(
index
);
assert
(
index
);
return
(
unsigned
int
)
index
->
entries
.
length
;
return
index
->
entries
.
length
;
}
}
const
git_index_entry
*
git_index_get_byindex
(
const
git_index_entry
*
git_index_get_byindex
(
...
@@ -852,7 +852,7 @@ int git_index_conflict_add(git_index *index,
...
@@ -852,7 +852,7 @@ int git_index_conflict_add(git_index *index,
const
git_index_entry
*
their_entry
)
const
git_index_entry
*
their_entry
)
{
{
git_index_entry
*
entries
[
3
]
=
{
0
};
git_index_entry
*
entries
[
3
]
=
{
0
};
size_
t
i
;
unsigned
shor
t
i
;
int
ret
=
0
;
int
ret
=
0
;
assert
(
index
);
assert
(
index
);
...
@@ -890,7 +890,7 @@ int git_index_conflict_get(git_index_entry **ancestor_out,
...
@@ -890,7 +890,7 @@ int git_index_conflict_get(git_index_entry **ancestor_out,
git_index_entry
**
their_out
,
git_index_entry
**
their_out
,
git_index
*
index
,
const
char
*
path
)
git_index
*
index
,
const
char
*
path
)
{
{
int
pos
,
stage
;
int
pos
,
posmax
,
stage
;
git_index_entry
*
conflict_entry
;
git_index_entry
*
conflict_entry
;
int
error
=
GIT_ENOTFOUND
;
int
error
=
GIT_ENOTFOUND
;
...
@@ -903,7 +903,8 @@ int git_index_conflict_get(git_index_entry **ancestor_out,
...
@@ -903,7 +903,8 @@ int git_index_conflict_get(git_index_entry **ancestor_out,
if
((
pos
=
git_index_find
(
index
,
path
))
<
0
)
if
((
pos
=
git_index_find
(
index
,
path
))
<
0
)
return
pos
;
return
pos
;
while
((
unsigned
int
)
pos
<
git_index_entrycount
(
index
))
{
for
(
posmax
=
(
int
)
git_index_entrycount
(
index
);
pos
<
posmax
;
++
pos
)
{
conflict_entry
=
git_vector_get
(
&
index
->
entries
,
pos
);
conflict_entry
=
git_vector_get
(
&
index
->
entries
,
pos
);
if
(
index
->
entries_cmp_path
(
conflict_entry
->
path
,
path
)
!=
0
)
if
(
index
->
entries_cmp_path
(
conflict_entry
->
path
,
path
)
!=
0
)
...
@@ -927,8 +928,6 @@ int git_index_conflict_get(git_index_entry **ancestor_out,
...
@@ -927,8 +928,6 @@ int git_index_conflict_get(git_index_entry **ancestor_out,
default
:
default
:
break
;
break
;
};
};
++
pos
;
}
}
return
error
;
return
error
;
...
@@ -936,7 +935,7 @@ int git_index_conflict_get(git_index_entry **ancestor_out,
...
@@ -936,7 +935,7 @@ int git_index_conflict_get(git_index_entry **ancestor_out,
int
git_index_conflict_remove
(
git_index
*
index
,
const
char
*
path
)
int
git_index_conflict_remove
(
git_index
*
index
,
const
char
*
path
)
{
{
int
pos
;
int
pos
,
posmax
;
git_index_entry
*
conflict_entry
;
git_index_entry
*
conflict_entry
;
int
error
=
0
;
int
error
=
0
;
...
@@ -945,7 +944,9 @@ int git_index_conflict_remove(git_index *index, const char *path)
...
@@ -945,7 +944,9 @@ int git_index_conflict_remove(git_index *index, const char *path)
if
((
pos
=
git_index_find
(
index
,
path
))
<
0
)
if
((
pos
=
git_index_find
(
index
,
path
))
<
0
)
return
pos
;
return
pos
;
while
((
unsigned
int
)
pos
<
git_index_entrycount
(
index
))
{
posmax
=
(
int
)
git_index_entrycount
(
index
);
while
(
pos
<
posmax
)
{
conflict_entry
=
git_vector_get
(
&
index
->
entries
,
pos
);
conflict_entry
=
git_vector_get
(
&
index
->
entries
,
pos
);
if
(
index
->
entries_cmp_path
(
conflict_entry
->
path
,
path
)
!=
0
)
if
(
index
->
entries_cmp_path
(
conflict_entry
->
path
,
path
)
!=
0
)
...
@@ -1520,7 +1521,7 @@ static int write_reuc_extension(git_index *index, git_filebuf *file)
...
@@ -1520,7 +1521,7 @@ static int write_reuc_extension(git_index *index, git_filebuf *file)
memset
(
&
extension
,
0x0
,
sizeof
(
struct
index_extension
));
memset
(
&
extension
,
0x0
,
sizeof
(
struct
index_extension
));
memcpy
(
&
extension
.
signature
,
INDEX_EXT_UNMERGED_SIG
,
4
);
memcpy
(
&
extension
.
signature
,
INDEX_EXT_UNMERGED_SIG
,
4
);
extension
.
extension_size
=
reuc_buf
.
size
;
extension
.
extension_size
=
(
uint32_t
)
reuc_buf
.
size
;
error
=
write_extension
(
file
,
&
extension
,
&
reuc_buf
);
error
=
write_extension
(
file
,
&
extension
,
&
reuc_buf
);
...
...
src/iterator.c
View file @
a8122b5d
...
@@ -329,7 +329,7 @@ int git_iterator_for_tree_range(
...
@@ -329,7 +329,7 @@ int git_iterator_for_tree_range(
typedef
struct
{
typedef
struct
{
git_iterator
base
;
git_iterator
base
;
git_index
*
index
;
git_index
*
index
;
unsigned
in
t
current
;
size_
t
current
;
bool
free_index
;
bool
free_index
;
}
index_iterator
;
}
index_iterator
;
...
...
src/pack-objects.c
View file @
a8122b5d
...
@@ -229,7 +229,7 @@ static int gen_pack_object_header(
...
@@ -229,7 +229,7 @@ static int gen_pack_object_header(
}
}
*
hdr
++
=
c
;
*
hdr
++
=
c
;
return
hdr
-
hdr_base
;
return
(
int
)(
hdr
-
hdr_base
)
;
}
}
static
int
get_delta
(
void
**
out
,
git_odb
*
odb
,
git_pobject
*
po
)
static
int
get_delta
(
void
**
out
,
git_odb
*
odb
,
git_pobject
*
po
)
...
@@ -244,8 +244,9 @@ static int get_delta(void **out, git_odb *odb, git_pobject *po)
...
@@ -244,8 +244,9 @@ static int get_delta(void **out, git_odb *odb, git_pobject *po)
git_odb_read
(
&
trg
,
odb
,
&
po
->
id
)
<
0
)
git_odb_read
(
&
trg
,
odb
,
&
po
->
id
)
<
0
)
goto
on_error
;
goto
on_error
;
delta_buf
=
git_delta
(
git_odb_object_data
(
src
),
git_odb_object_size
(
src
),
delta_buf
=
git_delta
(
git_odb_object_data
(
trg
),
git_odb_object_size
(
trg
),
git_odb_object_data
(
src
),
(
unsigned
long
)
git_odb_object_size
(
src
),
git_odb_object_data
(
trg
),
(
unsigned
long
)
git_odb_object_size
(
trg
),
&
delta_size
,
0
);
&
delta_size
,
0
);
if
(
!
delta_buf
||
delta_size
!=
po
->
delta_size
)
{
if
(
!
delta_buf
||
delta_size
!=
po
->
delta_size
)
{
...
@@ -287,7 +288,7 @@ static int write_object(git_buf *buf, git_packbuilder *pb, git_pobject *po)
...
@@ -287,7 +288,7 @@ static int write_object(git_buf *buf, git_packbuilder *pb, git_pobject *po)
goto
on_error
;
goto
on_error
;
data
=
(
void
*
)
git_odb_object_data
(
obj
);
data
=
(
void
*
)
git_odb_object_data
(
obj
);
size
=
git_odb_object_size
(
obj
);
size
=
(
unsigned
long
)
git_odb_object_size
(
obj
);
type
=
git_odb_object_type
(
obj
);
type
=
git_odb_object_type
(
obj
);
}
}
...
@@ -315,7 +316,7 @@ static int write_object(git_buf *buf, git_packbuilder *pb, git_pobject *po)
...
@@ -315,7 +316,7 @@ static int write_object(git_buf *buf, git_packbuilder *pb, git_pobject *po)
if
(
po
->
delta
)
if
(
po
->
delta
)
git__free
(
data
);
git__free
(
data
);
data
=
zbuf
.
ptr
;
data
=
zbuf
.
ptr
;
size
=
zbuf
.
size
;
size
=
(
unsigned
long
)
zbuf
.
size
;
}
}
if
(
git_buf_put
(
buf
,
data
,
size
)
<
0
||
if
(
git_buf_put
(
buf
,
data
,
size
)
<
0
||
...
@@ -707,7 +708,7 @@ static int try_delta(git_packbuilder *pb, struct unpacked *trg,
...
@@ -707,7 +708,7 @@ static int try_delta(git_packbuilder *pb, struct unpacked *trg,
return
0
;
return
0
;
/* Now some size filtering heuristics. */
/* Now some size filtering heuristics. */
trg_size
=
trg_object
->
size
;
trg_size
=
(
unsigned
long
)
trg_object
->
size
;
if
(
!
trg_object
->
delta
)
{
if
(
!
trg_object
->
delta
)
{
max_size
=
trg_size
/
2
-
20
;
max_size
=
trg_size
/
2
-
20
;
ref_depth
=
1
;
ref_depth
=
1
;
...
@@ -721,7 +722,7 @@ static int try_delta(git_packbuilder *pb, struct unpacked *trg,
...
@@ -721,7 +722,7 @@ static int try_delta(git_packbuilder *pb, struct unpacked *trg,
if
(
max_size
==
0
)
if
(
max_size
==
0
)
return
0
;
return
0
;
src_size
=
src_object
->
size
;
src_size
=
(
unsigned
long
)
src_object
->
size
;
sizediff
=
src_size
<
trg_size
?
trg_size
-
src_size
:
0
;
sizediff
=
src_size
<
trg_size
?
trg_size
-
src_size
:
0
;
if
(
sizediff
>=
max_size
)
if
(
sizediff
>=
max_size
)
return
0
;
return
0
;
...
@@ -733,7 +734,7 @@ static int try_delta(git_packbuilder *pb, struct unpacked *trg,
...
@@ -733,7 +734,7 @@ static int try_delta(git_packbuilder *pb, struct unpacked *trg,
if
(
git_odb_read
(
&
obj
,
pb
->
odb
,
&
trg_object
->
id
)
<
0
)
if
(
git_odb_read
(
&
obj
,
pb
->
odb
,
&
trg_object
->
id
)
<
0
)
return
-
1
;
return
-
1
;
sz
=
git_odb_object_size
(
obj
);
sz
=
(
unsigned
long
)
git_odb_object_size
(
obj
);
trg
->
data
=
git__malloc
(
sz
);
trg
->
data
=
git__malloc
(
sz
);
GITERR_CHECK_ALLOC
(
trg
->
data
);
GITERR_CHECK_ALLOC
(
trg
->
data
);
memcpy
(
trg
->
data
,
git_odb_object_data
(
obj
),
sz
);
memcpy
(
trg
->
data
,
git_odb_object_data
(
obj
),
sz
);
...
@@ -752,7 +753,7 @@ static int try_delta(git_packbuilder *pb, struct unpacked *trg,
...
@@ -752,7 +753,7 @@ static int try_delta(git_packbuilder *pb, struct unpacked *trg,
if
(
git_odb_read
(
&
obj
,
pb
->
odb
,
&
src_object
->
id
)
<
0
)
if
(
git_odb_read
(
&
obj
,
pb
->
odb
,
&
src_object
->
id
)
<
0
)
return
-
1
;
return
-
1
;
sz
=
git_odb_object_size
(
obj
);
sz
=
(
unsigned
long
)
git_odb_object_size
(
obj
);
src
->
data
=
git__malloc
(
sz
);
src
->
data
=
git__malloc
(
sz
);
GITERR_CHECK_ALLOC
(
src
->
data
);
GITERR_CHECK_ALLOC
(
src
->
data
);
memcpy
(
src
->
data
,
git_odb_object_data
(
obj
),
sz
);
memcpy
(
src
->
data
,
git_odb_object_data
(
obj
),
sz
);
...
@@ -835,7 +836,7 @@ static unsigned long free_unpacked(struct unpacked *n)
...
@@ -835,7 +836,7 @@ static unsigned long free_unpacked(struct unpacked *n)
git_delta_free_index
(
n
->
index
);
git_delta_free_index
(
n
->
index
);
n
->
index
=
NULL
;
n
->
index
=
NULL
;
if
(
n
->
data
)
{
if
(
n
->
data
)
{
freed_mem
+=
n
->
object
->
size
;
freed_mem
+=
(
unsigned
long
)
n
->
object
->
size
;
git__free
(
n
->
data
);
git__free
(
n
->
data
);
n
->
data
=
NULL
;
n
->
data
=
NULL
;
}
}
...
@@ -941,7 +942,7 @@ static int find_deltas(git_packbuilder *pb, git_pobject **list,
...
@@ -941,7 +942,7 @@ static int find_deltas(git_packbuilder *pb, git_pobject **list,
GITERR_CHECK_ALLOC
(
po
->
delta_data
);
GITERR_CHECK_ALLOC
(
po
->
delta_data
);
memcpy
(
po
->
delta_data
,
zbuf
.
ptr
,
zbuf
.
size
);
memcpy
(
po
->
delta_data
,
zbuf
.
ptr
,
zbuf
.
size
);
po
->
z_delta_size
=
zbuf
.
size
;
po
->
z_delta_size
=
(
unsigned
long
)
zbuf
.
size
;
git_buf_clear
(
&
zbuf
);
git_buf_clear
(
&
zbuf
);
git_packbuilder__cache_lock
(
pb
);
git_packbuilder__cache_lock
(
pb
);
...
...
src/reflog.c
View file @
a8122b5d
...
@@ -411,18 +411,20 @@ size_t git_reflog_entrycount(git_reflog *reflog)
...
@@ -411,18 +411,20 @@ size_t git_reflog_entrycount(git_reflog *reflog)
return
reflog
->
entries
.
length
;
return
reflog
->
entries
.
length
;
}
}
const
git_reflog_entry
*
git_reflog_entry_byindex
(
git_reflog
*
reflog
,
size_t
idx
)
GIT_INLINE
(
size_t
)
reflog_inverse_index
(
size_t
idx
,
size_t
total
)
{
{
int
pos
;
return
(
total
-
1
)
-
idx
;
}
const
git_reflog_entry
*
git_reflog_entry_byindex
(
git_reflog
*
reflog
,
size_t
idx
)
{
assert
(
reflog
);
assert
(
reflog
);
pos
=
git_reflog_entrycount
(
reflog
)
-
(
idx
+
1
);
if
(
idx
>=
reflog
->
entries
.
length
)
if
(
pos
<
0
)
return
NULL
;
return
NULL
;
return
git_vector_get
(
&
reflog
->
entries
,
pos
);
return
git_vector_get
(
&
reflog
->
entries
,
reflog_inverse_index
(
idx
,
reflog
->
entries
.
length
));
}
}
const
git_oid
*
git_reflog_entry_id_old
(
const
git_reflog_entry
*
entry
)
const
git_oid
*
git_reflog_entry_id_old
(
const
git_reflog_entry
*
entry
)
...
@@ -454,7 +456,7 @@ int git_reflog_drop(
...
@@ -454,7 +456,7 @@ int git_reflog_drop(
size_t
idx
,
size_t
idx
,
int
rewrite_previous_entry
)
int
rewrite_previous_entry
)
{
{
unsigned
in
t
entrycount
;
size_
t
entrycount
;
git_reflog_entry
*
entry
,
*
previous
;
git_reflog_entry
*
entry
,
*
previous
;
assert
(
reflog
);
assert
(
reflog
);
...
@@ -468,7 +470,8 @@ int git_reflog_drop(
...
@@ -468,7 +470,8 @@ int git_reflog_drop(
reflog_entry_free
(
entry
);
reflog_entry_free
(
entry
);
if
(
git_vector_remove
(
&
reflog
->
entries
,
entrycount
-
(
idx
+
1
))
<
0
)
if
(
git_vector_remove
(
&
reflog
->
entries
,
reflog_inverse_index
(
idx
,
entrycount
))
<
0
)
return
-
1
;
return
-
1
;
if
(
!
rewrite_previous_entry
)
if
(
!
rewrite_previous_entry
)
...
...
src/revparse.c
View file @
a8122b5d
...
@@ -161,7 +161,7 @@ static int revparse_lookup_object(git_object **out, git_repository *repo, const
...
@@ -161,7 +161,7 @@ static int revparse_lookup_object(git_object **out, git_repository *repo, const
static
int
try_parse_numeric
(
int
*
n
,
const
char
*
curly_braces_content
)
static
int
try_parse_numeric
(
int
*
n
,
const
char
*
curly_braces_content
)
{
{
int
content
;
int
32_t
content
;
const
char
*
end_ptr
;
const
char
*
end_ptr
;
if
(
git__strtol32
(
&
content
,
curly_braces_content
,
&
end_ptr
,
10
)
<
0
)
if
(
git__strtol32
(
&
content
,
curly_braces_content
,
&
end_ptr
,
10
)
<
0
)
...
@@ -170,16 +170,17 @@ static int try_parse_numeric(int *n, const char *curly_braces_content)
...
@@ -170,16 +170,17 @@ static int try_parse_numeric(int *n, const char *curly_braces_content)
if
(
*
end_ptr
!=
'\0'
)
if
(
*
end_ptr
!=
'\0'
)
return
-
1
;
return
-
1
;
*
n
=
content
;
*
n
=
(
int
)
content
;
return
0
;
return
0
;
}
}
static
int
retrieve_previously_checked_out_branch_or_revision
(
git_object
**
out
,
git_reference
**
base_ref
,
git_repository
*
repo
,
const
char
*
spec
,
const
char
*
identifier
,
unsigned
in
t
position
)
static
int
retrieve_previously_checked_out_branch_or_revision
(
git_object
**
out
,
git_reference
**
base_ref
,
git_repository
*
repo
,
const
char
*
spec
,
const
char
*
identifier
,
size_
t
position
)
{
{
git_reference
*
ref
=
NULL
;
git_reference
*
ref
=
NULL
;
git_reflog
*
reflog
=
NULL
;
git_reflog
*
reflog
=
NULL
;
regex_t
preg
;
regex_t
preg
;
int
numentries
,
i
,
cur
,
error
=
-
1
;
int
error
=
-
1
;
size_t
i
,
numentries
,
cur
;
const
git_reflog_entry
*
entry
;
const
git_reflog_entry
*
entry
;
const
char
*
msg
;
const
char
*
msg
;
regmatch_t
regexmatches
[
2
];
regmatch_t
regexmatches
[
2
];
...
@@ -236,11 +237,11 @@ cleanup:
...
@@ -236,11 +237,11 @@ cleanup:
return
error
;
return
error
;
}
}
static
int
retrieve_oid_from_reflog
(
git_oid
*
oid
,
git_reference
*
ref
,
unsigned
in
t
identifier
)
static
int
retrieve_oid_from_reflog
(
git_oid
*
oid
,
git_reference
*
ref
,
size_
t
identifier
)
{
{
git_reflog
*
reflog
;
git_reflog
*
reflog
;
int
error
=
-
1
;
int
error
=
-
1
;
unsigned
in
t
numentries
;
size_
t
numentries
;
const
git_reflog_entry
*
entry
;
const
git_reflog_entry
*
entry
;
bool
search_by_pos
=
(
identifier
<=
100000000
);
bool
search_by_pos
=
(
identifier
<=
100000000
);
...
@@ -253,10 +254,8 @@ static int retrieve_oid_from_reflog(git_oid *oid, git_reference *ref, unsigned i
...
@@ -253,10 +254,8 @@ static int retrieve_oid_from_reflog(git_oid *oid, git_reference *ref, unsigned i
if
(
numentries
<
identifier
+
1
)
{
if
(
numentries
<
identifier
+
1
)
{
giterr_set
(
giterr_set
(
GITERR_REFERENCE
,
GITERR_REFERENCE
,
"Reflog for '%s' has only %d entries, asked for %d"
,
"Reflog for '%s' has only "
PRIuZ
" entries, asked for "
PRIuZ
,
git_reference_name
(
ref
),
git_reference_name
(
ref
),
numentries
,
identifier
);
numentries
,
identifier
);
error
=
GIT_ENOTFOUND
;
error
=
GIT_ENOTFOUND
;
goto
cleanup
;
goto
cleanup
;
...
@@ -268,14 +267,14 @@ static int retrieve_oid_from_reflog(git_oid *oid, git_reference *ref, unsigned i
...
@@ -268,14 +267,14 @@ static int retrieve_oid_from_reflog(git_oid *oid, git_reference *ref, unsigned i
goto
cleanup
;
goto
cleanup
;
}
else
{
}
else
{
unsigned
in
t
i
;
size_
t
i
;
git_time
commit_time
;
git_time
commit_time
;
for
(
i
=
0
;
i
<
numentries
;
i
++
)
{
for
(
i
=
0
;
i
<
numentries
;
i
++
)
{
entry
=
git_reflog_entry_byindex
(
reflog
,
i
);
entry
=
git_reflog_entry_byindex
(
reflog
,
i
);
commit_time
=
git_reflog_entry_committer
(
entry
)
->
when
;
commit_time
=
git_reflog_entry_committer
(
entry
)
->
when
;
if
(
commit_time
.
time
-
identifier
>
0
)
if
(
commit_time
.
time
>
(
git_time_t
)
identifier
)
continue
;
continue
;
git_oid_cpy
(
oid
,
git_reflog_entry_id_new
(
entry
));
git_oid_cpy
(
oid
,
git_reflog_entry_id_new
(
entry
));
...
@@ -291,7 +290,7 @@ cleanup:
...
@@ -291,7 +290,7 @@ cleanup:
return
error
;
return
error
;
}
}
static
int
retrieve_revobject_from_reflog
(
git_object
**
out
,
git_reference
**
base_ref
,
git_repository
*
repo
,
const
char
*
identifier
,
unsigned
in
t
position
)
static
int
retrieve_revobject_from_reflog
(
git_object
**
out
,
git_reference
**
base_ref
,
git_repository
*
repo
,
const
char
*
identifier
,
size_
t
position
)
{
{
git_reference
*
ref
;
git_reference
*
ref
;
git_oid
oid
;
git_oid
oid
;
...
@@ -380,7 +379,7 @@ static int handle_at_syntax(git_object **out, git_reference **ref, const char *s
...
@@ -380,7 +379,7 @@ static int handle_at_syntax(git_object **out, git_reference **ref, const char *s
if
(
git__date_parse
(
&
timestamp
,
curly_braces_content
)
<
0
)
if
(
git__date_parse
(
&
timestamp
,
curly_braces_content
)
<
0
)
goto
cleanup
;
goto
cleanup
;
error
=
retrieve_revobject_from_reflog
(
out
,
ref
,
repo
,
git_buf_cstr
(
&
identifier
),
(
unsigned
in
t
)
timestamp
);
error
=
retrieve_revobject_from_reflog
(
out
,
ref
,
repo
,
git_buf_cstr
(
&
identifier
),
(
size_
t
)
timestamp
);
cleanup:
cleanup:
git_buf_free
(
&
identifier
);
git_buf_free
(
&
identifier
);
...
...
src/stash.c
View file @
a8122b5d
...
@@ -56,7 +56,7 @@ static int append_abbreviated_oid(git_buf *out, const git_oid *b_commit)
...
@@ -56,7 +56,7 @@ static int append_abbreviated_oid(git_buf *out, const git_oid *b_commit)
static
int
append_commit_description
(
git_buf
*
out
,
git_commit
*
commit
)
static
int
append_commit_description
(
git_buf
*
out
,
git_commit
*
commit
)
{
{
const
char
*
message
;
const
char
*
message
;
in
t
pos
=
0
,
len
;
size_
t
pos
=
0
,
len
;
if
(
append_abbreviated_oid
(
out
,
git_commit_id
(
commit
))
<
0
)
if
(
append_abbreviated_oid
(
out
,
git_commit_id
(
commit
))
<
0
)
return
-
1
;
return
-
1
;
...
...
src/transports/cred.c
View file @
a8122b5d
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
static
void
plaintext_free
(
struct
git_cred
*
cred
)
static
void
plaintext_free
(
struct
git_cred
*
cred
)
{
{
git_cred_userpass_plaintext
*
c
=
(
git_cred_userpass_plaintext
*
)
cred
;
git_cred_userpass_plaintext
*
c
=
(
git_cred_userpass_plaintext
*
)
cred
;
in
t
pass_len
=
strlen
(
c
->
password
);
size_
t
pass_len
=
strlen
(
c
->
password
);
git__free
(
c
->
username
);
git__free
(
c
->
username
);
...
@@ -19,6 +19,8 @@ static void plaintext_free(struct git_cred *cred)
...
@@ -19,6 +19,8 @@ static void plaintext_free(struct git_cred *cred)
memset
(
c
->
password
,
0x0
,
pass_len
);
memset
(
c
->
password
,
0x0
,
pass_len
);
git__free
(
c
->
password
);
git__free
(
c
->
password
);
memset
(
c
,
0
,
sizeof
(
*
c
));
git__free
(
c
);
git__free
(
c
);
}
}
...
...
src/transports/smart.c
View file @
a8122b5d
...
@@ -24,7 +24,7 @@ static int git_smart__recv_cb(gitno_buffer *buf)
...
@@ -24,7 +24,7 @@ static int git_smart__recv_cb(gitno_buffer *buf)
buf
->
offset
+=
bytes_read
;
buf
->
offset
+=
bytes_read
;
if
(
t
->
packetsize_cb
)
if
(
t
->
packetsize_cb
)
t
->
packetsize_cb
(
bytes_read
,
t
->
packetsize_payload
);
t
->
packetsize_cb
(
(
int
)
bytes_read
,
t
->
packetsize_payload
);
return
(
int
)(
buf
->
offset
-
old_len
);
return
(
int
)(
buf
->
offset
-
old_len
);
}
}
...
...
src/transports/smart.h
View file @
a8122b5d
...
@@ -94,7 +94,7 @@ typedef struct transport_smart_caps {
...
@@ -94,7 +94,7 @@ typedef struct transport_smart_caps {
include_tag
:
1
;
include_tag
:
1
;
}
transport_smart_caps
;
}
transport_smart_caps
;
typedef
void
(
*
packetsize_cb
)(
in
t
received
,
void
*
payload
);
typedef
void
(
*
packetsize_cb
)(
size_
t
received
,
void
*
payload
);
typedef
struct
{
typedef
struct
{
git_transport
parent
;
git_transport
parent
;
...
...
src/transports/smart_protocol.c
View file @
a8122b5d
...
@@ -375,7 +375,7 @@ struct network_packetsize_payload
...
@@ -375,7 +375,7 @@ struct network_packetsize_payload
size_t
last_fired_bytes
;
size_t
last_fired_bytes
;
};
};
static
void
network_packetsize
(
in
t
received
,
void
*
payload
)
static
void
network_packetsize
(
size_
t
received
,
void
*
payload
)
{
{
struct
network_packetsize_payload
*
npp
=
(
struct
network_packetsize_payload
*
)
payload
;
struct
network_packetsize_payload
*
npp
=
(
struct
network_packetsize_payload
*
)
payload
;
...
@@ -414,7 +414,7 @@ int git_smart__download_pack(
...
@@ -414,7 +414,7 @@ int git_smart__download_pack(
/* We might have something in the buffer already from negotiate_fetch */
/* We might have something in the buffer already from negotiate_fetch */
if
(
t
->
buffer
.
offset
>
0
)
if
(
t
->
buffer
.
offset
>
0
)
t
->
packetsize_cb
(
t
->
buffer
.
offset
,
t
->
packetsize_payload
);
t
->
packetsize_cb
(
(
int
)
t
->
buffer
.
offset
,
t
->
packetsize_payload
);
}
}
if
((
error
=
git_repository_odb__weakptr
(
&
odb
,
repo
))
<
0
||
if
((
error
=
git_repository_odb__weakptr
(
&
odb
,
repo
))
<
0
||
...
...
src/transports/winhttp.c
View file @
a8122b5d
...
@@ -376,7 +376,7 @@ replay:
...
@@ -376,7 +376,7 @@ replay:
if
(
!
WinHttpReadData
(
s
->
request
,
if
(
!
WinHttpReadData
(
s
->
request
,
(
LPVOID
)
buffer
,
(
LPVOID
)
buffer
,
buf_size
,
(
DWORD
)
buf_size
,
&
dw_bytes_read
))
&
dw_bytes_read
))
{
{
giterr_set
(
GITERR_OS
,
"Failed to read data"
);
giterr_set
(
GITERR_OS
,
"Failed to read data"
);
...
...
src/tree.c
View file @
a8122b5d
...
@@ -353,10 +353,9 @@ int git_tree__parse(git_tree *tree, git_odb_object *obj)
...
@@ -353,10 +353,9 @@ int git_tree__parse(git_tree *tree, git_odb_object *obj)
return
tree_parse_buffer
(
tree
,
(
char
*
)
obj
->
raw
.
data
,
(
char
*
)
obj
->
raw
.
data
+
obj
->
raw
.
len
);
return
tree_parse_buffer
(
tree
,
(
char
*
)
obj
->
raw
.
data
,
(
char
*
)
obj
->
raw
.
data
+
obj
->
raw
.
len
);
}
}
static
unsigned
int
find_next_dir
(
const
char
*
dirname
,
git_index
*
index
,
unsigned
in
t
start
)
static
size_t
find_next_dir
(
const
char
*
dirname
,
git_index
*
index
,
size_
t
start
)
{
{
unsigned
int
i
,
entries
=
git_index_entrycount
(
index
);
size_t
dirlen
,
i
,
entries
=
git_index_entrycount
(
index
);
size_t
dirlen
;
dirlen
=
strlen
(
dirname
);
dirlen
=
strlen
(
dirname
);
for
(
i
=
start
;
i
<
entries
;
++
i
)
{
for
(
i
=
start
;
i
<
entries
;
++
i
)
{
...
@@ -399,11 +398,10 @@ static int write_tree(
...
@@ -399,11 +398,10 @@ static int write_tree(
git_repository
*
repo
,
git_repository
*
repo
,
git_index
*
index
,
git_index
*
index
,
const
char
*
dirname
,
const
char
*
dirname
,
unsigned
in
t
start
)
size_
t
start
)
{
{
git_treebuilder
*
bld
=
NULL
;
git_treebuilder
*
bld
=
NULL
;
size_t
i
,
entries
=
git_index_entrycount
(
index
);
unsigned
int
i
,
entries
=
git_index_entrycount
(
index
);
int
error
;
int
error
;
size_t
dirname_len
=
strlen
(
dirname
);
size_t
dirname_len
=
strlen
(
dirname
);
const
git_tree_cache
*
cache
;
const
git_tree_cache
*
cache
;
...
@@ -411,13 +409,11 @@ static int write_tree(
...
@@ -411,13 +409,11 @@ static int write_tree(
cache
=
git_tree_cache_get
(
index
->
tree
,
dirname
);
cache
=
git_tree_cache_get
(
index
->
tree
,
dirname
);
if
(
cache
!=
NULL
&&
cache
->
entries
>=
0
){
if
(
cache
!=
NULL
&&
cache
->
entries
>=
0
){
git_oid_cpy
(
oid
,
&
cache
->
oid
);
git_oid_cpy
(
oid
,
&
cache
->
oid
);
return
find_next_dir
(
dirname
,
index
,
start
);
return
(
int
)
find_next_dir
(
dirname
,
index
,
start
);
}
}
error
=
git_treebuilder_create
(
&
bld
,
NULL
);
if
((
error
=
git_treebuilder_create
(
&
bld
,
NULL
))
<
0
||
bld
==
NULL
)
if
(
bld
==
NULL
)
{
return
-
1
;
return
-
1
;
}
/*
/*
* This loop is unfortunate, but necessary. The index doesn't have
* This loop is unfortunate, but necessary. The index doesn't have
...
@@ -494,7 +490,7 @@ static int write_tree(
...
@@ -494,7 +490,7 @@ static int write_tree(
goto
on_error
;
goto
on_error
;
git_treebuilder_free
(
bld
);
git_treebuilder_free
(
bld
);
return
i
;
return
(
int
)
i
;
on_error:
on_error:
git_treebuilder_free
(
bld
);
git_treebuilder_free
(
bld
);
...
...
src/vector.c
View file @
a8122b5d
...
@@ -165,7 +165,7 @@ int git_vector_search2(
...
@@ -165,7 +165,7 @@ int git_vector_search2(
for
(
i
=
0
;
i
<
v
->
length
;
++
i
)
{
for
(
i
=
0
;
i
<
v
->
length
;
++
i
)
{
if
(
key_lookup
(
key
,
v
->
contents
[
i
])
==
0
)
if
(
key_lookup
(
key
,
v
->
contents
[
i
])
==
0
)
return
i
;
return
(
int
)
i
;
}
}
return
GIT_ENOTFOUND
;
return
GIT_ENOTFOUND
;
...
...
src/win32/posix_w32.c
View file @
a8122b5d
...
@@ -520,17 +520,17 @@ int p_inet_pton(int af, const char* src, void* dst)
...
@@ -520,17 +520,17 @@ int p_inet_pton(int af, const char* src, void* dst)
struct
sockaddr_in6
sin6
;
struct
sockaddr_in6
sin6
;
struct
sockaddr_in
sin
;
struct
sockaddr_in
sin
;
}
sa
;
}
sa
;
size_
t
srcsize
;
in
t
srcsize
;
switch
(
af
)
switch
(
af
)
{
{
case
AF_INET
:
case
AF_INET
:
sa
.
sin
.
sin_family
=
AF_INET
;
sa
.
sin
.
sin_family
=
AF_INET
;
srcsize
=
sizeof
(
sa
.
sin
);
srcsize
=
(
int
)
sizeof
(
sa
.
sin
);
break
;
break
;
case
AF_INET6
:
case
AF_INET6
:
sa
.
sin6
.
sin6_family
=
AF_INET6
;
sa
.
sin6
.
sin6_family
=
AF_INET6
;
srcsize
=
sizeof
(
sa
.
sin6
);
srcsize
=
(
int
)
sizeof
(
sa
.
sin6
);
break
;
break
;
default:
default:
errno
=
WSAEPFNOSUPPORT
;
errno
=
WSAEPFNOSUPPORT
;
...
...
tests-clar/diff/patch.c
View file @
a8122b5d
...
@@ -113,7 +113,7 @@ void test_diff_patch__to_string(void)
...
@@ -113,7 +113,7 @@ void test_diff_patch__to_string(void)
cl_git_pass
(
git_diff_tree_to_tree
(
&
diff
,
g_repo
,
one
,
another
,
NULL
));
cl_git_pass
(
git_diff_tree_to_tree
(
&
diff
,
g_repo
,
one
,
another
,
NULL
));
cl_assert_equal_i
(
1
,
git_diff_num_deltas
(
diff
));
cl_assert_equal_i
(
1
,
(
int
)
git_diff_num_deltas
(
diff
));
cl_git_pass
(
git_diff_get_patch
(
&
patch
,
NULL
,
diff
,
0
));
cl_git_pass
(
git_diff_get_patch
(
&
patch
,
NULL
,
diff
,
0
));
...
...
tests-clar/index/conflicts.c
View file @
a8122b5d
tests-clar/index/filemodes.c
View file @
a8122b5d
...
@@ -22,7 +22,7 @@ void test_index_filemodes__read(void)
...
@@ -22,7 +22,7 @@ void test_index_filemodes__read(void)
static
bool
expected
[
6
]
=
{
0
,
1
,
0
,
1
,
0
,
1
};
static
bool
expected
[
6
]
=
{
0
,
1
,
0
,
1
,
0
,
1
};
cl_git_pass
(
git_repository_index
(
&
index
,
g_repo
));
cl_git_pass
(
git_repository_index
(
&
index
,
g_repo
));
cl_assert_equal_i
(
6
,
git_index_entrycount
(
index
));
cl_assert_equal_i
(
6
,
(
int
)
git_index_entrycount
(
index
));
for
(
i
=
0
;
i
<
6
;
++
i
)
{
for
(
i
=
0
;
i
<
6
;
++
i
)
{
const
git_index_entry
*
entry
=
git_index_get_byindex
(
index
,
i
);
const
git_index_entry
*
entry
=
git_index_get_byindex
(
index
,
i
);
...
...
tests-clar/index/inmemory.c
View file @
a8122b5d
...
@@ -5,7 +5,7 @@ void test_index_inmemory__can_create_an_inmemory_index(void)
...
@@ -5,7 +5,7 @@ void test_index_inmemory__can_create_an_inmemory_index(void)
git_index
*
index
;
git_index
*
index
;
cl_git_pass
(
git_index_new
(
&
index
));
cl_git_pass
(
git_index_new
(
&
index
));
cl_assert_equal_i
(
0
,
git_index_entrycount
(
index
));
cl_assert_equal_i
(
0
,
(
int
)
git_index_entrycount
(
index
));
git_index_free
(
index
);
git_index_free
(
index
);
}
}
...
...
tests-clar/index/tests.c
View file @
a8122b5d
#include "clar_libgit2.h"
#include "clar_libgit2.h"
#include "index.h"
#include "index.h"
static
const
in
t
index_entry_count
=
109
;
static
const
size_
t
index_entry_count
=
109
;
static
const
in
t
index_entry_count_2
=
1437
;
static
const
size_
t
index_entry_count_2
=
1437
;
#define TEST_INDEX_PATH cl_fixture("testrepo.git/index")
#define TEST_INDEX_PATH cl_fixture("testrepo.git/index")
#define TEST_INDEX2_PATH cl_fixture("gitgit.index")
#define TEST_INDEX2_PATH cl_fixture("gitgit.index")
#define TEST_INDEXBIG_PATH cl_fixture("big.index")
#define TEST_INDEXBIG_PATH cl_fixture("big.index")
...
@@ -99,7 +99,7 @@ void test_index_tests__default_test_index(void)
...
@@ -99,7 +99,7 @@ void test_index_tests__default_test_index(void)
cl_git_pass
(
git_index_open
(
&
index
,
TEST_INDEX_PATH
));
cl_git_pass
(
git_index_open
(
&
index
,
TEST_INDEX_PATH
));
cl_assert
(
index
->
on_disk
);
cl_assert
(
index
->
on_disk
);
cl_assert
(
git_index_entrycount
(
index
)
==
(
unsigned
int
)
index_entry_count
);
cl_assert
(
git_index_entrycount
(
index
)
==
index_entry_count
);
cl_assert
(
index
->
entries
.
sorted
);
cl_assert
(
index
->
entries
.
sorted
);
entries
=
(
git_index_entry
**
)
index
->
entries
.
contents
;
entries
=
(
git_index_entry
**
)
index
->
entries
.
contents
;
...
@@ -122,7 +122,7 @@ void test_index_tests__gitgit_index(void)
...
@@ -122,7 +122,7 @@ void test_index_tests__gitgit_index(void)
cl_git_pass
(
git_index_open
(
&
index
,
TEST_INDEX2_PATH
));
cl_git_pass
(
git_index_open
(
&
index
,
TEST_INDEX2_PATH
));
cl_assert
(
index
->
on_disk
);
cl_assert
(
index
->
on_disk
);
cl_assert
(
git_index_entrycount
(
index
)
==
(
unsigned
int
)
index_entry_count_2
);
cl_assert
(
git_index_entrycount
(
index
)
==
index_entry_count_2
);
cl_assert
(
index
->
entries
.
sorted
);
cl_assert
(
index
->
entries
.
sorted
);
cl_assert
(
index
->
tree
!=
NULL
);
cl_assert
(
index
->
tree
!=
NULL
);
...
...
tests-clar/network/fetch.c
View file @
a8122b5d
...
@@ -29,7 +29,7 @@ static int update_tips(const char *refname, const git_oid *a, const git_oid *b,
...
@@ -29,7 +29,7 @@ static int update_tips(const char *refname, const git_oid *a, const git_oid *b,
static
void
progress
(
const
git_transfer_progress
*
stats
,
void
*
payload
)
static
void
progress
(
const
git_transfer_progress
*
stats
,
void
*
payload
)
{
{
int
*
bytes_received
=
(
int
*
)
payload
;
size_t
*
bytes_received
=
(
size_t
*
)
payload
;
*
bytes_received
=
stats
->
received_bytes
;
*
bytes_received
=
stats
->
received_bytes
;
}
}
...
@@ -37,7 +37,7 @@ static void do_fetch(const char *url, int flag, int n)
...
@@ -37,7 +37,7 @@ static void do_fetch(const char *url, int flag, int n)
{
{
git_remote
*
remote
;
git_remote
*
remote
;
git_remote_callbacks
callbacks
;
git_remote_callbacks
callbacks
;
in
t
bytes_received
=
0
;
size_
t
bytes_received
=
0
;
memset
(
&
callbacks
,
0
,
sizeof
(
git_remote_callbacks
));
memset
(
&
callbacks
,
0
,
sizeof
(
git_remote_callbacks
));
callbacks
.
update_tips
=
update_tips
;
callbacks
.
update_tips
=
update_tips
;
...
...
tests-clar/network/fetchlocal.c
View file @
a8122b5d
...
@@ -27,7 +27,7 @@ void test_network_fetchlocal__complete(void)
...
@@ -27,7 +27,7 @@ void test_network_fetchlocal__complete(void)
cl_git_pass
(
git_remote_update_tips
(
origin
));
cl_git_pass
(
git_remote_update_tips
(
origin
));
cl_git_pass
(
git_reference_list
(
&
refnames
,
repo
,
GIT_REF_LISTALL
));
cl_git_pass
(
git_reference_list
(
&
refnames
,
repo
,
GIT_REF_LISTALL
));
cl_assert_equal_i
(
18
,
refnames
.
count
);
cl_assert_equal_i
(
18
,
(
int
)
refnames
.
count
);
cl_assert
(
callcount
>
0
);
cl_assert
(
callcount
>
0
);
git_strarray_free
(
&
refnames
);
git_strarray_free
(
&
refnames
);
...
@@ -44,7 +44,7 @@ void test_network_fetchlocal__partial(void)
...
@@ -44,7 +44,7 @@ void test_network_fetchlocal__partial(void)
const
char
*
url
;
const
char
*
url
;
cl_git_pass
(
git_reference_list
(
&
refnames
,
repo
,
GIT_REF_LISTALL
));
cl_git_pass
(
git_reference_list
(
&
refnames
,
repo
,
GIT_REF_LISTALL
));
cl_assert_equal_i
(
1
,
refnames
.
count
);
cl_assert_equal_i
(
1
,
(
int
)
refnames
.
count
);
url
=
cl_git_fixture_url
(
"testrepo.git"
);
url
=
cl_git_fixture_url
(
"testrepo.git"
);
cl_git_pass
(
git_remote_add
(
&
origin
,
repo
,
GIT_REMOTE_ORIGIN
,
url
));
cl_git_pass
(
git_remote_add
(
&
origin
,
repo
,
GIT_REMOTE_ORIGIN
,
url
));
...
@@ -55,7 +55,7 @@ void test_network_fetchlocal__partial(void)
...
@@ -55,7 +55,7 @@ void test_network_fetchlocal__partial(void)
git_strarray_free
(
&
refnames
);
git_strarray_free
(
&
refnames
);
cl_git_pass
(
git_reference_list
(
&
refnames
,
repo
,
GIT_REF_LISTALL
));
cl_git_pass
(
git_reference_list
(
&
refnames
,
repo
,
GIT_REF_LISTALL
));
cl_assert_equal_i
(
19
,
refnames
.
count
);
/* 18 remote + 1 local */
cl_assert_equal_i
(
19
,
(
int
)
refnames
.
count
);
/* 18 remote + 1 local */
cl_assert
(
callcount
>
0
);
cl_assert
(
callcount
>
0
);
git_strarray_free
(
&
refnames
);
git_strarray_free
(
&
refnames
);
...
...
tests-clar/object/blob/filter.c
View file @
a8122b5d
...
@@ -43,7 +43,7 @@ void test_object_blob_filter__initialize(void)
...
@@ -43,7 +43,7 @@ void test_object_blob_filter__initialize(void)
for
(
i
=
0
;
i
<
NUM_TEST_OBJECTS
;
i
++
)
{
for
(
i
=
0
;
i
<
NUM_TEST_OBJECTS
;
i
++
)
{
size_t
len
=
(
g_len
[
i
]
<
0
)
?
strlen
(
g_raw
[
i
])
:
(
size_t
)
g_len
[
i
];
size_t
len
=
(
g_len
[
i
]
<
0
)
?
strlen
(
g_raw
[
i
])
:
(
size_t
)
g_len
[
i
];
g_len
[
i
]
=
(
in
t
)
len
;
g_len
[
i
]
=
(
git_off_
t
)
len
;
cl_git_pass
(
cl_git_pass
(
git_blob_create_frombuffer
(
&
g_oids
[
i
],
g_repo
,
g_raw
[
i
],
len
)
git_blob_create_frombuffer
(
&
g_oids
[
i
],
g_repo
,
g_raw
[
i
],
len
)
...
@@ -66,7 +66,7 @@ void test_object_blob_filter__unfiltered(void)
...
@@ -66,7 +66,7 @@ void test_object_blob_filter__unfiltered(void)
for
(
i
=
0
;
i
<
NUM_TEST_OBJECTS
;
i
++
)
{
for
(
i
=
0
;
i
<
NUM_TEST_OBJECTS
;
i
++
)
{
cl_git_pass
(
git_blob_lookup
(
&
blob
,
g_repo
,
&
g_oids
[
i
]));
cl_git_pass
(
git_blob_lookup
(
&
blob
,
g_repo
,
&
g_oids
[
i
]));
cl_assert
(
g_len
[
i
]
==
git_blob_rawsize
(
blob
));
cl_assert
(
g_len
[
i
]
==
git_blob_rawsize
(
blob
));
cl_assert
(
memcmp
(
git_blob_rawcontent
(
blob
),
g_raw
[
i
],
g_len
[
i
])
==
0
);
cl_assert
(
memcmp
(
git_blob_rawcontent
(
blob
),
g_raw
[
i
],
(
size_t
)
g_len
[
i
])
==
0
);
git_blob_free
(
blob
);
git_blob_free
(
blob
);
}
}
}
}
...
...
tests-clar/object/tree/duplicateentries.c
View file @
a8122b5d
...
@@ -42,7 +42,7 @@ static void tree_checker(
...
@@ -42,7 +42,7 @@ static void tree_checker(
git_oid
oid
;
git_oid
oid
;
cl_git_pass
(
git_tree_lookup
(
&
tree
,
_repo
,
tid
));
cl_git_pass
(
git_tree_lookup
(
&
tree
,
_repo
,
tid
));
cl_assert_equal_i
(
1
,
git_tree_entrycount
(
tree
));
cl_assert_equal_i
(
1
,
(
int
)
git_tree_entrycount
(
tree
));
entry
=
git_tree_entry_byindex
(
tree
,
0
);
entry
=
git_tree_entry_byindex
(
tree
,
0
);
cl_git_pass
(
git_oid_fromstr
(
&
oid
,
expected_sha
));
cl_git_pass
(
git_oid_fromstr
(
&
oid
,
expected_sha
));
...
...
tests-clar/refs/reflog/drop.c
View file @
a8122b5d
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
static
git_repository
*
g_repo
;
static
git_repository
*
g_repo
;
static
git_reflog
*
g_reflog
;
static
git_reflog
*
g_reflog
;
static
unsigned
in
t
entrycount
;
static
size_
t
entrycount
;
void
test_refs_reflog_drop__initialize
(
void
)
void
test_refs_reflog_drop__initialize
(
void
)
{
{
...
@@ -31,7 +31,7 @@ void test_refs_reflog_drop__dropping_a_non_exisiting_entry_from_the_log_returns_
...
@@ -31,7 +31,7 @@ void test_refs_reflog_drop__dropping_a_non_exisiting_entry_from_the_log_returns_
{
{
cl_assert_equal_i
(
GIT_ENOTFOUND
,
git_reflog_drop
(
g_reflog
,
entrycount
,
0
));
cl_assert_equal_i
(
GIT_ENOTFOUND
,
git_reflog_drop
(
g_reflog
,
entrycount
,
0
));
cl_assert_equal_
i
(
entrycount
,
git_reflog_entrycount
(
g_reflog
));
cl_assert_equal_
sz
(
entrycount
,
git_reflog_entrycount
(
g_reflog
));
}
}
void
test_refs_reflog_drop__can_drop_an_entry
(
void
)
void
test_refs_reflog_drop__can_drop_an_entry
(
void
)
...
@@ -39,7 +39,7 @@ void test_refs_reflog_drop__can_drop_an_entry(void)
...
@@ -39,7 +39,7 @@ void test_refs_reflog_drop__can_drop_an_entry(void)
cl_assert
(
entrycount
>
4
);
cl_assert
(
entrycount
>
4
);
cl_git_pass
(
git_reflog_drop
(
g_reflog
,
2
,
0
));
cl_git_pass
(
git_reflog_drop
(
g_reflog
,
2
,
0
));
cl_assert_equal_
i
(
entrycount
-
1
,
git_reflog_entrycount
(
g_reflog
));
cl_assert_equal_
sz
(
entrycount
-
1
,
git_reflog_entrycount
(
g_reflog
));
}
}
void
test_refs_reflog_drop__can_drop_an_entry_and_rewrite_the_log_history
(
void
)
void
test_refs_reflog_drop__can_drop_an_entry_and_rewrite_the_log_history
(
void
)
...
@@ -57,7 +57,7 @@ void test_refs_reflog_drop__can_drop_an_entry_and_rewrite_the_log_history(void)
...
@@ -57,7 +57,7 @@ void test_refs_reflog_drop__can_drop_an_entry_and_rewrite_the_log_history(void)
cl_git_pass
(
git_reflog_drop
(
g_reflog
,
1
,
1
));
cl_git_pass
(
git_reflog_drop
(
g_reflog
,
1
,
1
));
cl_assert_equal_
i
(
entrycount
-
1
,
git_reflog_entrycount
(
g_reflog
));
cl_assert_equal_
sz
(
entrycount
-
1
,
git_reflog_entrycount
(
g_reflog
));
after_current
=
git_reflog_entry_byindex
(
g_reflog
,
0
);
after_current
=
git_reflog_entry_byindex
(
g_reflog
,
0
);
...
@@ -72,7 +72,7 @@ void test_refs_reflog_drop__can_drop_the_oldest_entry(void)
...
@@ -72,7 +72,7 @@ void test_refs_reflog_drop__can_drop_the_oldest_entry(void)
cl_assert
(
entrycount
>
2
);
cl_assert
(
entrycount
>
2
);
cl_git_pass
(
git_reflog_drop
(
g_reflog
,
entrycount
-
1
,
0
));
cl_git_pass
(
git_reflog_drop
(
g_reflog
,
entrycount
-
1
,
0
));
cl_assert_equal_
i
(
entrycount
-
1
,
git_reflog_entrycount
(
g_reflog
));
cl_assert_equal_
sz
(
entrycount
-
1
,
git_reflog_entrycount
(
g_reflog
));
entry
=
git_reflog_entry_byindex
(
g_reflog
,
entrycount
-
2
);
entry
=
git_reflog_entry_byindex
(
g_reflog
,
entrycount
-
2
);
cl_assert
(
git_oid_streq
(
&
entry
->
oid_old
,
GIT_OID_HEX_ZERO
)
!=
0
);
cl_assert
(
git_oid_streq
(
&
entry
->
oid_old
,
GIT_OID_HEX_ZERO
)
!=
0
);
...
@@ -85,7 +85,7 @@ void test_refs_reflog_drop__can_drop_the_oldest_entry_and_rewrite_the_log_histor
...
@@ -85,7 +85,7 @@ void test_refs_reflog_drop__can_drop_the_oldest_entry_and_rewrite_the_log_histor
cl_assert
(
entrycount
>
2
);
cl_assert
(
entrycount
>
2
);
cl_git_pass
(
git_reflog_drop
(
g_reflog
,
entrycount
-
1
,
1
));
cl_git_pass
(
git_reflog_drop
(
g_reflog
,
entrycount
-
1
,
1
));
cl_assert_equal_
i
(
entrycount
-
1
,
git_reflog_entrycount
(
g_reflog
));
cl_assert_equal_
sz
(
entrycount
-
1
,
git_reflog_entrycount
(
g_reflog
));
entry
=
git_reflog_entry_byindex
(
g_reflog
,
entrycount
-
2
);
entry
=
git_reflog_entry_byindex
(
g_reflog
,
entrycount
-
2
);
cl_assert
(
git_oid_streq
(
&
entry
->
oid_old
,
GIT_OID_HEX_ZERO
)
==
0
);
cl_assert
(
git_oid_streq
(
&
entry
->
oid_old
,
GIT_OID_HEX_ZERO
)
==
0
);
...
@@ -101,7 +101,7 @@ void test_refs_reflog_drop__can_drop_all_the_entries(void)
...
@@ -101,7 +101,7 @@ void test_refs_reflog_drop__can_drop_all_the_entries(void)
cl_git_pass
(
git_reflog_drop
(
g_reflog
,
0
,
1
));
cl_git_pass
(
git_reflog_drop
(
g_reflog
,
0
,
1
));
cl_assert_equal_i
(
0
,
git_reflog_entrycount
(
g_reflog
));
cl_assert_equal_i
(
0
,
(
int
)
git_reflog_entrycount
(
g_reflog
));
}
}
void
test_refs_reflog_drop__can_persist_deletion_on_disk
(
void
)
void
test_refs_reflog_drop__can_persist_deletion_on_disk
(
void
)
...
@@ -112,7 +112,7 @@ void test_refs_reflog_drop__can_persist_deletion_on_disk(void)
...
@@ -112,7 +112,7 @@ void test_refs_reflog_drop__can_persist_deletion_on_disk(void)
cl_git_pass
(
git_reference_lookup
(
&
ref
,
g_repo
,
g_reflog
->
ref_name
));
cl_git_pass
(
git_reference_lookup
(
&
ref
,
g_repo
,
g_reflog
->
ref_name
));
cl_git_pass
(
git_reflog_drop
(
g_reflog
,
0
,
1
));
cl_git_pass
(
git_reflog_drop
(
g_reflog
,
0
,
1
));
cl_assert_equal_
i
(
entrycount
-
1
,
git_reflog_entrycount
(
g_reflog
));
cl_assert_equal_
sz
(
entrycount
-
1
,
git_reflog_entrycount
(
g_reflog
));
cl_git_pass
(
git_reflog_write
(
g_reflog
));
cl_git_pass
(
git_reflog_write
(
g_reflog
));
git_reflog_free
(
g_reflog
);
git_reflog_free
(
g_reflog
);
...
@@ -120,5 +120,5 @@ void test_refs_reflog_drop__can_persist_deletion_on_disk(void)
...
@@ -120,5 +120,5 @@ void test_refs_reflog_drop__can_persist_deletion_on_disk(void)
git_reflog_read
(
&
g_reflog
,
ref
);
git_reflog_read
(
&
g_reflog
,
ref
);
git_reference_free
(
ref
);
git_reference_free
(
ref
);
cl_assert_equal_
i
(
entrycount
-
1
,
git_reflog_entrycount
(
g_reflog
));
cl_assert_equal_
sz
(
entrycount
-
1
,
git_reflog_entrycount
(
g_reflog
));
}
}
tests-clar/refs/reflog/reflog.c
View file @
a8122b5d
...
@@ -66,7 +66,7 @@ void test_refs_reflog_reflog__append_then_read(void)
...
@@ -66,7 +66,7 @@ void test_refs_reflog_reflog__append_then_read(void)
/* Read and parse the reflog for this branch */
/* Read and parse the reflog for this branch */
cl_git_pass
(
git_reflog_read
(
&
reflog
,
lookedup_ref
));
cl_git_pass
(
git_reflog_read
(
&
reflog
,
lookedup_ref
));
cl_assert_equal_i
(
2
,
git_reflog_entrycount
(
reflog
));
cl_assert_equal_i
(
2
,
(
int
)
git_reflog_entrycount
(
reflog
));
entry
=
git_reflog_entry_byindex
(
reflog
,
1
);
entry
=
git_reflog_entry_byindex
(
reflog
,
1
);
assert_signature
(
committer
,
entry
->
committer
);
assert_signature
(
committer
,
entry
->
committer
);
...
@@ -143,7 +143,7 @@ void test_refs_reflog_reflog__reading_the_reflog_from_a_reference_with_no_log_re
...
@@ -143,7 +143,7 @@ void test_refs_reflog_reflog__reading_the_reflog_from_a_reference_with_no_log_re
cl_git_pass
(
git_reflog_read
(
&
reflog
,
subtrees
));
cl_git_pass
(
git_reflog_read
(
&
reflog
,
subtrees
));
cl_assert_equal_i
(
0
,
git_reflog_entrycount
(
reflog
));
cl_assert_equal_i
(
0
,
(
int
)
git_reflog_entrycount
(
reflog
));
git_reflog_free
(
reflog
);
git_reflog_free
(
reflog
);
git_reference_free
(
subtrees
);
git_reference_free
(
subtrees
);
...
...
tests-clar/stash/drop.c
View file @
a8122b5d
...
@@ -106,7 +106,7 @@ void test_stash_drop__dropping_an_entry_rewrites_reflog_history(void)
...
@@ -106,7 +106,7 @@ void test_stash_drop__dropping_an_entry_rewrites_reflog_history(void)
entry
=
git_reflog_entry_byindex
(
reflog
,
0
);
entry
=
git_reflog_entry_byindex
(
reflog
,
0
);
cl_assert_equal_i
(
0
,
git_oid_cmp
(
&
oid
,
git_reflog_entry_id_old
(
entry
)));
cl_assert_equal_i
(
0
,
git_oid_cmp
(
&
oid
,
git_reflog_entry_id_old
(
entry
)));
cl_assert_equal_
i
(
count
-
1
,
git_reflog_entrycount
(
reflog
));
cl_assert_equal_
sz
(
count
-
1
,
git_reflog_entrycount
(
reflog
));
git_reflog_free
(
reflog
);
git_reflog_free
(
reflog
);
...
...
tests-clar/status/worktree.c
View file @
a8122b5d
...
@@ -464,7 +464,7 @@ void test_status_worktree__status_file_without_index_or_workdir(void)
...
@@ -464,7 +464,7 @@ void test_status_worktree__status_file_without_index_or_workdir(void)
cl_git_pass
(
git_repository_set_workdir
(
repo
,
"wd"
,
false
));
cl_git_pass
(
git_repository_set_workdir
(
repo
,
"wd"
,
false
));
cl_git_pass
(
git_index_open
(
&
index
,
"empty-index"
));
cl_git_pass
(
git_index_open
(
&
index
,
"empty-index"
));
cl_assert_equal_i
(
0
,
git_index_entrycount
(
index
));
cl_assert_equal_i
(
0
,
(
int
)
git_index_entrycount
(
index
));
git_repository_set_index
(
repo
,
index
);
git_repository_set_index
(
repo
,
index
);
cl_git_pass
(
git_status_file
(
&
status
,
repo
,
"branch_file.txt"
));
cl_git_pass
(
git_status_file
(
&
status
,
repo
,
"branch_file.txt"
));
...
...
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