summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@github.com>2016-05-09 08:58:44 -0500
committerEdward Thomson <ethomson@github.com>2016-05-09 08:58:44 -0500
commitc148533024319689fca016f7c452d556265bb13f (patch)
tree0ba589b243c02dbdd49c18e2a5ccaafda63f2002
parent6f02f198c8d07585daf5c1fb1bba69b05eea3807 (diff)
parentfe3057b4b9bbab028d7cd18ce06edc034847f844 (diff)
downloadlibgit2-c148533024319689fca016f7c452d556265bb13f.tar.gz
Merge pull request #3767 from pks-t/pks/misc-fixes
Misc fixes
-rw-r--r--src/checkout.c6
-rw-r--r--src/delta-apply.c10
-rw-r--r--src/diff.c16
-rw-r--r--src/index.c2
-rw-r--r--src/merge_file.c8
-rw-r--r--src/odb_loose.c2
6 files changed, 21 insertions, 23 deletions
diff --git a/src/checkout.c b/src/checkout.c
index fed1819aa..d84b46ba7 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -1360,9 +1360,11 @@ fail:
static bool should_remove_existing(checkout_data *data)
{
- int ignorecase = 0;
+ int ignorecase;
- git_repository__cvar(&ignorecase, data->repo, GIT_CVAR_IGNORECASE);
+ if (git_repository__cvar(&ignorecase, data->repo, GIT_CVAR_IGNORECASE) < 0) {
+ ignorecase = 0;
+ }
return (ignorecase &&
(data->strategy & GIT_CHECKOUT_DONT_REMOVE_EXISTING) == 0);
diff --git a/src/delta-apply.c b/src/delta-apply.c
index 6e86a81db..02ec7b75e 100644
--- a/src/delta-apply.c
+++ b/src/delta-apply.c
@@ -121,13 +121,13 @@ int git__delta_apply(
size_t off = 0, len = 0;
if (cmd & 0x01) off = *delta++;
- if (cmd & 0x02) off |= *delta++ << 8;
- if (cmd & 0x04) off |= *delta++ << 16;
- if (cmd & 0x08) off |= *delta++ << 24;
+ if (cmd & 0x02) off |= *delta++ << 8UL;
+ if (cmd & 0x04) off |= *delta++ << 16UL;
+ if (cmd & 0x08) off |= *delta++ << 24UL;
if (cmd & 0x10) len = *delta++;
- if (cmd & 0x20) len |= *delta++ << 8;
- if (cmd & 0x40) len |= *delta++ << 16;
+ if (cmd & 0x20) len |= *delta++ << 8UL;
+ if (cmd & 0x40) len |= *delta++ << 16UL;
if (!len) len = 0x10000;
if (base_len < off + len || res_sz < len)
diff --git a/src/diff.c b/src/diff.c
index 64641daab..26c0b895b 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -1083,17 +1083,13 @@ static int handle_unmatched_new_item(
if (recurse_into_dir) {
error = iterator_advance_into(&info->nitem, info->new_iter);
- /* if real error or no error, proceed with iteration */
- if (error != GIT_ENOTFOUND)
- return error;
- giterr_clear();
+ /* if directory is empty, can't advance into it, so skip it */
+ if (error == GIT_ENOTFOUND) {
+ giterr_clear();
+ error = iterator_advance(&info->nitem, info->new_iter);
+ }
- /* if directory is empty, can't advance into it, so either skip
- * it or ignore it
- */
- if (error == GIT_ENOTFOUND || contains_oitem)
- return iterator_advance(&info->nitem, info->new_iter);
- delta_type = GIT_DELTA_IGNORED;
+ return error;
}
}
diff --git a/src/index.c b/src/index.c
index 63e47965a..31cb27d6c 100644
--- a/src/index.c
+++ b/src/index.c
@@ -3008,7 +3008,7 @@ int git_index_read_index(
if (error < 0) {
giterr_set(GITERR_INDEX, "failed to insert entry");
- return error;
+ goto done;
}
if (diff <= 0) {
diff --git a/src/merge_file.c b/src/merge_file.c
index 731f4b724..3f14a4f63 100644
--- a/src/merge_file.c
+++ b/src/merge_file.c
@@ -134,8 +134,8 @@ static int merge_file__xdiff(
path = git_merge_file__best_path(
ancestor ? ancestor->path : NULL,
- ours ? ours->path : NULL,
- theirs ? theirs->path : NULL);
+ ours->path,
+ theirs->path);
if (path != NULL && (out->path = git__strdup(path)) == NULL) {
error = -1;
@@ -147,8 +147,8 @@ static int merge_file__xdiff(
out->len = mmbuffer.size;
out->mode = git_merge_file__best_mode(
ancestor ? ancestor->mode : 0,
- ours ? ours->mode : 0,
- theirs ? theirs->mode : 0);
+ ours->mode,
+ theirs->mode);
done:
if (error < 0)
diff --git a/src/odb_loose.c b/src/odb_loose.c
index 9d9bffd21..3c33160d0 100644
--- a/src/odb_loose.c
+++ b/src/odb_loose.c
@@ -91,7 +91,7 @@ static int object_mkdir(const git_buf *name, const loose_backend *be)
static size_t get_binary_object_header(obj_hdr *hdr, git_buf *obj)
{
- unsigned char c;
+ unsigned long c;
unsigned char *data = (unsigned char *)obj->ptr;
size_t shift, size, used = 0;