Skip to content

Commit c148533

Browse files
author
Edward Thomson
committed
Merge pull request libgit2#3767 from pks-t/pks/misc-fixes
Misc fixes
2 parents 6f02f19 + fe3057b commit c148533

File tree

6 files changed

+21
-23
lines changed

6 files changed

+21
-23
lines changed

src/checkout.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,9 +1360,11 @@ static int checkout_get_actions(
13601360

13611361
static bool should_remove_existing(checkout_data *data)
13621362
{
1363-
int ignorecase = 0;
1363+
int ignorecase;
13641364

1365-
git_repository__cvar(&ignorecase, data->repo, GIT_CVAR_IGNORECASE);
1365+
if (git_repository__cvar(&ignorecase, data->repo, GIT_CVAR_IGNORECASE) < 0) {
1366+
ignorecase = 0;
1367+
}
13661368

13671369
return (ignorecase &&
13681370
(data->strategy & GIT_CHECKOUT_DONT_REMOVE_EXISTING) == 0);

src/delta-apply.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,13 @@ int git__delta_apply(
121121
size_t off = 0, len = 0;
122122

123123
if (cmd & 0x01) off = *delta++;
124-
if (cmd & 0x02) off |= *delta++ << 8;
125-
if (cmd & 0x04) off |= *delta++ << 16;
126-
if (cmd & 0x08) off |= *delta++ << 24;
124+
if (cmd & 0x02) off |= *delta++ << 8UL;
125+
if (cmd & 0x04) off |= *delta++ << 16UL;
126+
if (cmd & 0x08) off |= *delta++ << 24UL;
127127

128128
if (cmd & 0x10) len = *delta++;
129-
if (cmd & 0x20) len |= *delta++ << 8;
130-
if (cmd & 0x40) len |= *delta++ << 16;
129+
if (cmd & 0x20) len |= *delta++ << 8UL;
130+
if (cmd & 0x40) len |= *delta++ << 16UL;
131131
if (!len) len = 0x10000;
132132

133133
if (base_len < off + len || res_sz < len)

src/diff.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,17 +1083,13 @@ static int handle_unmatched_new_item(
10831083
if (recurse_into_dir) {
10841084
error = iterator_advance_into(&info->nitem, info->new_iter);
10851085

1086-
/* if real error or no error, proceed with iteration */
1087-
if (error != GIT_ENOTFOUND)
1088-
return error;
1089-
giterr_clear();
1086+
/* if directory is empty, can't advance into it, so skip it */
1087+
if (error == GIT_ENOTFOUND) {
1088+
giterr_clear();
1089+
error = iterator_advance(&info->nitem, info->new_iter);
1090+
}
10901091

1091-
/* if directory is empty, can't advance into it, so either skip
1092-
* it or ignore it
1093-
*/
1094-
if (error == GIT_ENOTFOUND || contains_oitem)
1095-
return iterator_advance(&info->nitem, info->new_iter);
1096-
delta_type = GIT_DELTA_IGNORED;
1092+
return error;
10971093
}
10981094
}
10991095

src/index.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3008,7 +3008,7 @@ int git_index_read_index(
30083008

30093009
if (error < 0) {
30103010
giterr_set(GITERR_INDEX, "failed to insert entry");
3011-
return error;
3011+
goto done;
30123012
}
30133013

30143014
if (diff <= 0) {

src/merge_file.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ static int merge_file__xdiff(
134134

135135
path = git_merge_file__best_path(
136136
ancestor ? ancestor->path : NULL,
137-
ours ? ours->path : NULL,
138-
theirs ? theirs->path : NULL);
137+
ours->path,
138+
theirs->path);
139139

140140
if (path != NULL && (out->path = git__strdup(path)) == NULL) {
141141
error = -1;
@@ -147,8 +147,8 @@ static int merge_file__xdiff(
147147
out->len = mmbuffer.size;
148148
out->mode = git_merge_file__best_mode(
149149
ancestor ? ancestor->mode : 0,
150-
ours ? ours->mode : 0,
151-
theirs ? theirs->mode : 0);
150+
ours->mode,
151+
theirs->mode);
152152

153153
done:
154154
if (error < 0)

src/odb_loose.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static int object_mkdir(const git_buf *name, const loose_backend *be)
9191

9292
static size_t get_binary_object_header(obj_hdr *hdr, git_buf *obj)
9393
{
94-
unsigned char c;
94+
unsigned long c;
9595
unsigned char *data = (unsigned char *)obj->ptr;
9696
size_t shift, size, used = 0;
9797

0 commit comments

Comments
 (0)