@@ -1541,7 +1541,45 @@ static int merge_index_insert_reuc(
1541
1541
mode [0 ], oid [0 ], mode [1 ], oid [1 ], mode [2 ], oid [2 ]);
1542
1542
}
1543
1543
1544
- int index_from_diff_list (git_index * * out , git_merge_diff_list * diff_list )
1544
+ static int index_update_reuc (git_index * index , git_merge_diff_list * diff_list )
1545
+ {
1546
+ int error ;
1547
+ size_t i ;
1548
+ git_merge_diff * conflict ;
1549
+
1550
+ /* Add each entry in the resolved conflict to the REUC independently, since
1551
+ * the paths may differ due to renames. */
1552
+ git_vector_foreach (& diff_list -> resolved , i , conflict ) {
1553
+ const git_index_entry * ancestor =
1554
+ GIT_MERGE_INDEX_ENTRY_EXISTS (conflict -> ancestor_entry ) ?
1555
+ & conflict -> ancestor_entry : NULL ;
1556
+
1557
+ const git_index_entry * ours =
1558
+ GIT_MERGE_INDEX_ENTRY_EXISTS (conflict -> our_entry ) ?
1559
+ & conflict -> our_entry : NULL ;
1560
+
1561
+ const git_index_entry * theirs =
1562
+ GIT_MERGE_INDEX_ENTRY_EXISTS (conflict -> their_entry ) ?
1563
+ & conflict -> their_entry : NULL ;
1564
+
1565
+ if (ancestor != NULL &&
1566
+ (error = merge_index_insert_reuc (index , TREE_IDX_ANCESTOR , ancestor )) < 0 )
1567
+ return error ;
1568
+
1569
+ if (ours != NULL &&
1570
+ (error = merge_index_insert_reuc (index , TREE_IDX_OURS , ours )) < 0 )
1571
+ return error ;
1572
+
1573
+ if (theirs != NULL &&
1574
+ (error = merge_index_insert_reuc (index , TREE_IDX_THEIRS , theirs )) < 0 )
1575
+ return error ;
1576
+ }
1577
+
1578
+ return 0 ;
1579
+ }
1580
+
1581
+ static int index_from_diff_list (git_index * * out ,
1582
+ git_merge_diff_list * diff_list , bool skip_reuc )
1545
1583
{
1546
1584
git_index * index ;
1547
1585
size_t i ;
@@ -1600,31 +1638,8 @@ int index_from_diff_list(git_index **out, git_merge_diff_list *diff_list)
1600
1638
}
1601
1639
}
1602
1640
1603
- /* Add each entry in the resolved conflict to the REUC independently, since
1604
- * the paths may differ due to renames. */
1605
- git_vector_foreach (& diff_list -> resolved , i , conflict ) {
1606
- const git_index_entry * ancestor =
1607
- GIT_MERGE_INDEX_ENTRY_EXISTS (conflict -> ancestor_entry ) ?
1608
- & conflict -> ancestor_entry : NULL ;
1609
-
1610
- const git_index_entry * ours =
1611
- GIT_MERGE_INDEX_ENTRY_EXISTS (conflict -> our_entry ) ?
1612
- & conflict -> our_entry : NULL ;
1613
-
1614
- const git_index_entry * theirs =
1615
- GIT_MERGE_INDEX_ENTRY_EXISTS (conflict -> their_entry ) ?
1616
- & conflict -> their_entry : NULL ;
1617
-
1618
- if (ancestor != NULL &&
1619
- (error = merge_index_insert_reuc (index , TREE_IDX_ANCESTOR , ancestor )) < 0 )
1620
- goto on_error ;
1621
-
1622
- if (ours != NULL &&
1623
- (error = merge_index_insert_reuc (index , TREE_IDX_OURS , ours )) < 0 )
1624
- goto on_error ;
1625
-
1626
- if (theirs != NULL &&
1627
- (error = merge_index_insert_reuc (index , TREE_IDX_THEIRS , theirs )) < 0 )
1641
+ if (!skip_reuc ) {
1642
+ if ((error = index_update_reuc (index , diff_list )) < 0 )
1628
1643
goto on_error ;
1629
1644
}
1630
1645
@@ -1633,7 +1648,6 @@ int index_from_diff_list(git_index **out, git_merge_diff_list *diff_list)
1633
1648
1634
1649
on_error :
1635
1650
git_index_free (index );
1636
-
1637
1651
return error ;
1638
1652
}
1639
1653
@@ -1715,7 +1729,8 @@ int git_merge__iterators(
1715
1729
if (!given_opts || !given_opts -> metric )
1716
1730
git__free (opts .metric );
1717
1731
1718
- error = index_from_diff_list (out , diff_list );
1732
+ error = index_from_diff_list (out , diff_list ,
1733
+ (opts .tree_flags & GIT_MERGE_TREE_SKIP_REUC ));
1719
1734
1720
1735
done :
1721
1736
git_merge_diff_list__free (diff_list );
0 commit comments