summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEtienne Samson <samson.etienne@gmail.com>2018-01-17 02:34:32 +0100
committerEtienne Samson <samson.etienne@gmail.com>2018-01-25 22:14:39 +0100
commitfb79d7d12e7d8db55b6525cc4c70d16397aba867 (patch)
tree7899949105b5aebea3e243c409dbb7db5bb60458
parentcc845595f00808a12044aaf7446c10df3c96f8f7 (diff)
downloadlibgit2-fb79d7d12e7d8db55b6525cc4c70d16397aba867.tar.gz
examples: our/their can be NULL
-rw-r--r--examples/merge.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/examples/merge.c b/examples/merge.c
index 206a8c465..d64397179 100644
--- a/examples/merge.c
+++ b/examples/merge.c
@@ -204,7 +204,6 @@ static int perform_fastforward(git_repository *repo, const git_oid *target_oid,
static void output_conflicts(git_index *index)
{
- /* Handle conflicts */
git_index_conflict_iterator *conflicts;
const git_index_entry *ancestor;
const git_index_entry *our;
@@ -215,7 +214,9 @@ static void output_conflicts(git_index *index)
while ((err = git_index_conflict_next(&ancestor, &our, &their, conflicts)) == 0) {
fprintf(stderr, "conflict: a:%s o:%s t:%s\n",
- ancestor ? ancestor->path : "", our->path, their->path);
+ ancestor ? ancestor->path : "NULL",
+ our->path ? our->path : "NULL",
+ their->path ? their->path : "NULL");
}
if (err != GIT_ITEROVER) {
@@ -376,6 +377,7 @@ int main(int argc, char **argv)
check_lg2(git_repository_index(&index, repo), "failed to get repository index", NULL);
if (git_index_has_conflicts(index)) {
+ /* Handle conflicts */
output_conflicts(index);
} else if (!opts.no_commit) {
create_merge_commit(repo, index, &opts);