]> git.ipfire.org Git - thirdparty/git.git/commitdiff
line-log: simplify condition checking for merge commits
authorSZEDER Gábor <szeder.dev@gmail.com>
Sun, 24 Aug 2025 19:06:44 +0000 (21:06 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 25 Aug 2025 15:30:27 +0000 (08:30 -0700)
In process_ranges_arbitrary_commit() the condition deciding whether
the given commit is not a merge, i.e. that it doesn't have more than
one parent, is head-scratchingly backwards, flip it.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
line-log.c

index 71fa857ee83a79cc80a37d875b12b3be8cf0f432..188d387d40f58dba6fa1baa52fed138367117d6a 100644 (file)
@@ -1273,10 +1273,10 @@ int line_log_process_ranges_arbitrary_commit(struct rev_info *rev, struct commit
                        struct line_log_data *prange = line_log_data_copy(range);
                        add_line_range(rev, commit->parents->item, prange);
                        clear_commit_line_range(rev, commit);
-               } else if (!commit->parents || !commit->parents->next)
-                       changed = process_ranges_ordinary_commit(rev, commit, range);
-               else
+               } else if (commit->parents && commit->parents->next)
                        changed = process_ranges_merge_commit(rev, commit, range);
+               else
+                       changed = process_ranges_ordinary_commit(rev, commit, range);
        }
 
        if (!changed)