{"thread":{"id":"60001","subject":"[PATCH] am: simplify parsing of \"--[no-]keep-cr\"","startedAt":"2023-07-18T18:23:53Z","lastAt":"2023-07-18T18:23:53Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"479604","messageId":"xmqqr0p5gjv3.fsf@gitster.g","threadId":"60001","inReplyTo":null,"subject":"[PATCH] am: simplify parsing of \"--[no-]keep-cr\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-07-18T18:22:40Z","receivedAt":"2023-07-18T18:23:53Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Command line options \"--keep-cr\" and its negation trigger\nOPT_SET_INT_F(PARSE_OPT_NONEG) to set a variable to 1 and 0\nrespectively.  Using OPT_SET_INT() to implement the positive variant\nthat sets the variable to 1 without specifying PARSE_OPT_NONEG gives\nus the negative variant to set it to 0 for free.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin/am.c | 9 +++------\n 1 file changed, 3 insertions(+), 6 deletions(-)\n\ndiff --git a/builtin/am.c b/builtin/am.c\nindex dcb89439b1..39d3e11f84 100644\n--- a/builtin/am.c\n+++ b/builtin/am.c\n@@ -2347,12 +2347,9 @@ int cmd_am(int argc, const char **argv, const char *prefix)\n \t\t\tN_(\"pass -b flag to git-mailinfo\"), KEEP_NON_PATCH),\n \t\tOPT_BOOL('m', \"message-id\", &state.message_id,\n \t\t\tN_(\"pass -m flag to git-mailinfo\")),\n-\t\tOPT_SET_INT_F(0, \"keep-cr\", &keep_cr,\n-\t\t\tN_(\"pass --keep-cr flag to git-mailsplit for mbox format\"),\n-\t\t\t1, PARSE_OPT_NONEG),\n-\t\tOPT_SET_INT_F(0, \"no-keep-cr\", &keep_cr,\n-\t\t\tN_(\"do not pass --keep-cr flag to git-mailsplit independent of am.keepcr\"),\n-\t\t\t0, PARSE_OPT_NONEG),\n+\t\tOPT_SET_INT(0, \"keep-cr\", &keep_cr,\n+\t\t\t    N_(\"pass --keep-cr flag to git-mailsplit for mbox format\"),\n+\t\t\t    1),\n \t\tOPT_BOOL('c', \"scissors\", &state.scissors,\n \t\t\tN_(\"strip everything before a scissors line\")),\n \t\tOPT_CALLBACK_F(0, \"quoted-cr\", &state.quoted_cr, N_(\"action\"),\n-- \n2.41.0-376-gcba07a324d\n\n"}]}