Skip to content

Commit fb79d7d

Browse files
committed
examples: our/their can be NULL
1 parent cc84559 commit fb79d7d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

examples/merge.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ static int perform_fastforward(git_repository *repo, const git_oid *target_oid,
204204

205205
static void output_conflicts(git_index *index)
206206
{
207-
/* Handle conflicts */
208207
git_index_conflict_iterator *conflicts;
209208
const git_index_entry *ancestor;
210209
const git_index_entry *our;
@@ -215,7 +214,9 @@ static void output_conflicts(git_index *index)
215214

216215
while ((err = git_index_conflict_next(&ancestor, &our, &their, conflicts)) == 0) {
217216
fprintf(stderr, "conflict: a:%s o:%s t:%s\n",
218-
ancestor ? ancestor->path : "", our->path, their->path);
217+
ancestor ? ancestor->path : "NULL",
218+
our->path ? our->path : "NULL",
219+
their->path ? their->path : "NULL");
219220
}
220221

221222
if (err != GIT_ITEROVER) {
@@ -376,6 +377,7 @@ int main(int argc, char **argv)
376377
check_lg2(git_repository_index(&index, repo), "failed to get repository index", NULL);
377378

378379
if (git_index_has_conflicts(index)) {
380+
/* Handle conflicts */
379381
output_conflicts(index);
380382
} else if (!opts.no_commit) {
381383
create_merge_commit(repo, index, &opts);

0 commit comments

Comments
 (0)