mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-02 10:25:30 +00:00
Fix warnings on Win64 build
This commit is contained in:
parent
4604a65460
commit
a8122b5d4a
@ -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
|
||||
* @return integer of count of current entries
|
||||
*/
|
||||
GIT_EXTERN(unsigned int) 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.
|
||||
|
21
src/delta.c
21
src/delta.c
@ -148,7 +148,7 @@ git_delta_create_index(const void *buf, unsigned long bufsize)
|
||||
/* Determine index hash size. Note that indexing skips the
|
||||
first byte to allow for optimizing the Rabin's polynomial
|
||||
initialization in create_delta(). */
|
||||
entries = (bufsize - 1) / RABIN_WINDOW;
|
||||
entries = (unsigned int)(bufsize - 1) / RABIN_WINDOW;
|
||||
if (bufsize >= 0xffffffffUL) {
|
||||
/*
|
||||
* Current delta format can't encode offsets into
|
||||
@ -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)
|
||||
|
||||
void *
|
||||
git_delta_create(const struct git_delta_index *index,
|
||||
const void *trg_buf, unsigned long trg_size,
|
||||
unsigned long *delta_size, unsigned long max_size)
|
||||
git_delta_create(
|
||||
const struct git_delta_index *index,
|
||||
const void *trg_buf,
|
||||
unsigned long trg_size,
|
||||
unsigned long *delta_size,
|
||||
unsigned long max_size)
|
||||
{
|
||||
unsigned int i, outpos, outsize, moff, msize, val;
|
||||
int inscnt;
|
||||
@ -332,7 +335,7 @@ git_delta_create(const struct git_delta_index *index,
|
||||
outpos = 0;
|
||||
outsize = 8192;
|
||||
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);
|
||||
if (!out)
|
||||
return NULL;
|
||||
@ -377,19 +380,19 @@ git_delta_create(const struct git_delta_index *index,
|
||||
for (entry = index->hash[i]; entry < index->hash[i+1]; entry++) {
|
||||
const unsigned char *ref = entry->ptr;
|
||||
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)
|
||||
continue;
|
||||
if (ref_size > (unsigned int)(top - src))
|
||||
ref_size = top - src;
|
||||
ref_size = (unsigned int)(top - src);
|
||||
if (ref_size <= msize)
|
||||
break;
|
||||
while (ref_size-- && *src++ == *ref)
|
||||
ref++;
|
||||
if (msize < (unsigned int)(ref - entry->ptr)) {
|
||||
/* this is our best match so far */
|
||||
msize = ref - entry->ptr;
|
||||
moff = entry->ptr - ref_data;
|
||||
msize = (unsigned int)(ref - entry->ptr);
|
||||
moff = (unsigned int)(entry->ptr - ref_data);
|
||||
if (msize >= 4096) /* good enough */
|
||||
break;
|
||||
}
|
||||
|
36
src/delta.h
36
src/delta.h
@ -46,11 +46,12 @@ extern unsigned long git_delta_sizeof_index(struct git_delta_index *index);
|
||||
* returned and *delta_size is updated with its size. The returned buffer
|
||||
* must be freed by the caller.
|
||||
*/
|
||||
extern void *
|
||||
git_delta_create(const struct git_delta_index *index,
|
||||
const void *buf, unsigned long bufsize,
|
||||
unsigned long *delta_size,
|
||||
unsigned long max_delta_size);
|
||||
extern void *git_delta_create(
|
||||
const struct git_delta_index *index,
|
||||
const void *buf,
|
||||
unsigned long bufsize,
|
||||
unsigned long *delta_size,
|
||||
unsigned long max_delta_size);
|
||||
|
||||
/*
|
||||
* diff_delta: create a delta from source buffer to target buffer
|
||||
@ -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
|
||||
* updated with its size. The returned buffer must be freed by the caller.
|
||||
*/
|
||||
GIT_INLINE(void *)
|
||||
git_delta(const void *src_buf, unsigned long src_bufsize,
|
||||
const void *trg_buf, unsigned long trg_bufsize,
|
||||
unsigned long *delta_size, unsigned long max_delta_size)
|
||||
GIT_INLINE(void *) git_delta(
|
||||
const void *src_buf, unsigned long src_bufsize,
|
||||
const void *trg_buf, unsigned long trg_bufsize,
|
||||
unsigned long *delta_size,
|
||||
unsigned long max_delta_size)
|
||||
{
|
||||
struct git_delta_index *index = git_delta_create_index(src_buf, src_bufsize);
|
||||
if (index) {
|
||||
void *delta = git_delta_create(index, trg_buf, trg_bufsize,
|
||||
delta_size, max_delta_size);
|
||||
void *delta = git_delta_create(
|
||||
index, trg_buf, trg_bufsize, delta_size, max_delta_size);
|
||||
git_delta_free_index(index);
|
||||
return delta;
|
||||
}
|
||||
@ -82,9 +84,10 @@ git_delta(const void *src_buf, unsigned long src_bufsize,
|
||||
* *trg_bufsize is updated with its size. On failure a NULL pointer is
|
||||
* returned. The returned buffer must be freed by the caller.
|
||||
*/
|
||||
extern void *git_delta_patch(const void *src_buf, unsigned long src_size,
|
||||
const void *delta_buf, unsigned long delta_size,
|
||||
unsigned long *dst_size);
|
||||
extern void *git_delta_patch(
|
||||
const void *src_buf, unsigned long src_size,
|
||||
const void *delta_buf, unsigned long delta_size,
|
||||
unsigned long *dst_size);
|
||||
|
||||
/* the smallest possible delta size is 4 bytes */
|
||||
#define GIT_DELTA_SIZE_MIN 4
|
||||
@ -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
|
||||
* expected source buffer size, and again to get the target buffer size.
|
||||
*/
|
||||
GIT_INLINE(unsigned long)
|
||||
git_delta_get_hdr_size(const unsigned char **datap,
|
||||
const unsigned char *top)
|
||||
GIT_INLINE(unsigned long) git_delta_get_hdr_size(
|
||||
const unsigned char **datap, const unsigned char *top)
|
||||
{
|
||||
const unsigned char *data = *datap;
|
||||
unsigned long cmd, size = 0;
|
||||
|
@ -262,7 +262,7 @@ static int get_blob_content(
|
||||
return error;
|
||||
|
||||
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);
|
||||
}
|
||||
@ -1236,14 +1236,18 @@ static void set_data_from_blob(
|
||||
git_blob *blob, git_map *map, git_diff_file *file)
|
||||
{
|
||||
if (blob) {
|
||||
map->data = (char *)git_blob_rawcontent(blob);
|
||||
file->size = map->len = git_blob_rawsize(blob);
|
||||
file->size = git_blob_rawsize(blob);
|
||||
git_oid_cpy(&file->oid, git_object_id((const git_object *)blob));
|
||||
file->mode = 0644;
|
||||
|
||||
map->len = (size_t)file->size;
|
||||
map->data = (char *)git_blob_rawcontent(blob);
|
||||
} else {
|
||||
map->data = "";
|
||||
file->size = map->len = 0;
|
||||
file->size = 0;
|
||||
file->flags |= GIT_DIFF_FILE_NO_DATA;
|
||||
|
||||
map->len = 0;
|
||||
map->data = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ GIT_INLINE(int) hash_cryptoapi_update(git_hash_ctx *ctx, const void *data, size_
|
||||
{
|
||||
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 0;
|
||||
@ -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)
|
||||
{
|
||||
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 0;
|
||||
|
21
src/index.c
21
src/index.c
@ -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);
|
||||
}
|
||||
|
||||
unsigned int git_index_entrycount(const git_index *index)
|
||||
size_t git_index_entrycount(const git_index *index)
|
||||
{
|
||||
assert(index);
|
||||
return (unsigned int)index->entries.length;
|
||||
return index->entries.length;
|
||||
}
|
||||
|
||||
const git_index_entry *git_index_get_byindex(
|
||||
@ -852,7 +852,7 @@ int git_index_conflict_add(git_index *index,
|
||||
const git_index_entry *their_entry)
|
||||
{
|
||||
git_index_entry *entries[3] = { 0 };
|
||||
size_t i;
|
||||
unsigned short i;
|
||||
int ret = 0;
|
||||
|
||||
assert (index);
|
||||
@ -890,7 +890,7 @@ int git_index_conflict_get(git_index_entry **ancestor_out,
|
||||
git_index_entry **their_out,
|
||||
git_index *index, const char *path)
|
||||
{
|
||||
int pos, stage;
|
||||
int pos, posmax, stage;
|
||||
git_index_entry *conflict_entry;
|
||||
int error = GIT_ENOTFOUND;
|
||||
|
||||
@ -903,7 +903,8 @@ int git_index_conflict_get(git_index_entry **ancestor_out,
|
||||
if ((pos = git_index_find(index, path)) < 0)
|
||||
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);
|
||||
|
||||
if (index->entries_cmp_path(conflict_entry->path, path) != 0)
|
||||
@ -927,8 +928,6 @@ int git_index_conflict_get(git_index_entry **ancestor_out,
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
||||
++pos;
|
||||
}
|
||||
|
||||
return error;
|
||||
@ -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 pos;
|
||||
int pos, posmax;
|
||||
git_index_entry *conflict_entry;
|
||||
int error = 0;
|
||||
|
||||
@ -945,7 +944,9 @@ int git_index_conflict_remove(git_index *index, const char *path)
|
||||
if ((pos = git_index_find(index, path)) < 0)
|
||||
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);
|
||||
|
||||
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)
|
||||
|
||||
memset(&extension, 0x0, sizeof(struct index_extension));
|
||||
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);
|
||||
|
||||
|
@ -329,7 +329,7 @@ int git_iterator_for_tree_range(
|
||||
typedef struct {
|
||||
git_iterator base;
|
||||
git_index *index;
|
||||
unsigned int current;
|
||||
size_t current;
|
||||
bool free_index;
|
||||
} index_iterator;
|
||||
|
||||
|
@ -229,7 +229,7 @@ static int gen_pack_object_header(
|
||||
}
|
||||
*hdr++ = c;
|
||||
|
||||
return hdr - hdr_base;
|
||||
return (int)(hdr - hdr_base);
|
||||
}
|
||||
|
||||
static int get_delta(void **out, git_odb *odb, git_pobject *po)
|
||||
@ -244,9 +244,10 @@ static int get_delta(void **out, git_odb *odb, git_pobject *po)
|
||||
git_odb_read(&trg, odb, &po->id) < 0)
|
||||
goto on_error;
|
||||
|
||||
delta_buf = git_delta(git_odb_object_data(src), git_odb_object_size(src),
|
||||
git_odb_object_data(trg), git_odb_object_size(trg),
|
||||
&delta_size, 0);
|
||||
delta_buf = git_delta(
|
||||
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);
|
||||
|
||||
if (!delta_buf || delta_size != po->delta_size) {
|
||||
giterr_set(GITERR_INVALID, "Delta size changed");
|
||||
@ -287,7 +288,7 @@ static int write_object(git_buf *buf, git_packbuilder *pb, git_pobject *po)
|
||||
goto on_error;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -315,7 +316,7 @@ static int write_object(git_buf *buf, git_packbuilder *pb, git_pobject *po)
|
||||
if (po->delta)
|
||||
git__free(data);
|
||||
data = zbuf.ptr;
|
||||
size = zbuf.size;
|
||||
size = (unsigned long)zbuf.size;
|
||||
}
|
||||
|
||||
if (git_buf_put(buf, data, size) < 0 ||
|
||||
@ -707,7 +708,7 @@ static int try_delta(git_packbuilder *pb, struct unpacked *trg,
|
||||
return 0;
|
||||
|
||||
/* Now some size filtering heuristics. */
|
||||
trg_size = trg_object->size;
|
||||
trg_size = (unsigned long)trg_object->size;
|
||||
if (!trg_object->delta) {
|
||||
max_size = trg_size/2 - 20;
|
||||
ref_depth = 1;
|
||||
@ -721,7 +722,7 @@ static int try_delta(git_packbuilder *pb, struct unpacked *trg,
|
||||
if (max_size == 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;
|
||||
if (sizediff >= max_size)
|
||||
return 0;
|
||||
@ -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)
|
||||
return -1;
|
||||
|
||||
sz = git_odb_object_size(obj);
|
||||
sz = (unsigned long)git_odb_object_size(obj);
|
||||
trg->data = git__malloc(sz);
|
||||
GITERR_CHECK_ALLOC(trg->data);
|
||||
memcpy(trg->data, git_odb_object_data(obj), sz);
|
||||
@ -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)
|
||||
return -1;
|
||||
|
||||
sz = git_odb_object_size(obj);
|
||||
sz = (unsigned long)git_odb_object_size(obj);
|
||||
src->data = git__malloc(sz);
|
||||
GITERR_CHECK_ALLOC(src->data);
|
||||
memcpy(src->data, git_odb_object_data(obj), sz);
|
||||
@ -835,7 +836,7 @@ static unsigned long free_unpacked(struct unpacked *n)
|
||||
git_delta_free_index(n->index);
|
||||
n->index = NULL;
|
||||
if (n->data) {
|
||||
freed_mem += n->object->size;
|
||||
freed_mem += (unsigned long)n->object->size;
|
||||
git__free(n->data);
|
||||
n->data = NULL;
|
||||
}
|
||||
@ -941,7 +942,7 @@ static int find_deltas(git_packbuilder *pb, git_pobject **list,
|
||||
GITERR_CHECK_ALLOC(po->delta_data);
|
||||
|
||||
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_packbuilder__cache_lock(pb);
|
||||
|
23
src/reflog.c
23
src/reflog.c
@ -275,7 +275,7 @@ int git_reflog_write(git_reflog *reflog)
|
||||
if ((error = git_filebuf_write(&fbuf, log.ptr, log.size)) < 0)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
||||
error = git_filebuf_commit(&fbuf, GIT_REFLOG_FILE_MODE);
|
||||
goto success;
|
||||
|
||||
@ -411,18 +411,20 @@ size_t git_reflog_entrycount(git_reflog *reflog)
|
||||
return reflog->entries.length;
|
||||
}
|
||||
|
||||
GIT_INLINE(size_t) reflog_inverse_index(size_t idx, size_t total)
|
||||
{
|
||||
return (total - 1) - idx;
|
||||
}
|
||||
|
||||
const git_reflog_entry * git_reflog_entry_byindex(git_reflog *reflog, size_t idx)
|
||||
{
|
||||
int pos;
|
||||
|
||||
assert(reflog);
|
||||
|
||||
pos = git_reflog_entrycount(reflog) - (idx + 1);
|
||||
|
||||
if (pos < 0)
|
||||
if (idx >= reflog->entries.length)
|
||||
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)
|
||||
@ -454,7 +456,7 @@ int git_reflog_drop(
|
||||
size_t idx,
|
||||
int rewrite_previous_entry)
|
||||
{
|
||||
unsigned int entrycount;
|
||||
size_t entrycount;
|
||||
git_reflog_entry *entry, *previous;
|
||||
|
||||
assert(reflog);
|
||||
@ -468,7 +470,8 @@ int git_reflog_drop(
|
||||
|
||||
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;
|
||||
|
||||
if (!rewrite_previous_entry)
|
||||
@ -489,7 +492,7 @@ int git_reflog_drop(
|
||||
/* ...clear the oid_old member of the "new" oldest entry */
|
||||
if (git_oid_fromstr(&entry->oid_old, GIT_OID_HEX_ZERO) < 0)
|
||||
return -1;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
int content;
|
||||
int32_t content;
|
||||
const char *end_ptr;
|
||||
|
||||
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)
|
||||
if (*end_ptr != '\0')
|
||||
return -1;
|
||||
|
||||
*n = content;
|
||||
*n = (int)content;
|
||||
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 int 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_reflog *reflog = NULL;
|
||||
regex_t preg;
|
||||
int numentries, i, cur, error = -1;
|
||||
int error = -1;
|
||||
size_t i, numentries, cur;
|
||||
const git_reflog_entry *entry;
|
||||
const char *msg;
|
||||
regmatch_t regexmatches[2];
|
||||
@ -204,7 +205,7 @@ static int retrieve_previously_checked_out_branch_or_revision(git_object **out,
|
||||
for (i = 0; i < numentries; i++) {
|
||||
entry = git_reflog_entry_byindex(reflog, i);
|
||||
msg = git_reflog_entry_message(entry);
|
||||
|
||||
|
||||
if (regexec(&preg, msg, 2, regexmatches, 0))
|
||||
continue;
|
||||
|
||||
@ -212,7 +213,7 @@ static int retrieve_previously_checked_out_branch_or_revision(git_object **out,
|
||||
|
||||
if (cur > 0)
|
||||
continue;
|
||||
|
||||
|
||||
git_buf_put(&buf, msg+regexmatches[1].rm_so, regexmatches[1].rm_eo - regexmatches[1].rm_so);
|
||||
|
||||
if ((error = disambiguate_refname(base_ref, repo, git_buf_cstr(&buf))) == 0)
|
||||
@ -225,7 +226,7 @@ static int retrieve_previously_checked_out_branch_or_revision(git_object **out,
|
||||
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
||||
error = GIT_ENOTFOUND;
|
||||
|
||||
cleanup:
|
||||
@ -236,27 +237,25 @@ cleanup:
|
||||
return error;
|
||||
}
|
||||
|
||||
static int retrieve_oid_from_reflog(git_oid *oid, git_reference *ref, unsigned int identifier)
|
||||
static int retrieve_oid_from_reflog(git_oid *oid, git_reference *ref, size_t identifier)
|
||||
{
|
||||
git_reflog *reflog;
|
||||
int error = -1;
|
||||
unsigned int numentries;
|
||||
size_t numentries;
|
||||
const git_reflog_entry *entry;
|
||||
bool search_by_pos = (identifier <= 100000000);
|
||||
|
||||
if (git_reflog_read(&reflog, ref) < 0)
|
||||
return -1;
|
||||
|
||||
numentries = git_reflog_entrycount(reflog);
|
||||
numentries = git_reflog_entrycount(reflog);
|
||||
|
||||
if (search_by_pos) {
|
||||
if (numentries < identifier + 1) {
|
||||
giterr_set(
|
||||
GITERR_REFERENCE,
|
||||
"Reflog for '%s' has only %d entries, asked for %d",
|
||||
git_reference_name(ref),
|
||||
numentries,
|
||||
identifier);
|
||||
"Reflog for '%s' has only "PRIuZ" entries, asked for "PRIuZ,
|
||||
git_reference_name(ref), numentries, identifier);
|
||||
|
||||
error = GIT_ENOTFOUND;
|
||||
goto cleanup;
|
||||
@ -268,14 +267,14 @@ static int retrieve_oid_from_reflog(git_oid *oid, git_reference *ref, unsigned i
|
||||
goto cleanup;
|
||||
|
||||
} else {
|
||||
unsigned int i;
|
||||
size_t i;
|
||||
git_time commit_time;
|
||||
|
||||
for (i = 0; i < numentries; i++) {
|
||||
entry = git_reflog_entry_byindex(reflog, i);
|
||||
commit_time = git_reflog_entry_committer(entry)->when;
|
||||
|
||||
if (commit_time.time - identifier > 0)
|
||||
|
||||
if (commit_time.time > (git_time_t)identifier)
|
||||
continue;
|
||||
|
||||
git_oid_cpy(oid, git_reflog_entry_id_new(entry));
|
||||
@ -291,7 +290,7 @@ cleanup:
|
||||
return error;
|
||||
}
|
||||
|
||||
static int retrieve_revobject_from_reflog(git_object **out, git_reference **base_ref, git_repository *repo, const char *identifier, unsigned int 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_oid oid;
|
||||
@ -380,7 +379,7 @@ static int handle_at_syntax(git_object **out, git_reference **ref, const char *s
|
||||
if (git__date_parse(×tamp, curly_braces_content) < 0)
|
||||
goto cleanup;
|
||||
|
||||
error = retrieve_revobject_from_reflog(out, ref, repo, git_buf_cstr(&identifier), (unsigned int)timestamp);
|
||||
error = retrieve_revobject_from_reflog(out, ref, repo, git_buf_cstr(&identifier), (size_t)timestamp);
|
||||
|
||||
cleanup:
|
||||
git_buf_free(&identifier);
|
||||
@ -394,7 +393,7 @@ static git_otype parse_obj_type(const char *str)
|
||||
|
||||
if (!strcmp(str, "tree"))
|
||||
return GIT_OBJ_TREE;
|
||||
|
||||
|
||||
if (!strcmp(str, "blob"))
|
||||
return GIT_OBJ_BLOB;
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
const char *message;
|
||||
int pos = 0, len;
|
||||
size_t pos = 0, len;
|
||||
|
||||
if (append_abbreviated_oid(out, git_commit_id(commit)) < 0)
|
||||
return -1;
|
||||
|
@ -11,7 +11,7 @@
|
||||
static void plaintext_free(struct git_cred *cred)
|
||||
{
|
||||
git_cred_userpass_plaintext *c = (git_cred_userpass_plaintext *)cred;
|
||||
int pass_len = strlen(c->password);
|
||||
size_t pass_len = strlen(c->password);
|
||||
|
||||
git__free(c->username);
|
||||
|
||||
@ -19,6 +19,8 @@ static void plaintext_free(struct git_cred *cred)
|
||||
memset(c->password, 0x0, pass_len);
|
||||
git__free(c->password);
|
||||
|
||||
memset(c, 0, sizeof(*c));
|
||||
|
||||
git__free(c);
|
||||
}
|
||||
|
||||
@ -54,4 +56,4 @@ int git_cred_userpass_plaintext_new(
|
||||
|
||||
*cred = &c->parent;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ static int git_smart__recv_cb(gitno_buffer *buf)
|
||||
buf->offset += bytes_read;
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ typedef struct transport_smart_caps {
|
||||
include_tag:1;
|
||||
} transport_smart_caps;
|
||||
|
||||
typedef void (*packetsize_cb)(int received, void *payload);
|
||||
typedef void (*packetsize_cb)(size_t received, void *payload);
|
||||
|
||||
typedef struct {
|
||||
git_transport parent;
|
||||
|
@ -367,7 +367,7 @@ static int no_sideband(transport_smart *t, struct git_odb_writepack *writepack,
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct network_packetsize_payload
|
||||
struct network_packetsize_payload
|
||||
{
|
||||
git_transfer_progress_callback callback;
|
||||
void *payload;
|
||||
@ -375,7 +375,7 @@ struct network_packetsize_payload
|
||||
size_t last_fired_bytes;
|
||||
};
|
||||
|
||||
static void network_packetsize(int received, void *payload)
|
||||
static void network_packetsize(size_t received, void *payload)
|
||||
{
|
||||
struct network_packetsize_payload *npp = (struct network_packetsize_payload*)payload;
|
||||
|
||||
@ -384,8 +384,8 @@ static void network_packetsize(int received, void *payload)
|
||||
|
||||
/* Fire notification if the threshold is reached */
|
||||
if ((npp->stats->received_bytes - npp->last_fired_bytes) > NETWORK_XFER_THRESHOLD) {
|
||||
npp->last_fired_bytes = npp->stats->received_bytes;
|
||||
npp->callback(npp->stats, npp->payload);
|
||||
npp->last_fired_bytes = npp->stats->received_bytes;
|
||||
npp->callback(npp->stats, npp->payload);
|
||||
}
|
||||
}
|
||||
|
||||
@ -414,7 +414,7 @@ int git_smart__download_pack(
|
||||
|
||||
/* We might have something in the buffer already from negotiate_fetch */
|
||||
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 ||
|
||||
|
@ -376,7 +376,7 @@ replay:
|
||||
|
||||
if (!WinHttpReadData(s->request,
|
||||
(LPVOID)buffer,
|
||||
buf_size,
|
||||
(DWORD)buf_size,
|
||||
&dw_bytes_read))
|
||||
{
|
||||
giterr_set(GITERR_OS, "Failed to read data");
|
||||
|
18
src/tree.c
18
src/tree.c
@ -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);
|
||||
}
|
||||
|
||||
static unsigned int find_next_dir(const char *dirname, git_index *index, unsigned int 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;
|
||||
size_t dirlen, i, entries = git_index_entrycount(index);
|
||||
|
||||
dirlen = strlen(dirname);
|
||||
for (i = start; i < entries; ++i) {
|
||||
@ -399,11 +398,10 @@ static int write_tree(
|
||||
git_repository *repo,
|
||||
git_index *index,
|
||||
const char *dirname,
|
||||
unsigned int start)
|
||||
size_t start)
|
||||
{
|
||||
git_treebuilder *bld = NULL;
|
||||
|
||||
unsigned int i, entries = git_index_entrycount(index);
|
||||
size_t i, entries = git_index_entrycount(index);
|
||||
int error;
|
||||
size_t dirname_len = strlen(dirname);
|
||||
const git_tree_cache *cache;
|
||||
@ -411,13 +409,11 @@ static int write_tree(
|
||||
cache = git_tree_cache_get(index->tree, dirname);
|
||||
if (cache != NULL && cache->entries >= 0){
|
||||
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 (bld == NULL) {
|
||||
if ((error = git_treebuilder_create(&bld, NULL)) < 0 || bld == NULL)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* This loop is unfortunate, but necessary. The index doesn't have
|
||||
@ -494,7 +490,7 @@ static int write_tree(
|
||||
goto on_error;
|
||||
|
||||
git_treebuilder_free(bld);
|
||||
return i;
|
||||
return (int)i;
|
||||
|
||||
on_error:
|
||||
git_treebuilder_free(bld);
|
||||
|
@ -165,7 +165,7 @@ int git_vector_search2(
|
||||
|
||||
for (i = 0; i < v->length; ++i) {
|
||||
if (key_lookup(key, v->contents[i]) == 0)
|
||||
return i;
|
||||
return (int)i;
|
||||
}
|
||||
|
||||
return GIT_ENOTFOUND;
|
||||
|
@ -520,17 +520,17 @@ int p_inet_pton(int af, const char* src, void* dst)
|
||||
struct sockaddr_in6 sin6;
|
||||
struct sockaddr_in sin;
|
||||
} sa;
|
||||
size_t srcsize;
|
||||
int srcsize;
|
||||
|
||||
switch(af)
|
||||
{
|
||||
case AF_INET:
|
||||
sa.sin.sin_family = AF_INET;
|
||||
srcsize = sizeof (sa.sin);
|
||||
srcsize = (int)sizeof(sa.sin);
|
||||
break;
|
||||
case AF_INET6:
|
||||
sa.sin6.sin6_family = AF_INET6;
|
||||
srcsize = sizeof (sa.sin6);
|
||||
srcsize = (int)sizeof(sa.sin6);
|
||||
break;
|
||||
default:
|
||||
errno = WSAEPFNOSUPPORT;
|
||||
|
@ -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_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));
|
||||
|
||||
|
@ -134,7 +134,7 @@ void test_index_conflicts__remove(void)
|
||||
{
|
||||
const git_index_entry *entry;
|
||||
size_t i;
|
||||
|
||||
|
||||
cl_assert(git_index_entrycount(repo_index) == 8);
|
||||
|
||||
cl_git_pass(git_index_conflict_remove(repo_index, "conflicts-one.txt"));
|
||||
|
@ -22,7 +22,7 @@ void test_index_filemodes__read(void)
|
||||
static bool expected[6] = { 0, 1, 0, 1, 0, 1 };
|
||||
|
||||
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) {
|
||||
const git_index_entry *entry = git_index_get_byindex(index, i);
|
||||
|
@ -5,7 +5,7 @@ void test_index_inmemory__can_create_an_inmemory_index(void)
|
||||
git_index *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);
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include "clar_libgit2.h"
|
||||
#include "index.h"
|
||||
|
||||
static const int index_entry_count = 109;
|
||||
static const int index_entry_count_2 = 1437;
|
||||
static const size_t index_entry_count = 109;
|
||||
static const size_t index_entry_count_2 = 1437;
|
||||
#define TEST_INDEX_PATH cl_fixture("testrepo.git/index")
|
||||
#define TEST_INDEX2_PATH cl_fixture("gitgit.index")
|
||||
#define TEST_INDEXBIG_PATH cl_fixture("big.index")
|
||||
@ -99,7 +99,7 @@ void test_index_tests__default_test_index(void)
|
||||
cl_git_pass(git_index_open(&index, TEST_INDEX_PATH));
|
||||
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);
|
||||
|
||||
entries = (git_index_entry **)index->entries.contents;
|
||||
@ -122,7 +122,7 @@ void test_index_tests__gitgit_index(void)
|
||||
cl_git_pass(git_index_open(&index, TEST_INDEX2_PATH));
|
||||
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->tree != NULL);
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
int *bytes_received = (int*)payload;
|
||||
size_t *bytes_received = (size_t *)payload;
|
||||
*bytes_received = stats->received_bytes;
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ static void do_fetch(const char *url, int flag, int n)
|
||||
{
|
||||
git_remote *remote;
|
||||
git_remote_callbacks callbacks;
|
||||
int bytes_received = 0;
|
||||
size_t bytes_received = 0;
|
||||
|
||||
memset(&callbacks, 0, sizeof(git_remote_callbacks));
|
||||
callbacks.update_tips = update_tips;
|
||||
|
@ -27,7 +27,7 @@ void test_network_fetchlocal__complete(void)
|
||||
cl_git_pass(git_remote_update_tips(origin));
|
||||
|
||||
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);
|
||||
|
||||
git_strarray_free(&refnames);
|
||||
@ -44,7 +44,7 @@ void test_network_fetchlocal__partial(void)
|
||||
const char *url;
|
||||
|
||||
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");
|
||||
cl_git_pass(git_remote_add(&origin, repo, GIT_REMOTE_ORIGIN, url));
|
||||
@ -55,7 +55,7 @@ void test_network_fetchlocal__partial(void)
|
||||
git_strarray_free(&refnames);
|
||||
|
||||
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);
|
||||
|
||||
git_strarray_free(&refnames);
|
||||
|
@ -43,7 +43,7 @@ void test_object_blob_filter__initialize(void)
|
||||
|
||||
for (i = 0; i < NUM_TEST_OBJECTS; i++) {
|
||||
size_t len = (g_len[i] < 0) ? strlen(g_raw[i]) : (size_t)g_len[i];
|
||||
g_len[i] = (int)len;
|
||||
g_len[i] = (git_off_t)len;
|
||||
|
||||
cl_git_pass(
|
||||
git_blob_create_frombuffer(&g_oids[i], g_repo, g_raw[i], len)
|
||||
@ -66,7 +66,7 @@ void test_object_blob_filter__unfiltered(void)
|
||||
for (i = 0; i < NUM_TEST_OBJECTS; i++) {
|
||||
cl_git_pass(git_blob_lookup(&blob, g_repo, &g_oids[i]));
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ static void tree_checker(
|
||||
git_oid oid;
|
||||
|
||||
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);
|
||||
|
||||
cl_git_pass(git_oid_fromstr(&oid, expected_sha));
|
||||
|
@ -4,15 +4,15 @@
|
||||
|
||||
static git_repository *g_repo;
|
||||
static git_reflog *g_reflog;
|
||||
static unsigned int entrycount;
|
||||
static size_t entrycount;
|
||||
|
||||
void test_refs_reflog_drop__initialize(void)
|
||||
{
|
||||
git_reference *ref;
|
||||
|
||||
|
||||
g_repo = cl_git_sandbox_init("testrepo.git");
|
||||
cl_git_pass(git_reference_lookup(&ref, g_repo, "HEAD"));
|
||||
|
||||
|
||||
git_reflog_read(&g_reflog, ref);
|
||||
entrycount = git_reflog_entrycount(g_reflog);
|
||||
|
||||
@ -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(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)
|
||||
@ -39,7 +39,7 @@ void test_refs_reflog_drop__can_drop_an_entry(void)
|
||||
cl_assert(entrycount > 4);
|
||||
|
||||
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)
|
||||
@ -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_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);
|
||||
|
||||
@ -72,7 +72,7 @@ void test_refs_reflog_drop__can_drop_the_oldest_entry(void)
|
||||
cl_assert(entrycount > 2);
|
||||
|
||||
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);
|
||||
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
|
||||
cl_assert(entrycount > 2);
|
||||
|
||||
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);
|
||||
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)
|
||||
|
||||
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)
|
||||
@ -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_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));
|
||||
|
||||
git_reflog_free(g_reflog);
|
||||
@ -120,5 +120,5 @@ void test_refs_reflog_drop__can_persist_deletion_on_disk(void)
|
||||
git_reflog_read(&g_reflog, 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));
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ void test_refs_reflog_reflog__append_then_read(void)
|
||||
|
||||
/* Read and parse the reflog for this branch */
|
||||
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);
|
||||
assert_signature(committer, entry->committer);
|
||||
@ -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_assert_equal_i(0, git_reflog_entrycount(reflog));
|
||||
cl_assert_equal_i(0, (int)git_reflog_entrycount(reflog));
|
||||
|
||||
git_reflog_free(reflog);
|
||||
git_reference_free(subtrees);
|
||||
@ -160,7 +160,7 @@ void test_refs_reflog_reflog__cannot_write_a_moved_reflog(void)
|
||||
cl_git_pass(git_reflog_read(&reflog, master));
|
||||
|
||||
cl_git_pass(git_reflog_write(reflog));
|
||||
|
||||
|
||||
cl_git_pass(git_reference_rename(master, "refs/moved", 0));
|
||||
|
||||
cl_git_fail(git_reflog_write(reflog));
|
||||
|
@ -91,13 +91,13 @@ void test_stash_drop__dropping_an_entry_rewrites_reflog_history(void)
|
||||
push_three_states();
|
||||
|
||||
cl_git_pass(git_reference_lookup(&stash, repo, "refs/stash"));
|
||||
|
||||
|
||||
cl_git_pass(git_reflog_read(&reflog, stash));
|
||||
entry = git_reflog_entry_byindex(reflog, 1);
|
||||
|
||||
git_oid_cpy(&oid, git_reflog_entry_id_old(entry));
|
||||
count = git_reflog_entrycount(reflog);
|
||||
|
||||
|
||||
git_reflog_free(reflog);
|
||||
|
||||
cl_git_pass(git_stash_drop(repo, 1));
|
||||
@ -106,7 +106,7 @@ void test_stash_drop__dropping_an_entry_rewrites_reflog_history(void)
|
||||
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(count - 1, git_reflog_entrycount(reflog));
|
||||
cl_assert_equal_sz(count - 1, git_reflog_entrycount(reflog));
|
||||
|
||||
git_reflog_free(reflog);
|
||||
|
||||
|
@ -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_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);
|
||||
|
||||
cl_git_pass(git_status_file(&status, repo, "branch_file.txt"));
|
||||
|
Loading…
Reference in New Issue
Block a user