Merge branch 'en/merge-multi-strategies'
The code that implements multi-strategy support in "git merge" has been clean-up a bit. * en/merge-multi-strategies: merge: small code readability improvement merge: cleanup confusing logic for handling successful merges
This commit is contained in:
commit
624a936234
@ -1693,7 +1693,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
|||||||
if (save_state(&stash))
|
if (save_state(&stash))
|
||||||
oidclr(&stash);
|
oidclr(&stash);
|
||||||
|
|
||||||
for (i = 0; !merge_was_ok && i < use_strategies_nr; i++) {
|
for (i = 0; i < use_strategies_nr; i++) {
|
||||||
int ret, cnt;
|
int ret, cnt;
|
||||||
if (i) {
|
if (i) {
|
||||||
printf(_("Rewinding the tree to pristine...\n"));
|
printf(_("Rewinding the tree to pristine...\n"));
|
||||||
@ -1708,7 +1708,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
|||||||
*/
|
*/
|
||||||
wt_strategy = use_strategies[i]->name;
|
wt_strategy = use_strategies[i]->name;
|
||||||
|
|
||||||
ret = try_merge_strategy(use_strategies[i]->name,
|
ret = try_merge_strategy(wt_strategy,
|
||||||
common, remoteheads,
|
common, remoteheads,
|
||||||
head_commit);
|
head_commit);
|
||||||
/*
|
/*
|
||||||
@ -1718,16 +1718,17 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
|||||||
*/
|
*/
|
||||||
if (ret < 2) {
|
if (ret < 2) {
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
if (option_commit) {
|
/*
|
||||||
/* Automerge succeeded. */
|
* This strategy worked; no point in trying
|
||||||
automerge_was_ok = 1;
|
* another.
|
||||||
break;
|
*/
|
||||||
}
|
|
||||||
merge_was_ok = 1;
|
merge_was_ok = 1;
|
||||||
|
best_strategy = wt_strategy;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
cnt = (use_strategies_nr > 1) ? evaluate_result() : 0;
|
cnt = (use_strategies_nr > 1) ? evaluate_result() : 0;
|
||||||
if (best_cnt <= 0 || cnt <= best_cnt) {
|
if (best_cnt <= 0 || cnt <= best_cnt) {
|
||||||
best_strategy = use_strategies[i]->name;
|
best_strategy = wt_strategy;
|
||||||
best_cnt = cnt;
|
best_cnt = cnt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1737,7 +1738,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
|||||||
* If we have a resulting tree, that means the strategy module
|
* If we have a resulting tree, that means the strategy module
|
||||||
* auto resolved the merge cleanly.
|
* auto resolved the merge cleanly.
|
||||||
*/
|
*/
|
||||||
if (automerge_was_ok) {
|
if (merge_was_ok && option_commit) {
|
||||||
|
automerge_was_ok = 1;
|
||||||
ret = finish_automerge(head_commit, head_subsumed,
|
ret = finish_automerge(head_commit, head_subsumed,
|
||||||
common, remoteheads,
|
common, remoteheads,
|
||||||
&result_tree, wt_strategy);
|
&result_tree, wt_strategy);
|
||||||
|
Loading…
Reference in New Issue
Block a user