summaryrefslogtreecommitdiff
path: root/tree-diff.c
diff options
context:
space:
mode:
Diffstat (limited to 'tree-diff.c')
-rw-r--r--tree-diff.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/tree-diff.c b/tree-diff.c
index 1af8219033..6a677daa7a 100644
--- a/tree-diff.c
+++ b/tree-diff.c
@@ -178,18 +178,24 @@ int diff_tree(struct tree_desc *t1, struct tree_desc *t2,
update_tree_entry(t1);
continue;
}
- switch (compare_tree_entry(t1, t2, &base, opt)) {
- case -1:
+
+ cmp = compare_tree_entry(t1, t2, &base, opt);
+
+ /* t1 = t2 */
+ if (cmp == 0) {
update_tree_entry(t1);
- continue;
- case 0:
+ update_tree_entry(t2);
+ }
+
+ /* t1 < t2 */
+ else if (cmp < 0) {
update_tree_entry(t1);
- /* Fallthrough */
- case 1:
+ }
+
+ /* t1 > t2 */
+ else {
update_tree_entry(t2);
- continue;
}
- die("git diff-tree: internal error");
}
strbuf_release(&base);