mirror of
https://git.proxmox.com/git/libgit2
synced 2025-07-06 01:49:24 +00:00
Fix warning, fix memory leak
This commit is contained in:
parent
e47f859db9
commit
6f8cc7bb6a
@ -56,14 +56,16 @@ static int checkout_conflictdata_cmp(const void *a, const void *b)
|
|||||||
|
|
||||||
int checkout_conflictdata_empty(const git_vector *conflicts, size_t idx)
|
int checkout_conflictdata_empty(const git_vector *conflicts, size_t idx)
|
||||||
{
|
{
|
||||||
const checkout_conflictdata *conflict;
|
checkout_conflictdata *conflict;
|
||||||
|
|
||||||
if ((conflict = git_vector_get(conflicts, idx)) == NULL)
|
if ((conflict = git_vector_get(conflicts, idx)) == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return (conflict->ancestor == NULL &&
|
if (conflict->ancestor || conflict->ours || conflict->theirs)
|
||||||
conflict->ours == NULL &&
|
return 0;
|
||||||
conflict->theirs == NULL);
|
|
||||||
|
git__free(conflict);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int checkout_conflicts_load(checkout_data *data, git_vector *conflicts)
|
static int checkout_conflicts_load(checkout_data *data, git_vector *conflicts)
|
||||||
@ -409,8 +411,7 @@ static int checkout_write_entry(
|
|||||||
const char *hint_path = NULL, *suffix;
|
const char *hint_path = NULL, *suffix;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
assert (side == conflict->ours ||
|
assert (side == conflict->ours || side == conflict->theirs);
|
||||||
side == conflict->theirs);
|
|
||||||
|
|
||||||
git_buf_truncate(&data->path, data->workdir_len);
|
git_buf_truncate(&data->path, data->workdir_len);
|
||||||
if (git_buf_puts(&data->path, side->path) < 0)
|
if (git_buf_puts(&data->path, side->path) < 0)
|
||||||
@ -423,7 +424,7 @@ static int checkout_write_entry(
|
|||||||
if (side == conflict->ours)
|
if (side == conflict->ours)
|
||||||
suffix = data->opts.our_label ? data->opts.our_label :
|
suffix = data->opts.our_label ? data->opts.our_label :
|
||||||
"ours";
|
"ours";
|
||||||
else if (side == conflict->theirs)
|
else
|
||||||
suffix = data->opts.their_label ? data->opts.their_label :
|
suffix = data->opts.their_label ? data->opts.their_label :
|
||||||
"theirs";
|
"theirs";
|
||||||
|
|
||||||
@ -456,7 +457,7 @@ static int checkout_merge_path(
|
|||||||
git_merge_file_result *result)
|
git_merge_file_result *result)
|
||||||
{
|
{
|
||||||
const char *our_label_raw, *their_label_raw, *suffix;
|
const char *our_label_raw, *their_label_raw, *suffix;
|
||||||
int i = 0, error = 0;
|
int error = 0;
|
||||||
|
|
||||||
if ((error = git_buf_joinpath(out, git_repository_workdir(data->repo), result->path)) < 0)
|
if ((error = git_buf_joinpath(out, git_repository_workdir(data->repo), result->path)) < 0)
|
||||||
return error;
|
return error;
|
||||||
|
Loading…
Reference in New Issue
Block a user