commit 18877383a0d783b0b642a27b16ccd3d1a212c8a3 from: James Cook date: Sat Jul 01 13:40:37 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 - 481cdc746b012203f39047cbc55f8b65ae40d046 commit + 18877383a0d783b0b642a27b16ccd3d1a212c8a3 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 - f0f73cb11cc2c22294fb3716a2eba2a4a2ba8be9 blob + 33fa9d308c2a4c7ed10e872de41279f2c5ba44bc --- got/got.c +++ got/got.c @@ -13165,6 +13165,7 @@ cmd_merge(int argc, char *argv[]) break; case 'C': allow_conflict = 1; + break; case 'c': continue_merge = 1; break; @@ -13183,18 +13184,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();