From patchwork Sat Aug 5 04:45:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Arver X-Patchwork-Id: 13342505 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A70B6EB64DD for ; Sat, 5 Aug 2023 04:45:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229679AbjHEEpx (ORCPT ); Sat, 5 Aug 2023 00:45:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229522AbjHEEpp (ORCPT ); Sat, 5 Aug 2023 00:45:45 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E40384ED3 for ; Fri, 4 Aug 2023 21:45:41 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-99c4923195dso377502466b.2 for ; Fri, 04 Aug 2023 21:45:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691210740; x=1691815540; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=52c7q8jljiqawnPusRYu144PYqnteIeQSDFVHugh5fw=; b=Y/IcWo8m36doF1Igdl2Q4cNvWRgFRHHaxN/oJlTZNwkL+wYcw+6Pvmh7owGGArYwmx oUjYyhvGH0IE0J0NmUQMvrksgpasD4S2j+9IHTIYgbXzNzLxQ06N27qGtq7mt0NUEKRP DjkdAMZP8lW3fsWpwXJtMFV3TEiKH/P7KKT4bJVwk14p68Y+FbNh7CaMKhEKYuXxZmTb CotWkOpEVkK5HIksa8rMX7wkia9MZjj8FfSyDDWi/YqHwYtYSdswrTnMJfsfHqgIU3M8 F6wPV4fX9SfRr5n4Ykmyl/DgnD5mRRFB2meCU1vOjgP0bAMB54wABifhSs6PeoQa8knR lpsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691210740; x=1691815540; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=52c7q8jljiqawnPusRYu144PYqnteIeQSDFVHugh5fw=; b=gbKHeUagXfFdGllWH0Zoeyk2XeoidWI9VcWNedmfSjtZxUrQnsb6JcxXvSLzmLQE0L 5bupsKHPuA/jZqMIl3k3uxF1HansR3JVKGJ+JJ9tZR23p5CODFYJbXDNM28Uiket5Sez uYI16HbJ+olA8dmlbrLizEtUqRL+ObWefxxDuAHwnCWtr/uqFTuZbe/KhcRH/lJLG0pl XrFaDoTBKxKACDeLhxxT9pjKI4fVf8GmRZwmxvHjkXQzEHv77/KO9NxgmYhYSl/aCaau 5cOw0MC8gpZ5c3lxO/aJOK2e/mHKAPP0n9wJbM7QFURy5bK8y1V0pjN0b5qt/IIkBStr mPUQ== X-Gm-Message-State: AOJu0YyfMmQnj1z/bKuWP3c8xS9QJgDfGeVp/nGZMilg9n7Gxoo0YtYr MGW0JubWIKxqJto80JqDkPZbz/7+BA0= X-Google-Smtp-Source: AGHT+IE0OShC+s4sGDIBslgESDOQ8R/L/w+dvF/fy01AP0pKXMHINLX00CY5N5hKvdAGtEFzY3WrzQ== X-Received: by 2002:a17:906:2ca:b0:99c:9e69:6a19 with SMTP id 10-20020a17090602ca00b0099c9e696a19mr3637203ejk.18.1691210739830; Fri, 04 Aug 2023 21:45:39 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id c11-20020a5d4f0b000000b0030fa3567541sm4100346wru.48.2023.08.04.21.45.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Aug 2023 21:45:39 -0700 (PDT) Message-ID: <6d67ae6b1f62a2be076d752a2af65bb07998ca73.1691210737.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sat, 05 Aug 2023 04:45:33 +0000 Subject: [PATCH 1/5] trailer tests: make test cases self-contained Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Linus Arver , Linus Arver Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Linus Arver From: Linus Arver By using "test_config" instead of "git config", we avoid leaking configuration state across test cases. This in turn helps to make the tests more self-contained, by explicitly capturing the configuration setup. It then makes it easier to add tests anywhere in this 1500+ line file, without worrying about what implicit state was set in some prior test case defined earlier up in the script. This commit was created mechanically as follows: we changed the first occurrence of a particular "git config trailer.*" option, then ran the tests repeatedly to see which ones broke, adding in the extra "test_config" equivalents to make them pass again. This was done until there were no more unbridled "git config" invocations. Some "git config" invocations still do exist in the script, but they were already cleaned up properly with test_when_finished "git config --remove-section ..." so they were left alone. Note that these cleanups result in generally longer test case setups because the previously hidden state is now being exposed. Although we could then clean up the test cases' "expected" values to be less verbose (the verbosity arising from the use of implicit state), we choose not to do so here, to make sure that this cleanup does not change any meanings behind the test cases. Signed-off-by: Linus Arver --- t/t7513-interpret-trailers.sh | 374 +++++++++++++++++++++++++++------- 1 file changed, 300 insertions(+), 74 deletions(-) diff --git a/t/t7513-interpret-trailers.sh b/t/t7513-interpret-trailers.sh index 97f10905d23..5b31896070a 100755 --- a/t/t7513-interpret-trailers.sh +++ b/t/t7513-interpret-trailers.sh @@ -489,7 +489,7 @@ test_expect_success 'multiline field treated as atomic for neighbor check' ' ' test_expect_success 'with config setup' ' - git config trailer.ack.key "Acked-by: " && + test_config trailer.ack.key "Acked-by: " && cat >expected <<-\EOF && Acked-by: Peff @@ -503,8 +503,8 @@ test_expect_success 'with config setup' ' ' test_expect_success 'with config setup and ":=" as separators' ' - git config trailer.separators ":=" && - git config trailer.ack.key "Acked-by= " && + test_config trailer.separators ":=" && + test_config trailer.ack.key "Acked-by= " && cat >expected <<-\EOF && Acked-by= Peff @@ -518,7 +518,7 @@ test_expect_success 'with config setup and ":=" as separators' ' ' test_expect_success 'with config setup and "%" as separators' ' - git config trailer.separators "%" && + test_config trailer.separators "%" && cat >expected <<-\EOF && bug% 42 @@ -532,6 +532,7 @@ test_expect_success 'with config setup and "%" as separators' ' ' test_expect_success 'with "%" as separators and a message with trailers' ' + test_config trailer.separators "%" && cat >special_message <<-\EOF && Special Message @@ -553,8 +554,8 @@ test_expect_success 'with "%" as separators and a message with trailers' ' ' test_expect_success 'with config setup and ":=#" as separators' ' - git config trailer.separators ":=#" && - git config trailer.bug.key "Bug #" && + test_config trailer.separators ":=#" && + test_config trailer.bug.key "Bug #" && cat >expected <<-\EOF && Bug #42 @@ -581,6 +582,8 @@ test_expect_success 'with basic patch' ' ' test_expect_success 'with commit complex message as argument' ' + test_config trailer.separators ":=" && + test_config trailer.ack.key "Acked-by= " && cat complex_message_body complex_message_trailers >complex_message && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-\EOF && @@ -594,6 +597,8 @@ test_expect_success 'with commit complex message as argument' ' ' test_expect_success 'with 2 files arguments' ' + test_config trailer.separators ":=" && + test_config trailer.ack.key "Acked-by= " && cat basic_message >>expected && echo >>expected && cat basic_patch >>expected && @@ -677,6 +682,9 @@ test_expect_success 'with message that has an old style conflict block' ' ' test_expect_success 'with commit complex message and trailer args' ' + test_config trailer.separators ":=#" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.bug.key "Bug #" && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-\EOF && Fixes: Z @@ -692,6 +700,9 @@ test_expect_success 'with commit complex message and trailer args' ' ' test_expect_success 'with complex patch, args and --trim-empty' ' + test_config trailer.separators ":=#" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.bug.key "Bug #" && cat complex_message >complex_patch && cat basic_patch >>complex_patch && cat complex_message_body >expected && @@ -746,7 +757,10 @@ test_expect_success POSIXPERM,SANITY "in-place editing doesn't clobber original ' test_expect_success 'using "where = before"' ' - git config trailer.bug.where "before" && + test_config trailer.separators ":=#" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.bug.key "Bug #" && + test_config trailer.bug.where "before" && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-\EOF && Bug #42 @@ -762,7 +776,9 @@ test_expect_success 'using "where = before"' ' ' test_expect_success 'overriding configuration with "--where after"' ' - git config trailer.ack.where "before" && + test_config trailer.separators ":=" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.ack.where "before" && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-\EOF && Fixes: Z @@ -777,6 +793,11 @@ test_expect_success 'overriding configuration with "--where after"' ' ' test_expect_success 'using "where = before" with "--no-where"' ' + test_config trailer.ack.key "Acked-by= " && + test_config trailer.ack.where "before" && + test_config trailer.bug.key "Bug #" && + test_config trailer.bug.where "before" && + test_config trailer.separators ":=#" && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-\EOF && Bug #42 @@ -792,7 +813,11 @@ test_expect_success 'using "where = before" with "--no-where"' ' ' test_expect_success 'using "where = after"' ' - git config trailer.ack.where "after" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.ack.where "after" && + test_config trailer.bug.key "Bug #" && + test_config trailer.bug.where "before" && + test_config trailer.separators ":=#" && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-\EOF && Bug #42 @@ -808,8 +833,11 @@ test_expect_success 'using "where = after"' ' ' test_expect_success 'using "where = end"' ' - git config trailer.review.key "Reviewed-by" && - git config trailer.review.where "end" && + test_config trailer.review.key "Reviewed-by" && + test_config trailer.review.where "end" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.ack.where "after" && + test_config trailer.separators ":=" && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-\EOF && Fixes: Z @@ -827,8 +855,11 @@ test_expect_success 'using "where = end"' ' ' test_expect_success 'using "where = start"' ' - git config trailer.review.key "Reviewed-by" && - git config trailer.review.where "start" && + test_config trailer.review.key "Reviewed-by" && + test_config trailer.review.where "start" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.ack.where "after" && + test_config trailer.separators ":=" && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-\EOF && Reviewed-by: Johannes @@ -846,8 +877,13 @@ test_expect_success 'using "where = start"' ' ' test_expect_success 'using "where = before" for a token in the middle of the message' ' - git config trailer.review.key "Reviewed-by:" && - git config trailer.review.where "before" && + test_config trailer.review.key "Reviewed-by:" && + test_config trailer.review.where "before" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.ack.where "after" && + test_config trailer.bug.key "Bug #" && + test_config trailer.bug.where "before" && + test_config trailer.separators ":=#" && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-\EOF && Bug #42 @@ -864,6 +900,12 @@ test_expect_success 'using "where = before" for a token in the middle of the mes ' test_expect_success 'using "where = before" and --trim-empty' ' + test_config trailer.ack.key "Acked-by= " && + test_config trailer.ack.where "after" && + test_config trailer.bug.key "Bug #" && + test_config trailer.bug.where "before" && + test_config trailer.review.key "Reviewed-by:" && + test_config trailer.separators ":=#" && cat complex_message_body >expected && cat >>expected <<-\EOF && Bug #46 @@ -878,6 +920,13 @@ test_expect_success 'using "where = before" and --trim-empty' ' ' test_expect_success 'the default is "ifExists = addIfDifferentNeighbor"' ' + test_config trailer.ack.key "Acked-by= " && + test_config trailer.ack.where "after" && + test_config trailer.bug.key "Bug #" && + test_config trailer.bug.where "before" && + test_config trailer.review.key "Reviewed-by:" && + test_config trailer.review.where "before" && + test_config trailer.separators ":=#" && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-\EOF && Bug #42 @@ -896,7 +945,13 @@ test_expect_success 'the default is "ifExists = addIfDifferentNeighbor"' ' ' test_expect_success 'default "ifExists" is now "addIfDifferent"' ' - git config trailer.ifexists "addIfDifferent" && + test_config trailer.ifexists "addIfDifferent" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.ack.where "after" && + test_config trailer.bug.key "Bug #" && + test_config trailer.bug.where "before" && + test_config trailer.review.key "Reviewed-by:" && + test_config trailer.separators ":=#" && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-\EOF && Bug #42 @@ -914,8 +969,14 @@ test_expect_success 'default "ifExists" is now "addIfDifferent"' ' ' test_expect_success 'using "ifExists = addIfDifferent" with "where = end"' ' - git config trailer.ack.ifExists "addIfDifferent" && - git config trailer.ack.where "end" && + test_config trailer.ack.ifExists "addIfDifferent" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.ack.where "end" && + test_config trailer.bug.key "Bug #" && + test_config trailer.bug.where "before" && + test_config trailer.review.key "Reviewed-by:" && + test_config trailer.ifexists "addIfDifferent" && + test_config trailer.separators ":=#" && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-\EOF && Bug #42 @@ -932,8 +993,14 @@ test_expect_success 'using "ifExists = addIfDifferent" with "where = end"' ' ' test_expect_success 'using "ifExists = addIfDifferent" with "where = before"' ' - git config trailer.ack.ifExists "addIfDifferent" && - git config trailer.ack.where "before" && + test_config trailer.ack.ifExists "addIfDifferent" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.ack.where "before" && + test_config trailer.bug.key "Bug #" && + test_config trailer.bug.where "before" && + test_config trailer.review.key "Reviewed-by:" && + test_config trailer.ifexists "addIfDifferent" && + test_config trailer.separators ":=#" && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-\EOF && Bug #42 @@ -950,8 +1017,14 @@ test_expect_success 'using "ifExists = addIfDifferent" with "where = before"' ' ' test_expect_success 'using "ifExists = addIfDifferentNeighbor" with "where = end"' ' - git config trailer.ack.ifExists "addIfDifferentNeighbor" && - git config trailer.ack.where "end" && + test_config trailer.ack.ifExists "addIfDifferentNeighbor" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.ack.where "end" && + test_config trailer.bug.key "Bug #" && + test_config trailer.bug.where "before" && + test_config trailer.review.key "Reviewed-by:" && + test_config trailer.ifexists "addIfDifferent" && + test_config trailer.separators ":=#" && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-\EOF && Bug #42 @@ -973,8 +1046,14 @@ test_expect_success 'using "ifExists = addIfDifferentNeighbor" with "where = end ' test_expect_success 'using "ifExists = addIfDifferentNeighbor" with "where = after"' ' - git config trailer.ack.ifExists "addIfDifferentNeighbor" && - git config trailer.ack.where "after" && + test_config trailer.ack.ifExists "addIfDifferentNeighbor" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.ack.where "after" && + test_config trailer.bug.key "Bug #" && + test_config trailer.bug.where "before" && + test_config trailer.review.key "Reviewed-by:" && + test_config trailer.ifexists "addIfDifferent" && + test_config trailer.separators ":=#" && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-\EOF && Bug #42 @@ -995,7 +1074,11 @@ test_expect_success 'using "ifExists = addIfDifferentNeighbor" with "where = af ' test_expect_success 'using "ifExists = addIfDifferentNeighbor" and --trim-empty' ' - git config trailer.ack.ifExists "addIfDifferentNeighbor" && + test_config trailer.ack.ifExists "addIfDifferentNeighbor" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.bug.key "Bug #" && + test_config trailer.bug.where "before" && + test_config trailer.separators ":=#" && cat complex_message_body >expected && cat >>expected <<-\EOF && Bug #42 @@ -1011,8 +1094,14 @@ test_expect_success 'using "ifExists = addIfDifferentNeighbor" and --trim-empty' ' test_expect_success 'using "ifExists = add" with "where = end"' ' - git config trailer.ack.ifExists "add" && - git config trailer.ack.where "end" && + test_config trailer.ack.ifExists "add" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.ack.where "end" && + test_config trailer.bug.key "Bug #" && + test_config trailer.bug.where "before" && + test_config trailer.review.key "Reviewed-by:" && + test_config trailer.ifexists "addIfDifferent" && + test_config trailer.separators ":=#" && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-\EOF && Bug #42 @@ -1036,8 +1125,14 @@ test_expect_success 'using "ifExists = add" with "where = end"' ' ' test_expect_success 'using "ifExists = add" with "where = after"' ' - git config trailer.ack.ifExists "add" && - git config trailer.ack.where "after" && + test_config trailer.ack.ifExists "add" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.ack.where "after" && + test_config trailer.bug.key "Bug #" && + test_config trailer.bug.where "before" && + test_config trailer.review.key "Reviewed-by:" && + test_config trailer.ifexists "addIfDifferent" && + test_config trailer.separators ":=#" && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-\EOF && Bug #42 @@ -1058,8 +1153,15 @@ test_expect_success 'using "ifExists = add" with "where = after"' ' ' test_expect_success 'overriding configuration with "--if-exists replace"' ' - git config trailer.fix.key "Fixes: " && - git config trailer.fix.ifExists "add" && + test_config trailer.fix.key "Fixes: " && + test_config trailer.fix.ifExists "add" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.ack.where "after" && + test_config trailer.bug.key "Bug #" && + test_config trailer.bug.where "before" && + test_config trailer.review.key "Reviewed-by:" && + test_config trailer.review.where "before" && + test_config trailer.separators ":=#" && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-\EOF && Bug #42 @@ -1075,8 +1177,15 @@ test_expect_success 'overriding configuration with "--if-exists replace"' ' ' test_expect_success 'using "ifExists = replace"' ' - git config trailer.fix.key "Fixes: " && - git config trailer.fix.ifExists "replace" && + test_config trailer.fix.key "Fixes: " && + test_config trailer.fix.ifExists "replace" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.ack.where "after" && + test_config trailer.bug.key "Bug #" && + test_config trailer.bug.where "before" && + test_config trailer.review.key "Reviewed-by:" && + test_config trailer.ifexists "addIfDifferent" && + test_config trailer.separators ":=#" && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-\EOF && Bug #42 @@ -1095,7 +1204,16 @@ test_expect_success 'using "ifExists = replace"' ' ' test_expect_success 'using "ifExists = replace" with "where = after"' ' - git config trailer.fix.where "after" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.ack.where "after" && + test_config trailer.bug.key "Bug #" && + test_config trailer.bug.where "before" && + test_config trailer.fix.key "Fixes: " && + test_config trailer.fix.ifExists "replace" && + test_config trailer.fix.where "after" && + test_config trailer.review.key "Reviewed-by:" && + test_config trailer.ifexists "addIfDifferent" && + test_config trailer.separators ":=#" && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-\EOF && Bug #42 @@ -1114,7 +1232,15 @@ test_expect_success 'using "ifExists = replace" with "where = after"' ' ' test_expect_success 'using "ifExists = doNothing"' ' - git config trailer.fix.ifExists "doNothing" && + test_config trailer.fix.ifExists "doNothing" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.ack.where "after" && + test_config trailer.bug.key "Bug #" && + test_config trailer.bug.where "before" && + test_config trailer.fix.key "Fixes: " && + test_config trailer.review.key "Reviewed-by:" && + test_config trailer.ifexists "addIfDifferent" && + test_config trailer.separators ":=#" && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-\EOF && Bug #42 @@ -1133,8 +1259,17 @@ test_expect_success 'using "ifExists = doNothing"' ' ' test_expect_success 'the default is "ifMissing = add"' ' - git config trailer.cc.key "Cc: " && - git config trailer.cc.where "before" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.ack.where "after" && + test_config trailer.bug.key "Bug #" && + test_config trailer.bug.where "before" && + test_config trailer.cc.key "Cc: " && + test_config trailer.cc.where "before" && + test_config trailer.fix.key "Fixes: " && + test_config trailer.fix.ifExists "doNothing" && + test_config trailer.review.key "Reviewed-by:" && + test_config trailer.ifexists "addIfDifferent" && + test_config trailer.separators ":=#" && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-\EOF && Bug #42 @@ -1154,7 +1289,14 @@ test_expect_success 'the default is "ifMissing = add"' ' ' test_expect_success 'overriding configuration with "--if-missing doNothing"' ' - git config trailer.ifmissing "add" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.ack.where "after" && + test_config trailer.fix.key "Fixes: " && + test_config trailer.fix.ifExists "doNothing" && + test_config trailer.review.key "Reviewed-by:" && + test_config trailer.ifexists "addIfDifferent" && + test_config trailer.ifmissing "add" && + test_config trailer.separators ":=" && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-\EOF && Fixes: Z @@ -1173,7 +1315,13 @@ test_expect_success 'overriding configuration with "--if-missing doNothing"' ' ' test_expect_success 'when default "ifMissing" is "doNothing"' ' - git config trailer.ifmissing "doNothing" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.ack.where "after" && + test_config trailer.fix.ifExists "doNothing" && + test_config trailer.review.key "Reviewed-by:" && + test_config trailer.ifexists "addIfDifferent" && + test_config trailer.ifmissing "doNothing" && + test_config trailer.separators ":=" && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-\EOF && Fixes: Z @@ -1187,14 +1335,21 @@ test_expect_success 'when default "ifMissing" is "doNothing"' ' --trailer "cc=Linus" --trailer "ack: Junio" \ --trailer "fix=22" --trailer "bug: 42" --trailer "ack: Peff" \ actual && - test_cmp expected actual && - git config trailer.ifmissing "add" + test_cmp expected actual ' test_expect_success 'using "ifMissing = add" with "where = end"' ' - git config trailer.cc.key "Cc: " && - git config trailer.cc.where "end" && - git config trailer.cc.ifMissing "add" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.ack.where "after" && + test_config trailer.bug.key "Bug #" && + test_config trailer.bug.where "before" && + test_config trailer.cc.key "Cc: " && + test_config trailer.cc.ifMissing "add" && + test_config trailer.cc.where "end" && + test_config trailer.fix.ifExists "doNothing" && + test_config trailer.review.key "Reviewed-by:" && + test_config trailer.ifexists "addIfDifferent" && + test_config trailer.separators ":=#" && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-\EOF && Bug #42 @@ -1214,9 +1369,17 @@ test_expect_success 'using "ifMissing = add" with "where = end"' ' ' test_expect_success 'using "ifMissing = add" with "where = before"' ' - git config trailer.cc.key "Cc: " && - git config trailer.cc.where "before" && - git config trailer.cc.ifMissing "add" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.ack.where "after" && + test_config trailer.bug.key "Bug #" && + test_config trailer.bug.where "before" && + test_config trailer.cc.key "Cc: " && + test_config trailer.cc.ifMissing "add" && + test_config trailer.cc.where "before" && + test_config trailer.fix.ifExists "doNothing" && + test_config trailer.review.key "Reviewed-by:" && + test_config trailer.ifexists "addIfDifferent" && + test_config trailer.separators ":=#" && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-\EOF && Cc: Linus @@ -1236,7 +1399,15 @@ test_expect_success 'using "ifMissing = add" with "where = before"' ' ' test_expect_success 'using "ifMissing = doNothing"' ' - git config trailer.cc.ifMissing "doNothing" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.ack.where "after" && + test_config trailer.bug.key "Bug #" && + test_config trailer.bug.where "before" && + test_config trailer.cc.ifMissing "doNothing" && + test_config trailer.fix.ifExists "doNothing" && + test_config trailer.review.key "Reviewed-by:" && + test_config trailer.ifexists "addIfDifferent" && + test_config trailer.separators ":=#" && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-\EOF && Bug #42 @@ -1256,7 +1427,15 @@ test_expect_success 'using "ifMissing = doNothing"' ' test_expect_success 'default "where" is now "after"' ' git config trailer.where "after" && - git config --unset trailer.ack.where && + test_config trailer.ack.ifExists "add" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.ack.where "after" && + test_config trailer.bug.key "Bug #" && + test_config trailer.bug.where "before" && + test_config trailer.fix.ifExists "doNothing" && + test_config trailer.review.key "Reviewed-by:" && + test_config trailer.ifexists "addIfDifferent" && + test_config trailer.separators ":=#" && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-\EOF && Bug #42 @@ -1280,10 +1459,15 @@ test_expect_success 'default "where" is now "after"' ' ' test_expect_success 'with simple command' ' - git config trailer.sign.key "Signed-off-by: " && - git config trailer.sign.where "after" && - git config trailer.sign.ifExists "addIfDifferentNeighbor" && - git config trailer.sign.command "echo \"A U Thor \"" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.fix.ifExists "doNothing" && + test_config trailer.review.key "Reviewed-by:" && + test_config trailer.sign.command "echo \"A U Thor \"" && + test_config trailer.sign.key "Signed-off-by: " && + test_config trailer.sign.ifExists "addIfDifferentNeighbor" && + test_config trailer.sign.where "after" && + test_config trailer.ifexists "addIfDifferent" && + test_config trailer.separators ":=" && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-\EOF && Fixes: Z @@ -1298,8 +1482,14 @@ test_expect_success 'with simple command' ' ' test_expect_success 'with command using committer information' ' - git config trailer.sign.ifExists "addIfDifferent" && - git config trailer.sign.command "echo \"\$GIT_COMMITTER_NAME <\$GIT_COMMITTER_EMAIL>\"" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.fix.ifExists "doNothing" && + test_config trailer.review.key "Reviewed-by:" && + test_config trailer.sign.command "echo \"\$GIT_COMMITTER_NAME <\$GIT_COMMITTER_EMAIL>\"" && + test_config trailer.sign.key "Signed-off-by: " && + test_config trailer.sign.ifExists "addIfDifferent" && + test_config trailer.ifexists "addIfDifferent" && + test_config trailer.separators ":=" && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-\EOF && Fixes: Z @@ -1314,10 +1504,15 @@ test_expect_success 'with command using committer information' ' ' test_expect_success 'with command using author information' ' - git config trailer.sign.key "Signed-off-by: " && - git config trailer.sign.where "after" && - git config trailer.sign.ifExists "addIfDifferentNeighbor" && - git config trailer.sign.command "echo \"\$GIT_AUTHOR_NAME <\$GIT_AUTHOR_EMAIL>\"" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.fix.ifExists "doNothing" && + test_config trailer.review.key "Reviewed-by:" && + test_config trailer.sign.command "echo \"\$GIT_AUTHOR_NAME <\$GIT_AUTHOR_EMAIL>\"" && + test_config trailer.sign.key "Signed-off-by: " && + test_config trailer.sign.ifExists "addIfDifferentNeighbor" && + test_config trailer.sign.where "after" && + test_config trailer.ifexists "addIfDifferent" && + test_config trailer.separators ":=" && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-\EOF && Fixes: Z @@ -1338,12 +1533,19 @@ test_expect_success 'setup a commit' ' ' test_expect_success 'cmd takes precedence over command' ' - test_when_finished "git config --unset trailer.fix.cmd" && - git config trailer.fix.ifExists "replace" && - git config trailer.fix.cmd "test -n \"\$1\" && git log -1 --oneline --format=\"%h (%aN)\" \ - --abbrev-commit --abbrev=14 \"\$1\" || true" && - git config trailer.fix.command "git log -1 --oneline --format=\"%h (%s)\" \ + test_config trailer.ack.key "Acked-by= " && + test_config trailer.fix.command "git log -1 --oneline --format=\"%h (%s)\" \ --abbrev-commit --abbrev=14 \$ARG" && + test_config trailer.fix.cmd "test -n \"\$1\" && git log -1 --oneline --format=\"%h (%aN)\" \ + --abbrev-commit --abbrev=14 \"\$1\" || true" && + test_config trailer.fix.key "Fixes: " && + test_config trailer.fix.ifExists "replace" && + test_config trailer.fix.where "after" && + test_config trailer.review.key "Reviewed-by:" && + test_config trailer.sign.command "echo \"\$GIT_AUTHOR_NAME <\$GIT_AUTHOR_EMAIL>\"" && + test_config trailer.sign.key "Signed-off-by: " && + test_config trailer.ifexists "addIfDifferent" && + test_config trailer.separators ":=" && FIXED=$(git log -1 --oneline --format="%h (%aN)" --abbrev-commit --abbrev=14 HEAD) && cat complex_message_body >expected2 && sed -e "s/ Z\$/ /" >>expected2 <<-EOF && @@ -1359,8 +1561,16 @@ test_expect_success 'cmd takes precedence over command' ' ' test_expect_success 'with command using $ARG' ' - git config trailer.fix.ifExists "replace" && - git config trailer.fix.command "git log -1 --oneline --format=\"%h (%s)\" --abbrev-commit --abbrev=14 \$ARG" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.fix.command "git log -1 --oneline --format=\"%h (%s)\" --abbrev-commit --abbrev=14 \$ARG" && + test_config trailer.fix.key "Fixes: " && + test_config trailer.fix.ifExists "replace" && + test_config trailer.fix.where "after" && + test_config trailer.review.key "Reviewed-by:" && + test_config trailer.sign.command "echo \"\$GIT_AUTHOR_NAME <\$GIT_AUTHOR_EMAIL>\"" && + test_config trailer.sign.key "Signed-off-by: " && + test_config trailer.ifexists "addIfDifferent" && + test_config trailer.separators ":=" && FIXED=$(git log -1 --oneline --format="%h (%s)" --abbrev-commit --abbrev=14 HEAD) && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-EOF && @@ -1376,8 +1586,16 @@ test_expect_success 'with command using $ARG' ' ' test_expect_success 'with failing command using $ARG' ' - git config trailer.fix.ifExists "replace" && - git config trailer.fix.command "false \$ARG" && + test_config trailer.ack.key "Acked-by= " && + test_config trailer.fix.command "false \$ARG" && + test_config trailer.fix.key "Fixes: " && + test_config trailer.fix.ifExists "replace" && + test_config trailer.fix.where "after" && + test_config trailer.review.key "Reviewed-by:" && + test_config trailer.sign.command "echo \"\$GIT_AUTHOR_NAME <\$GIT_AUTHOR_EMAIL>\"" && + test_config trailer.sign.key "Signed-off-by: " && + test_config trailer.ifexists "addIfDifferent" && + test_config trailer.separators ":=" && cat complex_message_body >expected && sed -e "s/ Z\$/ /" >>expected <<-EOF && Fixes: Z @@ -1392,7 +1610,9 @@ test_expect_success 'with failing command using $ARG' ' ' test_expect_success 'with empty tokens' ' - git config --unset trailer.fix.command && + test_config trailer.sign.command "echo \"\$GIT_AUTHOR_NAME <\$GIT_AUTHOR_EMAIL>\"" && + test_config trailer.sign.key "Signed-off-by: " && + test_config trailer.ifexists "addIfDifferent" && cat >expected <<-EOF && Signed-off-by: A U Thor @@ -1403,7 +1623,8 @@ test_expect_success 'with empty tokens' ' ' test_expect_success 'with command but no key' ' - git config --unset trailer.sign.key && + test_config trailer.sign.command "echo \"\$GIT_AUTHOR_NAME <\$GIT_AUTHOR_EMAIL>\"" && + test_config trailer.ifexists "addIfDifferent" && cat >expected <<-EOF && sign: A U Thor @@ -1414,7 +1635,9 @@ test_expect_success 'with command but no key' ' ' test_expect_success 'with no command and no key' ' - git config --unset trailer.review.key && + test_config trailer.review.where "before" && + test_config trailer.sign.command "echo \"\$GIT_AUTHOR_NAME <\$GIT_AUTHOR_EMAIL>\"" && + test_config trailer.ifexists "addIfDifferent" && cat >expected <<-EOF && review: Junio @@ -1426,6 +1649,8 @@ test_expect_success 'with no command and no key' ' ' test_expect_success 'with cut line' ' + test_config trailer.review.where "before" && + test_config trailer.sign.command "echo \"\$GIT_AUTHOR_NAME <\$GIT_AUTHOR_EMAIL>\"" && cat >expected <<-\EOF && my subject @@ -1443,7 +1668,8 @@ test_expect_success 'with cut line' ' ' test_expect_success 'only trailers' ' - git config trailer.sign.command "echo config-value" && + test_config trailer.sign.command "echo config-value" && + test_config trailer.ifexists "addIfDifferent" && cat >expected <<-\EOF && existing: existing-value sign: config-value @@ -1462,7 +1688,7 @@ test_expect_success 'only trailers' ' ' test_expect_success 'only-trailers omits non-trailer in middle of block' ' - git config trailer.sign.command "echo config-value" && + test_config trailer.sign.command "echo config-value" && cat >expected <<-\EOF && Signed-off-by: nobody Signed-off-by: somebody @@ -1482,7 +1708,7 @@ test_expect_success 'only-trailers omits non-trailer in middle of block' ' ' test_expect_success 'only input' ' - git config trailer.sign.command "echo config-value" && + test_config trailer.sign.command "echo config-value" && cat >expected <<-\EOF && existing: existing-value EOF From patchwork Sat Aug 5 04:45:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Arver X-Patchwork-Id: 13342503 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72089EB64DD for ; Sat, 5 Aug 2023 04:45:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229551AbjHEEpr (ORCPT ); Sat, 5 Aug 2023 00:45:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229481AbjHEEpo (ORCPT ); Sat, 5 Aug 2023 00:45:44 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B30B54ED6 for ; Fri, 4 Aug 2023 21:45:42 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-4fe28e4671dso4713113e87.0 for ; Fri, 04 Aug 2023 21:45:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691210741; x=1691815541; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=d5C2RUivRPkhjM3FHZHrxtCNM82473MLJmyqe8BS37I=; b=dM/+EmCt+fmwR8rhe/ARasUtzsdjraAlHtYvhJ/9YvI0ULSz7/MlTNKVYMKrtYQwKO 6HDXY+snL8JpDqT3PWNXam7LlSksAvp8IxbPfvqnkKtwfP65q/ngfaVui/RvpNkryehl k80+qXDjPh3QRBREcWtaYgO9QLuVJDMAqAg+HkgsWQEMT5HZSLMMEJP9IA31CJocKPR0 byHtV/xhkOgQ6xOxREh8GPddDoGouKBReJKEEqYtoeEKabzBdDHle12i9xHNt+6ObdfN vc/1NnYk3MUV/HyWTvtVKp24YUYUaUHoqSbWjSusc+gpUTwgPjj/2LdSXsYvUu+V2a/2 nbBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691210741; x=1691815541; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=d5C2RUivRPkhjM3FHZHrxtCNM82473MLJmyqe8BS37I=; b=BFmdLvtmGVoyajxn7RGUol03s0p45FL1yokjDSjCtyYl+JO/aIaz5WXSuuLQn9X+cx HHFNhIohW8tmOomkzpb9qLvR16nk1Dn6OHRarIaAPmU8ptR4tYRWpqMn99OAkVbLy86P 5rv/TdlW4rHz+4+JRjQNAybKg/By1q0bI/NewgF7t9KY+x9+nrssUPikHYCBUHkffFZa qGfdJ9yCMdrUJ60G1Oq/8itRR2bLFReElSM61+Iv6psYWDaZayhrB1KCRhE/KlVB5Brx 7371OLF9sKQ9ntEQKYBFBKrAVxZJd2yIQmRIyJHOqkJCwylCSABdpZNFRa+vZWvRvuuO xrpg== X-Gm-Message-State: AOJu0YyFC0zhwsRvUBZwg5U6J359pGKgjVqdiiMesXfMi2HhCQanwhGg gpRLyOm0+tZP9DjOeXrIKZvcqNvV/18= X-Google-Smtp-Source: AGHT+IE2dFQjN1HUyMw9HYYDMDA2h7dGPqaQqOlio9OTpgn/vTVm140zWjVKvzGsa6Vdzo1bIkkvNw== X-Received: by 2002:a05:6512:159c:b0:4f9:5ca5:f1a6 with SMTP id bp28-20020a056512159c00b004f95ca5f1a6mr3197256lfb.17.1691210740457; Fri, 04 Aug 2023 21:45:40 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id h20-20020a05600c261400b003fe2ebf479fsm3930051wma.36.2023.08.04.21.45.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Aug 2023 21:45:40 -0700 (PDT) Message-ID: <100a2297fa3710dc107c095778b86ce3d2a3b0a6.1691210737.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sat, 05 Aug 2023 04:45:34 +0000 Subject: [PATCH 2/5] trailer test description: this tests --where=after, not --where=before Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Linus Arver , Linus Arver Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Linus Arver From: Linus Arver Signed-off-by: Linus Arver --- t/t7513-interpret-trailers.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t7513-interpret-trailers.sh b/t/t7513-interpret-trailers.sh index 5b31896070a..ed0fc04bd95 100755 --- a/t/t7513-interpret-trailers.sh +++ b/t/t7513-interpret-trailers.sh @@ -792,7 +792,7 @@ test_expect_success 'overriding configuration with "--where after"' ' test_cmp expected actual ' -test_expect_success 'using "where = before" with "--no-where"' ' +test_expect_success 'using "--where after" with "--no-where"' ' test_config trailer.ack.key "Acked-by= " && test_config trailer.ack.where "before" && test_config trailer.bug.key "Bug #" && From patchwork Sat Aug 5 04:45:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Arver X-Patchwork-Id: 13342507 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F5FDEB64DD for ; Sat, 5 Aug 2023 04:45:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229639AbjHEEp6 (ORCPT ); Sat, 5 Aug 2023 00:45:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229537AbjHEEpp (ORCPT ); Sat, 5 Aug 2023 00:45:45 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09AF64EDA for ; Fri, 4 Aug 2023 21:45:43 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-31427ddd3fbso2335439f8f.0 for ; Fri, 04 Aug 2023 21:45:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691210741; x=1691815541; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=EKPl42RSzL8yMZqcs2H0g2o3zU7uxqKAob5ypQKsfWM=; b=NnjzRRN9W1LF6lQmNzYfoEGBu5moVtjEBFDaBx+slv1Z3Ze9EvNINCJt7DsFTVTglA 9ZEO0G5ZYT4EtkckwHEKbTuhSgHwb3DbS2xnTW5MeTmSOyOnkxf9YehzLK0nKGIXP7+2 NR+nYj9/bb+AozNv6A1KZdwS1Hp8atTWGHrrUYJ0N7xHeFK0asZLmD0lacl4qu7mSj6C olFa0WYl2MNSqGy5bKUxGCznS+IIZQn26Nfwk0U+EkP2dwiveqxatFPMXYMBttwF7UKR BVflnc6Rg/mz77jEOtQqu+y6FAKjtQZBld+89gn6mMtwF/fYeC9BVlC2OyNBBfqNFxnr Rd+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691210741; x=1691815541; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EKPl42RSzL8yMZqcs2H0g2o3zU7uxqKAob5ypQKsfWM=; b=PClJOn8t2IHQklLvud/91XfsmoIQpVd9jWI40D5W5K0w6/abl+zLjzBGmLOIrlTyBp QMrSPOdg2e1flo2cWJ/1v0Y33TiLRHbeh2h68eZgKrIBgZyFNyYCHtvjlKBPtssZwRWv wzrSd63HcIcHtdGS3tQCA24ASlz0K7/DzNyC/0rb13eIIBnRtmROyzj1doez5GBD7t6x GAKkDCrbeseOlzFcPjyx5voTtjbxSXIgt6JfyYiDHAidNwzCdhaQIngm3JJMslFnBQYp IhZY8AYGW3s8mM+dqxfY28ezTee2ul5TxFP3v+k6YeJWI3kXJktGoP/mCwXr0VLW6CfE i15Q== X-Gm-Message-State: AOJu0YwXE9qxjDTSOUTP+y+9QeINWlC+0yadwUj0mF/VN/Rh+MB7srET BX7BXQGXbVh3bCHDzN0XxWPNC/EbX7w= X-Google-Smtp-Source: AGHT+IGvcHZRbfSbk+gqviOBCOfcL3pkS8sJhRRzQkGs6QdS+SXL2BkFs92tF0qHcRg6MjkScFeyRQ== X-Received: by 2002:adf:dd10:0:b0:314:415:cbf5 with SMTP id a16-20020adfdd10000000b003140415cbf5mr2364077wrm.51.1691210740971; Fri, 04 Aug 2023 21:45:40 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id e3-20020a5d5943000000b00317ac0642b0sm4088870wri.27.2023.08.04.21.45.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Aug 2023 21:45:40 -0700 (PDT) Message-ID: <6b427b4b1e82b1f01640f1f49fe8d1c2fd02111e.1691210737.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sat, 05 Aug 2023 04:45:35 +0000 Subject: [PATCH 3/5] trailer: add tests to check defaulting behavior with --no-* flags Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Linus Arver , Linus Arver Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Linus Arver From: Linus Arver While the "--no-where" flag is tested, the "--no-if-exists" and "--no-if-missing" flags are not, so add tests for them. But also add tests for all "--no-*" flags to check their effects, both when (1) there are relevant configuration variables set, and (2) they are not set. Signed-off-by: Linus Arver --- Documentation/git-interpret-trailers.txt | 14 ++- t/t7513-interpret-trailers.sh | 130 +++++++++++++++++++++++ 2 files changed, 140 insertions(+), 4 deletions(-) diff --git a/Documentation/git-interpret-trailers.txt b/Documentation/git-interpret-trailers.txt index 55d89614661..91a4dbc9a72 100644 --- a/Documentation/git-interpret-trailers.txt +++ b/Documentation/git-interpret-trailers.txt @@ -114,8 +114,10 @@ OPTIONS Specify where all new trailers will be added. A setting provided with '--where' overrides all configuration variables and applies to all '--trailer' options until the next occurrence of - '--where' or '--no-where'. Possible values are `after`, `before`, - `end` or `start`. + '--where' or '--no-where'. Upon encountering '--no-where', clear the + effect of any previous use of '--where', such that the relevant configuration + variables are no longer overridden. Possible values are `after`, + `before`, `end` or `start`. --if-exists :: --no-if-exists:: @@ -123,7 +125,9 @@ OPTIONS least one trailer with the same in the input. A setting provided with '--if-exists' overrides all configuration variables and applies to all '--trailer' options until the next occurrence of - '--if-exists' or '--no-if-exists'. Possible actions are `addIfDifferent`, + '--if-exists' or '--no-if-exists'. Upon encountering '--no-if-exists, clear the + effect of any previous use of '--if-exists, such that the relevant configuration + variables are no longer overridden. Possible actions are `addIfDifferent`, `addIfDifferentNeighbor`, `add`, `replace` and `doNothing`. --if-missing :: @@ -132,7 +136,9 @@ OPTIONS trailer with the same in the input. A setting provided with '--if-missing' overrides all configuration variables and applies to all '--trailer' options until the next occurrence of - '--if-missing' or '--no-if-missing'. Possible actions are `doNothing` + '--if-missing' or '--no-if-missing'. Upon encountering '--no-if-missing, + clear the effect of any previous use of '--if-missing, such that the relevant + configuration variables are no longer overridden. Possible actions are `doNothing` or `add`. --only-trailers:: diff --git a/t/t7513-interpret-trailers.sh b/t/t7513-interpret-trailers.sh index ed0fc04bd95..832aff06167 100755 --- a/t/t7513-interpret-trailers.sh +++ b/t/t7513-interpret-trailers.sh @@ -812,6 +812,53 @@ test_expect_success 'using "--where after" with "--no-where"' ' test_cmp expected actual ' +# Check whether using "--no-where" clears out only the "--where after", such +# that we still use the configuration in trailer.where (which is different from +# the hardcoded default (in WHERE_END) assuming the absence of .gitconfig). +# Here, the "start" setting of trailer.where is respected, so the new "Acked-by" +# and "Bug" trailers are placed at the beginning, and not at the end which is +# the harcoded default. +test_expect_success 'using "--where after" with "--no-where" defaults to configuration' ' + test_config trailer.ack.key "Acked-by= " && + test_config trailer.bug.key "Bug #" && + test_config trailer.separators ":=#" && + test_config trailer.where "start" && + cat complex_message_body >expected && + sed -e "s/ Z\$/ /" >>expected <<-\EOF && + Bug #42 + Acked-by= Peff + Fixes: Z + Acked-by= Z + Reviewed-by: Z + Signed-off-by: Z + EOF + git interpret-trailers --where after --no-where --trailer "ack: Peff" \ + --trailer "bug: 42" complex_message >actual && + test_cmp expected actual +' + +# The "--where after" will only get respected for the trailer that came +# immediately after it. For the next trailer (Bug #42), we default to using the +# hardcoded WHERE_END because we don't have any "trailer.where" or +# "trailer.bug.where" configured. +test_expect_success 'using "--no-where" defaults to harcoded default if nothing configured' ' + test_config trailer.ack.key "Acked-by= " && + test_config trailer.bug.key "Bug #" && + test_config trailer.separators ":=#" && + cat complex_message_body >expected && + sed -e "s/ Z\$/ /" >>expected <<-\EOF && + Fixes: Z + Acked-by= Z + Acked-by= Peff + Reviewed-by: Z + Signed-off-by: Z + Bug #42 + EOF + git interpret-trailers --where after --trailer "ack: Peff" --no-where \ + --trailer "bug: 42" complex_message >actual && + test_cmp expected actual +' + test_expect_success 'using "where = after"' ' test_config trailer.ack.key "Acked-by= " && test_config trailer.ack.where "after" && @@ -1176,6 +1223,56 @@ test_expect_success 'overriding configuration with "--if-exists replace"' ' test_cmp expected actual ' +# "trailer.ifexists" is set to "doNothing", so using "--no-if-exists" defaults +# to this "doNothing" behavior. So the "Fixes: 53" trailer does not get added. +test_expect_success 'using "--if-exists replace" with "--no-if-exists" defaults to configuration' ' + test_config trailer.ifexists "doNothing" && + cat complex_message_body >expected && + sed -e "s/ Z\$/ /" >>expected <<-\EOF && + Fixes: Z + Acked-by: Z + Reviewed-by: Z + Signed-off-by: Z + EOF + git interpret-trailers --if-exists replace --no-if-exists --trailer "Fixes: 53" \ + actual && + test_cmp expected actual +' + +# No "ifexists" configuration is set, so using "--no-if-exists" makes it default +# to addIfDifferentNeighbor. Because we do have a different neighbor "Fixes: 53" +# (because it got added by overriding with "--if-exists replace" earlier in the +# arguments list), we add "Signed-off-by: addme". +test_expect_success 'using "--no-if-exists" defaults to hardcoded default if nothing configured' ' + cat complex_message_body >expected && + sed -e "s/ Z\$/ /" >>expected <<-\EOF && + Acked-by: Z + Reviewed-by: Z + Signed-off-by: Z + Fixes: 53 + Signed-off-by: addme + EOF + git interpret-trailers --if-exists replace --trailer "Fixes: 53" --no-if-exists \ + --trailer "Signed-off-by: addme" actual && + test_cmp expected actual +' + +# The second "Fixes: 53" trailer is discarded, because the "--no-if-exists" here +# makes us default to addIfDifferentNeighbor, and we already added the "Fixes: +# 53" trailer earlier in the argument list. +test_expect_success 'using "--no-if-exists" defaults to hardcoded default if nothing configured (no addition)' ' + cat complex_message_body >expected && + sed -e "s/ Z\$/ /" >>expected <<-\EOF && + Acked-by: Z + Reviewed-by: Z + Signed-off-by: Z + Fixes: 53 + EOF + git interpret-trailers --if-exists replace --trailer "Fixes: 53" --no-if-exists \ + --trailer "Fixes: 53" actual && + test_cmp expected actual +' + test_expect_success 'using "ifExists = replace"' ' test_config trailer.fix.key "Fixes: " && test_config trailer.fix.ifExists "replace" && @@ -1425,6 +1522,39 @@ test_expect_success 'using "ifMissing = doNothing"' ' test_cmp expected actual ' +# Ignore the "IgnoredTrailer" because of "--if-missing doNothing", but also +# ignore the "StillIgnoredTrailer" because we set "trailer.ifMissing" to +# "doNothing" in configuration. +test_expect_success 'using "--no-if-missing" defaults to configuration' ' + test_config trailer.ifMissing "doNothing" && + cat complex_message_body >expected && + sed -e "s/ Z\$/ /" >>expected <<-\EOF && + Fixes: Z + Acked-by: Z + Reviewed-by: Z + Signed-off-by: Z + EOF + git interpret-trailers --if-missing doNothing --trailer "IgnoredTrailer: ignoreme" --no-if-missing \ + --trailer "StillIgnoredTrailer: ignoreme" actual && + test_cmp expected actual +' + +# Add the "AddedTrailer" because the "--no-if-missing" clears the "--if-missing +# doNothing" from earlier in the argument list. +test_expect_success 'using "--no-if-missing" defaults to hardcoded default if nothing configured' ' + cat complex_message_body >expected && + sed -e "s/ Z\$/ /" >>expected <<-\EOF && + Fixes: Z + Acked-by: Z + Reviewed-by: Z + Signed-off-by: Z + AddedTrailer: addme + EOF + git interpret-trailers --if-missing doNothing --trailer "IgnoredTrailer: ignoreme" --no-if-missing \ + --trailer "AddedTrailer: addme" actual && + test_cmp expected actual +' + test_expect_success 'default "where" is now "after"' ' git config trailer.where "after" && test_config trailer.ack.ifExists "add" && From patchwork Sat Aug 5 04:45:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Arver X-Patchwork-Id: 13342506 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8EC4DC0015E for ; Sat, 5 Aug 2023 04:45:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229579AbjHEEp4 (ORCPT ); Sat, 5 Aug 2023 00:45:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229544AbjHEEpp (ORCPT ); Sat, 5 Aug 2023 00:45:45 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AB61468C for ; Fri, 4 Aug 2023 21:45:43 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-317c11517a0so1541359f8f.0 for ; Fri, 04 Aug 2023 21:45:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691210741; x=1691815541; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=0Ri4Eh44IPRnBeWk/hxMHZMiN24KG42dufyrl/Raytg=; b=NfcJ5VqdoWxSMcbO/gdAw2wDf+oT0KuDKLhyVwlFzY8Crk163WubeQQtejIC8FPWJP /060bA90AXo9KS3x3RxMBOpbypJoZ+dTUVs8BTO9OgiZSDQezGbgxMjFDM8jDAOdsFca WLVkFsO8mPXH8D66hVrzirkSltl2tD9SHRf75/akBkLfH2hXArKmR5/VnU6sfnQhC5gs AwKu9oH1frP2A3x0c2ExS9DMrf1dK3qIE2v7qTjMObOsoxYTthWTltCDYFdzRI6VvFU1 mSg7X6nQEzvGxH2MQHtfIsAEV6Z3BOcRG45p54FYf4cYwFLov8jYMNAYAdr5h1ijzsc1 TSQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691210741; x=1691815541; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0Ri4Eh44IPRnBeWk/hxMHZMiN24KG42dufyrl/Raytg=; b=KLBKTvQU2SHP+IUX/ShZRGb7dKAhck5ByLceIyBto7fQ5iQlrD5J8Hau4eTOkWgf/u QN5qC6rlqn8k62ZjEx/etugGD2o3tq3RppAtOUYl5KlVpMTY1HIxc0IW/2+T5ms8e3Tp LWaQhj8IOaOnPcbNDQrQaH6Ru595po8UqbuPmaS9KRo9nj5NXVwqVRhfuiSFw5L1+Idi inyuxQnBGJ1KZRFLez8B4iJzmllgCuzEoNsQfgFqLCoGl3KH+qae9nINKGVAbVqLQmwt 1KAexf1UTOKvJxgO0ykrxjhZI2k1PmUzKksVMaDmBSZNRvgjV3hBCjNkfmSJTg4hK5J2 Y0YA== X-Gm-Message-State: AOJu0YzM0o9WJpbMGZudmPUr0p7ajoD+aAsH3jwxgBiInNZ1jCG6fMNM rCGC7JAHEUGWD6U90IycY3A3mD8QSkg= X-Google-Smtp-Source: AGHT+IHlKuHNg/jDAQWaFaasnQwQTTGJAAwDSHASClxF8n+gRwV22BFUTdWYBiLCFVeB5cpUd0Rjzg== X-Received: by 2002:adf:e0cb:0:b0:317:a499:72c8 with SMTP id m11-20020adfe0cb000000b00317a49972c8mr1089792wri.1.1691210741477; Fri, 04 Aug 2023 21:45:41 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id d17-20020a5d6dd1000000b003140fff4f75sm4106865wrz.17.2023.08.04.21.45.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Aug 2023 21:45:41 -0700 (PDT) Message-ID: <53adcd9bf14548187bd2ee0f4d0073959fde66cb.1691210737.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sat, 05 Aug 2023 04:45:36 +0000 Subject: [PATCH 4/5] trailer: trailer location is a place, not an action Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Linus Arver , Linus Arver Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Linus Arver From: Linus Arver Fix the help text to say "placement" instead of "action" because the values are placements, not actions. While we're at it, tweak the documentation to say "placements" instead of "values", similar to how the existing language for "--if-exists" uses the word "action" to describe both the syntax (with the phrase "--if-exists ") and the possible values (with the phrase "possible actions"). Signed-off-by: Linus Arver --- Documentation/git-interpret-trailers.txt | 2 +- builtin/interpret-trailers.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/git-interpret-trailers.txt b/Documentation/git-interpret-trailers.txt index 91a4dbc9a72..c9b1e60251d 100644 --- a/Documentation/git-interpret-trailers.txt +++ b/Documentation/git-interpret-trailers.txt @@ -116,7 +116,7 @@ OPTIONS and applies to all '--trailer' options until the next occurrence of '--where' or '--no-where'. Upon encountering '--no-where', clear the effect of any previous use of '--where', such that the relevant configuration - variables are no longer overridden. Possible values are `after`, + variables are no longer overridden. Possible placements are `after`, `before`, `end` or `start`. --if-exists :: diff --git a/builtin/interpret-trailers.c b/builtin/interpret-trailers.c index c5e83452654..cf4f703c4e2 100644 --- a/builtin/interpret-trailers.c +++ b/builtin/interpret-trailers.c @@ -97,7 +97,7 @@ int cmd_interpret_trailers(int argc, const char **argv, const char *prefix) OPT_BOOL(0, "in-place", &opts.in_place, N_("edit files in place")), OPT_BOOL(0, "trim-empty", &opts.trim_empty, N_("trim empty trailers")), - OPT_CALLBACK(0, "where", NULL, N_("action"), + OPT_CALLBACK(0, "where", NULL, N_("placement"), N_("where to place the new trailer"), option_parse_where), OPT_CALLBACK(0, "if-exists", NULL, N_("action"), N_("action if trailer already exists"), option_parse_if_exists), From patchwork Sat Aug 5 04:45:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Arver X-Patchwork-Id: 13342504 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21472C0015E for ; Sat, 5 Aug 2023 04:45:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229609AbjHEEpu (ORCPT ); Sat, 5 Aug 2023 00:45:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229510AbjHEEpp (ORCPT ); Sat, 5 Aug 2023 00:45:45 -0400 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02DC44EDB for ; Fri, 4 Aug 2023 21:45:43 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-3fe426b86a8so18859165e9.3 for ; Fri, 04 Aug 2023 21:45:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691210742; x=1691815542; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=IyCvYTpWmrnQsJJcADomOscmglATYsrcsKtWx4utdxM=; b=MjNLxfMSPicwk9nJYkVX7ZVJfYWwRkhRFxHsYISjUe0SqCQlUFswvfNilPyviqpU/y ZWTq4B72iRDzm1S2U1A2jUs0AXcRR9i6c+f2p3tPSQ5clM6/3EEkWgfS9ABxc0SygOdc wpxJ76i74zw0XSVvQyB26F+X21CZ72Ils796amivfMl7N/z0vz+wGCdC0PlWjoYJ8Rtx xQzWmAAInym33b/KAO+q1aV9QEB1Ae9E0ucaHu77nlN6xxDEoLqwWq55lU8BNZPAxRMq rkQYm7PGs4U2eDhPE+o5C8Bpl0gGCOyOXzCwFZ/BpehSMfFOL08lthcXRRulyXYjKmmv fWMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691210742; x=1691815542; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IyCvYTpWmrnQsJJcADomOscmglATYsrcsKtWx4utdxM=; b=eORwrBIy33GDu7/ENVBfyzdw6pzxW6wZJw4Qa26ACzDrz7CGCmddxj2WzLQKue47pi 5LTOR95JpVYjMuLEPI3fT4stHpfW2Mfblo+XZKHAxP4AEAF79D1kGrO43RcyTjhhk31c Uq5j9qU8vjSWGOYFhpri8PQjiuL1li6525GzTBllXdHJeGyroVwkOFXXJKJP6LaPoPuC hVecUq4QFJLQ29xp7l8zWopoegEEJ8DdM5xV08WWHw7NYQX5axIsj8PT1GZmGBfMkn4Q RQKpQs70ZJN6hE3PTWO9wWWE9HTCPwE6KTV+GSJQi8w6Lwa+R92bdl/H/k3sNQu8bCD0 +IeA== X-Gm-Message-State: AOJu0Ywg0fqZGGPflnblK28q6wvq8fTjmD17a63VpykBkIluczMIH08N FP6Vy/Ko6fD0ql94+RjmvVvJb+8cIxc= X-Google-Smtp-Source: AGHT+IGgSi3+JaZ0t1zA1WnuYHGiLpQTXtTRePvL52SUmSZ6E2DLTO5PkH5TqsHfPV6Adl+ANAw57A== X-Received: by 2002:a1c:7211:0:b0:3fe:19cf:93ca with SMTP id n17-20020a1c7211000000b003fe19cf93camr2922766wmc.8.1691210742033; Fri, 04 Aug 2023 21:45:42 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id q7-20020a1cf307000000b003fa98908014sm8313623wmq.8.2023.08.04.21.45.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Aug 2023 21:45:41 -0700 (PDT) Message-ID: <68bc89beb2a26e8ae0ae67d1489a06af9fc37fa0.1691210737.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sat, 05 Aug 2023 04:45:37 +0000 Subject: [PATCH 5/5] trailer --no-divider help: describe usual "---" meaning Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Linus Arver , Linus Arver Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Linus Arver From: Linus Arver It's unclear what treating something "specially" means. Signed-off-by: Linus Arver --- builtin/interpret-trailers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/interpret-trailers.c b/builtin/interpret-trailers.c index cf4f703c4e2..a7623dbfb2e 100644 --- a/builtin/interpret-trailers.c +++ b/builtin/interpret-trailers.c @@ -109,7 +109,7 @@ int cmd_interpret_trailers(int argc, const char **argv, const char *prefix) OPT_BOOL(0, "unfold", &opts.unfold, N_("join whitespace-continued values")), OPT_CALLBACK_F(0, "parse", &opts, NULL, N_("set parsing options"), PARSE_OPT_NOARG | PARSE_OPT_NONEG, parse_opt_parse), - OPT_BOOL(0, "no-divider", &opts.no_divider, N_("do not treat --- specially")), + OPT_BOOL(0, "no-divider", &opts.no_divider, N_("do not treat \"---\" as the end of input")), OPT_CALLBACK(0, "trailer", &trailers, N_("trailer"), N_("trailer(s) to add"), option_parse_trailer), OPT_END()