commit dcd455ee64953215a90ed4427762b5566d7e0047 from: James Cook via: Thomas Adam date: Wed Jul 05 15:54:47 2023 UTC fix option processing for 'got merge' Don't make -C imply -c (a break statement was missing). Detect -an and -cn conflicts. Simplify by removing unneeded check for conflicting -aC (since -C requires -c, we can rely on the -ac conflict being detected). Update the man page to say -cC is allowed. commit - 31009ade0db15d36e637f180ba64b28110b25208 commit + dcd455ee64953215a90ed4427762b5566d7e0047 blob - 234d94604d5296c784792c130bb88dd64b8393bb blob + 231499e9b3d7e9b5a4b16e309d923b73bc5fd97d --- got/got.1 +++ got/got.1 @@ -2939,7 +2939,8 @@ This option should generally be avoided, and can only option. .It Fl c Continue an interrupted merge operation. -If this option is used, no other command-line arguments are allowed. +If this option is used, no other command-line arguments are allowed except +.Fl C . .It Fl M Create a merge commit even if the branches have not diverged. .It Fl n blob - 84ed6b2a683960e7e435230c029073ac43e8965a blob + 0526c8c106c6401b581265328acbb5f43b0a01c5 --- got/got.c +++ got/got.c @@ -13164,6 +13164,7 @@ cmd_merge(int argc, char *argv[]) break; case 'C': allow_conflict = 1; + break; case 'c': continue_merge = 1; break; @@ -13182,18 +13183,23 @@ cmd_merge(int argc, char *argv[]) argc -= optind; argv += optind; + if (abort_merge) { + if (continue_merge) + option_conflict('a', 'c'); + if (!prefer_fast_forward) + option_conflict('a', 'M'); + if (interrupt_merge) + option_conflict('a', 'n'); + } else if (continue_merge) { + if (!prefer_fast_forward) + option_conflict('c', 'M'); + if (interrupt_merge) + option_conflict('c', 'n'); + } if (allow_conflict) { - if (abort_merge) - option_conflict('a', 'C'); if (!continue_merge) errx(1, "-C option requires -c"); } - if (abort_merge && continue_merge) - option_conflict('a', 'c'); - if (abort_merge && !prefer_fast_forward) - option_conflict('a', 'M'); - if (continue_merge && !prefer_fast_forward) - option_conflict('c', 'M'); if (abort_merge || continue_merge) { if (argc != 0) usage_merge();