From patchwork Thu Aug 10 21:17:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Arver X-Patchwork-Id: 13349932 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 B6833C001DE for ; Thu, 10 Aug 2023 21:18:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230075AbjHJVSO (ORCPT ); Thu, 10 Aug 2023 17:18:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229980AbjHJVSJ (ORCPT ); Thu, 10 Aug 2023 17:18:09 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 029732737 for ; Thu, 10 Aug 2023 14:18:07 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3fe8242fc4dso4870175e9.1 for ; Thu, 10 Aug 2023 14:18:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691702285; x=1692307085; 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=xqbymNwl5V4REVHu/vWP1mc5fgKe6eDtx9Vl/hSKJSU=; b=lvpVqJXFtLvUTzTLRlhWBUNhCPFDoggEqBUDfKdweLxRiylyJusw0IAZ1HmhTF3ouL Cvmg68XacGYsAA4FD9zWCJL95KEg0U6xgHrrrhHB+gwpfpG256fcDIFBP0XrJ9PSXIAD M1iGr4AMSpBBQg4n0ubl7L3NXiTDWUMuJUV30T/Ra6opzmt8ahMjFL5ZUE4OXVdXg4JN 93H0rE6yGpDRsMp6+0NDJ1UAo1SI9lpUt02W8+fs6AkC4teahX3INJNer10Sl2e88tuN a+Idqqm4G1n7Jk1zwsWrGrAL1rHhauITYUUbwNP7yBV0wrGfjv4AgxwHHKJZXKzUWjau 6lMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691702285; x=1692307085; 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=xqbymNwl5V4REVHu/vWP1mc5fgKe6eDtx9Vl/hSKJSU=; b=cyxZJRpSkOwjX25r9hQ2l9Dq3waj9BlCBNQEMJMVA08xW2lCJ6i5VL0Jc0RgcomA+Y fKb2IMsCynw0Qb7y80cFW6HeuYBxgURlQFeaMNv+FhFqA7d4ntwk/JaFDxHm2eKbmOzx wtKDhT5hIwmgEFBev6xbCcjjOr/mGi/dxq6WHmJLRKQtm6DuyNtEKVPBz5/Z7w1kgtAo +S22R9uYkY8aAXxW7qRrCPdIu/E3ntL63t7ocrh/UtZZ20J6iDFwNQstnaWw5u9iJpa7 wGMH0TSNPci4tw0/Z+s1pEoLQ8rK7Ir8HdQjnfBBRVH/n7vdvp8OKDtH3j9uIEWVktX0 5ExA== X-Gm-Message-State: AOJu0YzLO6RSAPllhQFSENT2dawjDt0NDXV8qBTMToT85qN3SidrB1XL K73VMmBZGH+5LS6Eg+VGchW5pvlhzeo= X-Google-Smtp-Source: AGHT+IHZuhNm9DplZl5E3aWhkcAh4wtTbK59lXFvkNRn3SgGGTql+gpKMhhKTDr6KrfBC+UfJnjDTQ== X-Received: by 2002:a05:600c:2295:b0:3fe:16c0:6b44 with SMTP id 21-20020a05600c229500b003fe16c06b44mr73671wmf.12.1691702284970; Thu, 10 Aug 2023 14:18:04 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id l18-20020a1ced12000000b003fc01f7a42dsm3198233wmh.8.2023.08.10.14.18.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Aug 2023 14:18:04 -0700 (PDT) Message-ID: <1623dd000ddef40ffb6ca44cf7ce66d1c42b0d13.1691702283.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Thu, 10 Aug 2023 21:17:51 +0000 Subject: [PATCH v2 01/13] trailer tests: make test cases self-contained Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Christian Couder , 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. In addition, in some test cases we removed "git config --unset ..." lines because they were no longer necessary (as the --unset was being used to clean up leaked configuration state from earlier test cases). The process described above was done repeatedly 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 Thu Aug 10 21:17:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Arver X-Patchwork-Id: 13349931 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 F156FC001B0 for ; Thu, 10 Aug 2023 21:18:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229988AbjHJVSJ (ORCPT ); Thu, 10 Aug 2023 17:18:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229929AbjHJVSI (ORCPT ); Thu, 10 Aug 2023 17:18:08 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AF402738 for ; Thu, 10 Aug 2023 14:18:07 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-3fe426b86a8so12337765e9.3 for ; Thu, 10 Aug 2023 14:18:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691702285; x=1692307085; 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=EKIXQ1IKW7oRPMDi7pjDfNjWS7FBElJw0xLdA4b1LiwFkzD3ZcMJVihPe4Byd9384W 0jBLTqN5C2dnHtppNs6JJvK9g+D0Kpwadw687kGLDE7Q8UaeAJdakbiNKT5XKbTLzMh3 pV/1WFyJN41aoq39vtM8vAgwX5qj5G8+m0azNiYn6UPDdtqHLHxxGEI2uh4T1WkFSIHp FNf6llqLX/DzUgWaC9pehQMeqsYgDeYqbH11SrHe1xVm/TbDdh/LkRKAnXfmfOWfDd8p ItzFFEE2U+v63Fl4wQYrAUtAnVi2RkG0XezTGp8JsqsJ+YD7K0xWb+rSudJTjpjJ9ZQH xXZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691702285; x=1692307085; 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=SZHiHyJ26LADgAwsQd8/jbqxFABz7ggpsE6N5W4CrqgnfJri8yVYmtqQh9q/mZnykT RqE+nZOJqp4D7uvG5fjZiYO64XI4GsXV0fwzuiw0dWsfJqcunrKGgmLP13kgGIX+i6dj ODJ22nrQpSQKL6jHLKMQLoVt0diZh4R+oSkpvbfVZTuSD79l3hX84tnS5uJc57j75Yya k/ereut6nZYCbvewBT+FdvmnXn9jDKEOkTkCB5mfjEvkjDHHyT9lVDrwIL1ELmN/DACz Y6j88PM4TF2MZVHs90yiQswb4MevQnN+X7SlT/eZWEgmJ3Rs/uWUvbbGb92zMpHw/3+g vO6A== X-Gm-Message-State: AOJu0Yzj+2g8TZgLgY97eXbn4QrUy+X8KrFOmIKBN+FyU6FZihYHIVXo ers3Komgm0KnXsP5q/DoQvD/JERev+I= X-Google-Smtp-Source: AGHT+IHD58Ob+8TmhEQ5sUAFWYuzyRIrxj6yU6d5q7Um3MzVJtpEOjTuilW755fymIWBFfBQLaeNKQ== X-Received: by 2002:adf:ec4d:0:b0:317:e68d:f862 with SMTP id w13-20020adfec4d000000b00317e68df862mr2748357wrn.37.1691702285583; Thu, 10 Aug 2023 14:18:05 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id q4-20020adff944000000b003143c9beeaesm3249453wrr.44.2023.08.10.14.18.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Aug 2023 14:18:05 -0700 (PDT) Message-ID: In-Reply-To: References: Date: Thu, 10 Aug 2023 21:17:52 +0000 Subject: [PATCH v2 02/13] trailer test description: this tests --where=after, not --where=before Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Christian Couder , 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 Thu Aug 10 21:17:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Arver X-Patchwork-Id: 13349934 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 AA8B6C04A94 for ; Thu, 10 Aug 2023 21:18:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230097AbjHJVSR (ORCPT ); Thu, 10 Aug 2023 17:18:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229929AbjHJVSK (ORCPT ); Thu, 10 Aug 2023 17:18:10 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2751E2727 for ; Thu, 10 Aug 2023 14:18:08 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3fe490c05c9so14455565e9.0 for ; Thu, 10 Aug 2023 14:18:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691702286; x=1692307086; 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=AkGCKnumUuDbNY/x7tHLZa8QF5yNXe/B3WR+xfL+x9Ht6A+UY9ndwyIcIwRXbP0lL3 JAzbbp1adkzkghcnnjQ6yRFFKfJ0FmUruGXwR/hSV+T1WDzmfIIHxD2rjqnY9p2pdiYR otSePc9cmSxj2ZVl+iEnms4dw5NmEnI1rm/geyoh6kQRsYIiTkbTseflpiKylkW2jG2W mskL0JyfTOCZ05JWn/KxdI69NJFPAcn9nqHNiaq/p+SC3OC9wPcAjJ+4imjpSWjwOzSq tmqbHJRIjq+1/3uF9+NlYuNCSMLWMO+8nPYCEVO9GT97hhyluGB8SqiOJst6lr8kUjCl KdQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691702286; x=1692307086; 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=L75AX1Z3psEBtQ6r06sYBvc2yKnAhNYCQ66zTdOHWQfW5nNgK8SY4508amxgXecpJt lxqV9aqLJS4Mon+RKsD3m5F8/Cqp4KGKuL6pNLnXyq6sxG07EU6bHlk2OtuN4mj1OH8S +MeR5/+a0Zxl9vpYVTqUfmF/rbHALsryG5JyeWn+a9TYylS+qbJREWsNrF7HWWYk8kBN iVVbogbRmQNzNR8Lhco63b2jg2/Gt1/PXZsLI3MZSRktRiFKPoZD4yz/Z+THiPT34e7s U0S83YQJaYcz96apqsD9Q8oM7uaedC1aHZK2IULe1l/EX9IaaDz6Igmt7obCe1iarCl2 PXLQ== X-Gm-Message-State: AOJu0YyJiAsIKGpsqQWQ3IMVfPXHFscF1ZVVIAorGwtprdgfmO05bz1j vT9QE/2gk9Mp5QB1Wx5Di0TUHqzI2ao= X-Google-Smtp-Source: AGHT+IGu0xLrEBoO5Qw6+H/K3//ekJj6VbHF0cjpSLRbbu2aGDSFv6l9wmdfxn7dPKDUQfxNs/6GRQ== X-Received: by 2002:adf:ff8f:0:b0:313:e391:e492 with SMTP id j15-20020adfff8f000000b00313e391e492mr48798wrr.17.1691702286333; Thu, 10 Aug 2023 14:18:06 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id b13-20020adfe30d000000b003113ed02080sm3224796wrj.95.2023.08.10.14.18.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Aug 2023 14:18:05 -0700 (PDT) Message-ID: <4b5c458ef436c2d208e6d6d0a1f99c65e9a11125.1691702283.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Thu, 10 Aug 2023 21:17:53 +0000 Subject: [PATCH v2 03/13] trailer: add tests to check defaulting behavior with --no-* flags Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Christian Couder , 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 Thu Aug 10 21:17:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Arver X-Patchwork-Id: 13349933 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 260A0C41513 for ; Thu, 10 Aug 2023 21:18:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229971AbjHJVSP (ORCPT ); Thu, 10 Aug 2023 17:18:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229992AbjHJVSK (ORCPT ); Thu, 10 Aug 2023 17:18:10 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DABA2738 for ; Thu, 10 Aug 2023 14:18:08 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3fe12baec61so11695275e9.2 for ; Thu, 10 Aug 2023 14:18:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691702287; x=1692307087; 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=1oQmft0cjVhwbiWKvOpOPZ4GHmuR71V36XV/wh8G53w=; b=X0hEe8fMZVb1RZCDp4VoyhbGQB7GaIEZlCig8b9ENPg8bp2IEe5IqEkEyYd/t966JC OzeJ5qmTRfDDv3S8kn+ZXun2UU8AX8Qz4ZIAeaQqapWNbBveo5arbt7IhuliCgKgq2lm d+yodSxQEf/nJyut1UiCVcRrm8YXlnQqKsVCY0xSOLNY3wVWx0uI3jVprDTq0XOnrWYn 4JPHijAV1zSQASUeTlZ9LyieqrRjFl4Z2I2HSwKnWnyPBpdUTk6iLwbD6eoE7/9U+86U UCS9n64jZncsK1Lx5c7tkolyI/WUT43+Hzb0V0M1eqKO6pmJtnlmu/Md931ObPd3GZFJ MbBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691702287; x=1692307087; 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=1oQmft0cjVhwbiWKvOpOPZ4GHmuR71V36XV/wh8G53w=; b=H1WOzSN1oSVikseYOI6Viw7IjCOZxw1M7QJe6+jUPWkv6o6KDAFBuIYH4sAN0bnWmq a+OownWeJTcTia1T/+ZQGd3trNeuwwa+Sb/fNUiwprQP5S8RkWEiJrhwsiYuFtGvYuSf fqE+D/xwnNQbhcI3+Ii8cQaD76lYfkn3iFfd1yHrMfdoAJilF433bS4wVl9eQ+Dov+3w L9ilo8gnRlgcS7oKe4wj3ilt0ekyFXR3MTCSbThVrfpMnap/vIbebwV9bqz+IqAoSMm3 yNMyeinNswFdptcAorLLK8o6J9nVu2/BegcGh5U/7iWhIPm1pH7ULlNjbOibDl/xo3ER YA+g== X-Gm-Message-State: AOJu0YzhUOXubWF9aQnhscnUdGDRqVgqFRE6GEIyxnxdA20sa6EAjjTY hr5I/mMp76u3fYeVHkOpX1HVBgLrNcE= X-Google-Smtp-Source: AGHT+IFFYqcgKfbExMMDphx/vwKPY+Bm6uFOxW72VKFsPGjDyXEf0Ks+rfB8cokH6A1oluXFtitAHw== X-Received: by 2002:a5d:42c7:0:b0:319:52a5:569f with SMTP id t7-20020a5d42c7000000b0031952a5569fmr1647288wrr.11.1691702286825; Thu, 10 Aug 2023 14:18:06 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id c13-20020a5d528d000000b003142c85fbcdsm3249271wrv.11.2023.08.10.14.18.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Aug 2023 14:18:06 -0700 (PDT) Message-ID: <0df12c5c2dda5799074f0dcea696df0a63ca1145.1691702283.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Thu, 10 Aug 2023 21:17:54 +0000 Subject: [PATCH v2 04/13] trailer doc: narrow down scope of --where and related flags Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Christian Couder , Linus Arver , Linus Arver Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Linus Arver From: Linus Arver The wording "all configuration variables" is misleading (the same could be said to the descriptions of the "--[no-]if-exists" and the "--[no-]if-missing" options). Specifying --where=value overrides only the trailer.where variable and applicable trailer..where variables, and --no-where stops the overriding of these variables. Ditto for the other two with their relevant configuration variables. Reported-by: Junio C Hamano Signed-off-by: Linus Arver --- Documentation/git-interpret-trailers.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Documentation/git-interpret-trailers.txt b/Documentation/git-interpret-trailers.txt index 91a4dbc9a72..72f5bdb652f 100644 --- a/Documentation/git-interpret-trailers.txt +++ b/Documentation/git-interpret-trailers.txt @@ -112,7 +112,8 @@ OPTIONS --where :: --no-where:: Specify where all new trailers will be added. A setting - provided with '--where' overrides all configuration variables + provided with '--where' overrides the `trailer.where` and any + applicable `trailer..where` configuration variables 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 @@ -123,7 +124,8 @@ OPTIONS --no-if-exists:: Specify what action will be performed when there is already at least one trailer with the same in the input. A setting - provided with '--if-exists' overrides all configuration variables + provided with '--if-exists' overrides the `trailer.ifExists` and any + applicable `trailer..ifExists` configuration variables and applies to all '--trailer' options until the next occurrence of '--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 @@ -134,7 +136,8 @@ OPTIONS --no-if-missing:: Specify what action will be performed when there is no other trailer with the same in the input. A setting - provided with '--if-missing' overrides all configuration variables + provided with '--if-missing' overrides the `trailer.ifMissing` and any + applicable `trailer..ifMissing` configuration variables and applies to all '--trailer' options until the next occurrence of '--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 From patchwork Thu Aug 10 21:17:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Arver X-Patchwork-Id: 13349935 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 71B25C001B0 for ; Thu, 10 Aug 2023 21:18:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230109AbjHJVSS (ORCPT ); Thu, 10 Aug 2023 17:18:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229993AbjHJVSL (ORCPT ); Thu, 10 Aug 2023 17:18:11 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4ADA82D47 for ; Thu, 10 Aug 2023 14:18:09 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3fe2ba3e260so12126165e9.2 for ; Thu, 10 Aug 2023 14:18:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691702287; x=1692307087; 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=khwfBRi3Dsan8ZlxMTVmXTmzM2RY6h9G9wQX3EGM/So=; b=eDLZVIeJy8KnixsYr4FJsC1b3l1SFf4hGxICk0hCi7Mxly46rTaDCPtR9MeUu/f5r2 Jpa+psN7MIDROxhggQdRP2gFwKHtF++DXmZa4ub6fi95cmEh6aD16gte3uBn5+azg456 VLKYc7i+XLmHpS1aPuKJAk0zpCx6ni9AihnTbhO6afdjLH0c60hBOHWh0BQm4lO9HSFj Z4IC2e7tarJYuV5lFbLKcvATlyl4QUji5sslAEyq85yToe9DrDroEwkOD0ET8pDmuX9X TnULSL+rmxkHd0BF7UV/8uE3Pd3lPpgxwPmeKt9t68Vi6V5O2rC6l/krTwH2tv5VczVP 0Xog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691702287; x=1692307087; 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=khwfBRi3Dsan8ZlxMTVmXTmzM2RY6h9G9wQX3EGM/So=; b=dMaAHO/zx4zp4x5br5aQDJt3WihWaMSckmN30gqV1porrGv1wuU8a7Q9IDNCvIunxd DnQLosmonf47qEekoRnvdb2q5hQTT+63o/IT9kf3e5wyHdAQF3ONeFXzYnt5jTv2dC+R 5uwR2BpzQWl4J88D1nXsIlWrSTlaDlRmjJH/2MWCU1xiI1UBbLwGfm7tv/reSV6cuiF1 3kv10PIDzNjXh6P0KFNqUbJDv3OW3lgWNxDSgmISld4FqnfJ8qB3ARaYGGMxrPinAztu iFijpGokpKdlj/BUaMq1Rt5RNerTE7ClpunNV3l81xUf9Stm+oMAb5Kyt019W7e/oMCs GLZg== X-Gm-Message-State: AOJu0YxFjxLRiICrf4578kFJR8ciAJylsWzJ5FtYlsGmMP1r9f3Xg1Y8 aUUQrWuwSh8LakVU0JFZ7vKnHnwdJr0= X-Google-Smtp-Source: AGHT+IEqTaJijtu+1w3kqacdoQyeQhxx6IpWmTHIQol7moZeLWCuzbDO2jA9PbCzFHYPItSf+TkCyw== X-Received: by 2002:a7b:c045:0:b0:3fb:40ff:1cba with SMTP id u5-20020a7bc045000000b003fb40ff1cbamr89259wmc.6.1691702287621; Thu, 10 Aug 2023 14:18:07 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id n20-20020a7bc5d4000000b003fe2a40d287sm3261045wmk.1.2023.08.10.14.18.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Aug 2023 14:18:07 -0700 (PDT) Message-ID: <040766861e21afe5f686299560677e429be11844.1691702283.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Thu, 10 Aug 2023 21:17:55 +0000 Subject: [PATCH v2 05/13] trailer: trailer location is a place, not an action Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Christian Couder , 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 72f5bdb652f..b5284c3d33f 100644 --- a/Documentation/git-interpret-trailers.txt +++ b/Documentation/git-interpret-trailers.txt @@ -117,7 +117,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 Thu Aug 10 21:17:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Arver X-Patchwork-Id: 13349936 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 612EAC001DE for ; Thu, 10 Aug 2023 21:18:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230113AbjHJVSU (ORCPT ); Thu, 10 Aug 2023 17:18:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229996AbjHJVSL (ORCPT ); Thu, 10 Aug 2023 17:18:11 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF2662D48 for ; Thu, 10 Aug 2023 14:18:09 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3fe82a7873fso4549155e9.3 for ; Thu, 10 Aug 2023 14:18:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691702288; x=1692307088; 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=i/VDMOh3TsPv7xMcmsqpK/tKm1kcbV50XnF9gj3xbN6rGMOQStpRqZvriV9XICpKvL 6hDbxkkqRjda0MjIhGM4hmw/aBr9VJHpQ4RpFd88FxnlM5Qvg6d+UHHe2sSnjZyLd4GQ dvxAb8BG4fmk+YqJo0bcpqxwCQN0iSHA6lGaKUhBcGlaz/sx6F8WuvcGSazcPwmeQIgG iQXT8waPCP3rkoK+RDM2TeBMFqufY+bYpTEouS6dsQGrGPMF0lf7xCLtSul0DAFmpGsj b8S9qIqXJnQxIDkyRNn3um2XYViGAgO5Blv7gdkqd/M/m0eS6qtaIF5rUO0WGe/Oumot 9L6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691702288; x=1692307088; 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=E47OpIwR3MoncA3D94FpQGZLL9LSJc070NmDOnB0ALusaH9j6zcwdLc9WAf/Hebn55 2fRexYmV9pcGaodK1Arm4izglDUU9XfNb1LI1K+oVd8nnDlzf++q/ImIoO+0U3via7qB blSNX2g4KnJ6bkynvGsFlKdhjP/7CvDCLBg1Bggouhe2+uSfPvi11YnvJPZL91BG5amk URmi9b/ISPgaagH0FMfgGle212/eZw9MKB89oZhFzXmRjgQDb7LXa/90kQxbffAZjlRT z5PuwGRy0Yb7NMdnWzZ8Zl/MweShFxvjydK3AUNdzVLi8ytHgjz/x8jIE2cd8ET6NDHj L10A== X-Gm-Message-State: AOJu0Yz/WzMaV52p9ju8wu4BQZUM3AZ/svA1QrsB+SMm4+7o0mzyWCuW cK5KmqY5acgt7T5t7ky2Nh/Fy+UvSL4= X-Google-Smtp-Source: AGHT+IHjVRy2cSw9h1XDbiAdX6kMm5EKi/PjmQ9TUInDuj1mJcT4XsECvRC/14pNqE55BDHqBGZ+/w== X-Received: by 2002:a7b:c8d2:0:b0:3fe:ad4:27b4 with SMTP id f18-20020a7bc8d2000000b003fe0ad427b4mr43903wml.27.1691702288261; Thu, 10 Aug 2023 14:18:08 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id p19-20020a05600c205300b003fe17901fcdsm6083944wmg.32.2023.08.10.14.18.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Aug 2023 14:18:07 -0700 (PDT) Message-ID: <3e58b6f5ea264a2c42ffbd008405b46626e0f864.1691702283.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Thu, 10 Aug 2023 21:17:56 +0000 Subject: [PATCH v2 06/13] trailer --no-divider help: describe usual "---" meaning Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Christian Couder , 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() From patchwork Thu Aug 10 21:17:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Arver X-Patchwork-Id: 13349937 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 754ADC04A94 for ; Thu, 10 Aug 2023 21:18:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230127AbjHJVSV (ORCPT ); Thu, 10 Aug 2023 17:18:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230008AbjHJVSO (ORCPT ); Thu, 10 Aug 2023 17:18:14 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 886362D51 for ; Thu, 10 Aug 2023 14:18:10 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3fe4ad22e36so12359715e9.2 for ; Thu, 10 Aug 2023 14:18:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691702289; x=1692307089; 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=uPRWwjPrGNVx8kgHHVI8q2B/5Y5q8gUqpmGu9/jJZ7U=; b=JkgjrbOKAt1bVRa4zGOORLikY/w1OgqZLTGmVQmu4D52sI7TV+JJ7bbM4X07IKzGKo fxfI7OrV4OACDdYlOtbkeHvfR/lT/iVFzhON+HoH9bVvOwd+wdcGPL3nqpi22c7riX9z qfzJV0R+xNoAQHQaIt17DXuhY04TofsjyX4NR+NNKjGYPaitVWlgAnQhR8avhMX1GAIF sE+ShHs3llvs9MeTc9p0fqW/s9i1dVKO3Isv9xE1OfGtU1RqxzWBbcHQFdfTxl6VU4xn jN7aTDJEaKNlAKcPmV9840fNfksCOmu2PtFMCisfhBiOd+JMafcISHeRIKKOaCCQq9sc Pm2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691702289; x=1692307089; 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=uPRWwjPrGNVx8kgHHVI8q2B/5Y5q8gUqpmGu9/jJZ7U=; b=OZdiYRJL+OkfHlW+iNBQsSh9cN+GcB9A+X2tXhcH2xUqo5/rZMk8jbnke6Am8KygAN cVQX/sqHUwDjP1TjmrjHdGc01syahrx5iPlHFbc+04sCyB5LYYlHCh6jqH5Vnb3xtqK1 TvCQjyd+gm6733CdgbroPz6Q51L2eU12WQE79bFD2QDuz1w33xsOPDXuT+K1nufrxNfN UqBGeTXxtxdaHmfzo/SEgzIloYDTLGGIP+6ZH4NCsVmIHPxep0mVOzdYHheWhkWkE501 RVcWzCrqzeLtgpHPlYbAik2BC/XLMA4TV+zsv8QoGLgLjrdlUyiBiZUt5zpiVjpO9JU4 BTNA== X-Gm-Message-State: AOJu0YwvymCq6GdTk6JJxkMVzuILFkzCGf/q3ZRNXyS85EAobj33JyAk mQySl9qW0ifBgLSzJ3XlHnfxrg+rUIc= X-Google-Smtp-Source: AGHT+IFVC/MtfLqjLS7CWTGtFZZxjG2QB/8mOYW2MtbC+mdvr3ragRzdsYdQ8UbYBwJuraIJ1UlB7A== X-Received: by 2002:a05:600c:ac4:b0:3f5:146a:c79d with SMTP id c4-20020a05600c0ac400b003f5146ac79dmr64149wmr.15.1691702288888; Thu, 10 Aug 2023 14:18:08 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id v14-20020a1cf70e000000b003fe24441e23sm3198277wmh.24.2023.08.10.14.18.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Aug 2023 14:18:08 -0700 (PDT) Message-ID: In-Reply-To: References: Date: Thu, 10 Aug 2023 21:17:57 +0000 Subject: [PATCH v2 07/13] trailer --parse help: expose aliased options Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Christian Couder , Linus Arver , Linus Arver Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Linus Arver From: Linus Arver The existing description "set parsing options" is vague, because arguably _all_ of the options for interpret-trailers have to do with parsing to some degree. Explain what this flag does to match what is in the docs, namely how it is an alias for "--only-trailers --only-input --unfold". 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 a7623dbfb2e..5f3e1a38eee 100644 --- a/builtin/interpret-trailers.c +++ b/builtin/interpret-trailers.c @@ -107,7 +107,7 @@ int cmd_interpret_trailers(int argc, const char **argv, const char *prefix) OPT_BOOL(0, "only-trailers", &opts.only_trailers, N_("output only the trailers")), OPT_BOOL(0, "only-input", &opts.only_input, N_("do not apply config rules")), OPT_BOOL(0, "unfold", &opts.unfold, N_("join whitespace-continued values")), - OPT_CALLBACK_F(0, "parse", &opts, NULL, N_("set parsing options"), + OPT_CALLBACK_F(0, "parse", &opts, NULL, N_("alias for --only-trailers --only-input --unfold"), PARSE_OPT_NOARG | PARSE_OPT_NONEG, parse_opt_parse), OPT_BOOL(0, "no-divider", &opts.no_divider, N_("do not treat \"---\" as the end of input")), OPT_CALLBACK(0, "trailer", &trailers, N_("trailer"), From patchwork Thu Aug 10 21:17:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Arver X-Patchwork-Id: 13349940 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 B56FCC001DE for ; Thu, 10 Aug 2023 21:18:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230248AbjHJVS0 (ORCPT ); Thu, 10 Aug 2023 17:18:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230037AbjHJVSO (ORCPT ); Thu, 10 Aug 2023 17:18:14 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 679832112 for ; Thu, 10 Aug 2023 14:18:11 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3fe4ad22eb0so12095545e9.3 for ; Thu, 10 Aug 2023 14:18:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691702290; x=1692307090; 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=HAdMcJmsl1UanPeZ7HNoKYmoBWhQMLXpHLt9O3kOd1A=; b=eJf1TsXLcynC7W0NZStrLiRSluTR8V+1TcjRO12WQAvgJPVDpVFjYwgFGXdNq3CsxV c59t3R/Ih6rRi0JvPSPviaBHmw9/cwiRYp4D8mZM6kf43fHFhQQ+PAnRPZ8BuRYXtM2g nUR4MEl7a7k9tdGNJmGhWe+o8nTYlPs5+lhZ9sMsbq4ZszwB3Q68yAVK8nRdPEWk+XtZ +8e1ee+Rlsyx4cbCU6wsMq7h4Ri3ua0ll84JAYYncGkLUJnRJqvWv0J05MkopIh4TdEC i2PwMvBXoh6VU1tuF7jJ64jQTPi3928yKDDzpIxCvWvTiHDQ7GAjC+Ifxect1WdY5AQw e8YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691702290; x=1692307090; 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=HAdMcJmsl1UanPeZ7HNoKYmoBWhQMLXpHLt9O3kOd1A=; b=lktczzLCdXOUHMVUr1nQrGcdrMV/09kYnQv/KUwO/CUFHYaIEVaNAcnJEVYsCK5h+f Kv+ydEycRw/dzVGhrFw4LRiD+8ZWDFdzgkvBdGABjP0UwAzZfOlOeShJPZjOSmAO58is YCaBCUZ0NDckMv23k8MjTS0Xl9U1JwrrX+cSTHUJQRU6EESRDJ0Dy6QlyRXbc33zNS3N 9xcOsCN6ckeJ9GuckiXQ/DPSsSwuA38tL/Bb/J3Vd5dOskCCskcZxH5Lvb0EIEN+PyVJ A3Xr+Zvzg2IbG60qTb9JK++F1tXklzLawa/dIFTsDfSRJHfGooGzZKbcPDGmZZjugjI6 mPBw== X-Gm-Message-State: AOJu0YwqIUOGNyEymqIea2yldmDY4iHtfSqPU82+MsZIi4aOdVwRF4sl NdsYDq4BsDtfNHhCVUDtQE7hcpijcXE= X-Google-Smtp-Source: AGHT+IEgN+dk+jaMI9ntm16jry9kX9BmoMgQJvP3WwAXvRXJqHW9GsK4BZ9HYoGj+srphF2D6qRrbA== X-Received: by 2002:a7b:ca4f:0:b0:3fe:1af6:6542 with SMTP id m15-20020a7bca4f000000b003fe1af66542mr36270wml.33.1691702289522; Thu, 10 Aug 2023 14:18:09 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id h14-20020a05600c260e00b003fa8dbb7b5dsm3224243wma.25.2023.08.10.14.18.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Aug 2023 14:18:09 -0700 (PDT) Message-ID: <5cfff52da8ff586248ba394248e7b086ed792549.1691702283.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Thu, 10 Aug 2023 21:17:58 +0000 Subject: [PATCH v2 08/13] trailer --only-input: prefer "configuration variables" over "rules" Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Christian Couder , Linus Arver , Linus Arver Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Linus Arver From: Linus Arver Use the phrase "configuration variables" instead of "rules" because (1) we already say "configuration variables" in multiple places in the docs (where the word "rules" is only used for describing "--only-input" behavior and for an unrelated case of mentioning how the trailers do not follow "rules for RFC 822 headers"), and (2) this phrase is more specific than just "rules". Signed-off-by: Linus Arver --- Documentation/git-interpret-trailers.txt | 4 ++-- builtin/interpret-trailers.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/git-interpret-trailers.txt b/Documentation/git-interpret-trailers.txt index b5284c3d33f..0eea937c30e 100644 --- a/Documentation/git-interpret-trailers.txt +++ b/Documentation/git-interpret-trailers.txt @@ -149,8 +149,8 @@ OPTIONS --only-input:: Output only trailers that exist in the input; do not add any - from the command-line or by following configured `trailer.*` - rules. + from the command-line or by applying `trailer.*` configuration + variables. --unfold:: Remove any whitespace-continuation in trailers, so that each diff --git a/builtin/interpret-trailers.c b/builtin/interpret-trailers.c index 5f3e1a38eee..f70c5df8d4b 100644 --- a/builtin/interpret-trailers.c +++ b/builtin/interpret-trailers.c @@ -105,7 +105,7 @@ int cmd_interpret_trailers(int argc, const char **argv, const char *prefix) N_("action if trailer is missing"), option_parse_if_missing), OPT_BOOL(0, "only-trailers", &opts.only_trailers, N_("output only the trailers")), - OPT_BOOL(0, "only-input", &opts.only_input, N_("do not apply config rules")), + OPT_BOOL(0, "only-input", &opts.only_input, N_("do not apply trailer.* configuration variables")), OPT_BOOL(0, "unfold", &opts.unfold, N_("join whitespace-continued values")), OPT_CALLBACK_F(0, "parse", &opts, NULL, N_("alias for --only-trailers --only-input --unfold"), PARSE_OPT_NOARG | PARSE_OPT_NONEG, parse_opt_parse), From patchwork Thu Aug 10 21:17:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Arver X-Patchwork-Id: 13349938 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 76DD6C001DE for ; Thu, 10 Aug 2023 21:18:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230157AbjHJVSX (ORCPT ); Thu, 10 Aug 2023 17:18:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230009AbjHJVSO (ORCPT ); Thu, 10 Aug 2023 17:18:14 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C57B42D55 for ; Thu, 10 Aug 2023 14:18:11 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-3fe24dd8898so12641465e9.2 for ; Thu, 10 Aug 2023 14:18:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691702290; x=1692307090; 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=YH2eCz+ojYjlC28yymk59q16Hks8uxKTS4lfGNd8zkY=; b=KWPRm1YBh0XfJmgmnSLNHcmEBj5i8elP5USpemhioK5WzYaxTtDaaJ+jJxefBacbZ1 LGRNnNqJPtVKPzrBIJGctwgJ1i1AIBoTkHn5aK5vBY+2j+Jt/BsXUil9QqKOldoNup5O 2UdVa0g9m2t/jsDrxltxuFe4OIpJl+uArx3mO/i1TJNOiYRyfi/kQ6u25B/k7M476fhI KOUwGGWgN/19ahHxtORi72m8dXU9HbZKQBKj7qP54TxzkOGTUia5IwBPyyfrYVqS/5jv 7SiykFzJpBBhOqJhk5HLKiCotgoMwnzX28FbCWKLiXsFmM9KT9HYmdweLqRNPUStZ5Eu KHZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691702290; x=1692307090; 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=YH2eCz+ojYjlC28yymk59q16Hks8uxKTS4lfGNd8zkY=; b=TWwm8TIpyLPQXUAd+QpzDYN0T5F6DoHOb19IRGGofdGDi8YrVzODJ8BCS3uL14qntz dNIkeWxIjM5d6WbGX473uaz1Po//cQ5PnP765JQ43HZzyVWqMUd4bOGOkd96ybvLjKVo 7mxs8OXGXa+5RfguTPKNz2CbjiMlQRiN1npfjGUbOiALmc7GOWvY9GgD1qD+V+0cityo 46A41vA4chwXR2I6MCP9KA/96nB9WwPD859kaba8zxl+C2yBfzSISQlOUMMJ2t8NU1Er ZhZV28bpLZY22REhdTnoWEa7zaAEAOgBmnIimYyOsIlQDQSuMUhV/+yqB8IRWk3kLgpu BBnQ== X-Gm-Message-State: AOJu0Yxctlf2Ya3CNNc1SMsnNcJZe80YleFJakFXrhRWH0GX7Aa7oLJp PSUNkeyvmVa8jJ1vAxfeZmtyehp0hLQ= X-Google-Smtp-Source: AGHT+IG4mPdI/Z5B9oSPJiBVm/6E4JFsMn6pdwS7RB1GdadaXOhpRd98YK1KVO47dRmrluImqSc0cg== X-Received: by 2002:a05:600c:234b:b0:3fc:521:8492 with SMTP id 11-20020a05600c234b00b003fc05218492mr64255wmq.5.1691702290053; Thu, 10 Aug 2023 14:18:10 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id n5-20020a05600c294500b003fbaade0735sm6125289wmd.19.2023.08.10.14.18.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Aug 2023 14:18:09 -0700 (PDT) Message-ID: In-Reply-To: References: Date: Thu, 10 Aug 2023 21:17:59 +0000 Subject: [PATCH v2 09/13] trailer --parse docs: add explanation for its usefulness Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Christian Couder , Linus Arver , Linus Arver Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Linus Arver From: Linus Arver For users who are skimming the docs to go straight to the individual breakdown of each flag, it may not be clear why --parse is a convenience alias (without them also looking at the other options that --parse turns on). To save them the trouble of looking at the other options (and computing what that would mean), describe a summary of the overall effect. Similarly update the area when we first mention --parse near the top of the doc. Signed-off-by: Linus Arver --- Documentation/git-interpret-trailers.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Documentation/git-interpret-trailers.txt b/Documentation/git-interpret-trailers.txt index 0eea937c30e..2d49445b1c3 100644 --- a/Documentation/git-interpret-trailers.txt +++ b/Documentation/git-interpret-trailers.txt @@ -31,7 +31,9 @@ the last two lines starting with "Signed-off-by" are trailers. This command reads commit messages from either the arguments or the standard input if no is specified. -If `--parse` is specified, the output consists of the parsed trailers. +If `--parse` is specified, the output consists of the parsed trailers +coming from the input, without influencing them with any command line +options or configuration variables. Otherwise, this command applies the arguments passed using the `--trailer` option, if any, to each input file. The result is emitted on the standard output. @@ -158,7 +160,10 @@ OPTIONS --parse:: A convenience alias for `--only-trailers --only-input - --unfold`. + --unfold`. This makes it easier to only see the trailers coming from the + input without influencing them with any command line options or + configuration variables, while also making the output machine-friendly with + --unfold. --no-divider:: Do not treat `---` as the end of the commit message. Use this From patchwork Thu Aug 10 21:18:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Arver X-Patchwork-Id: 13349939 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 97139C001B0 for ; Thu, 10 Aug 2023 21:18:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230169AbjHJVSY (ORCPT ); Thu, 10 Aug 2023 17:18:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230031AbjHJVSO (ORCPT ); Thu, 10 Aug 2023 17:18:14 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B84E2D56 for ; Thu, 10 Aug 2023 14:18:12 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3fe5695b180so11582015e9.2 for ; Thu, 10 Aug 2023 14:18:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691702290; x=1692307090; 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=/fjyB+/Ev/pPz12OjT6v/5ek1rXsiwDYWApg4s4ExgU=; b=LWMl3Xfm9BviYUdW/fbtQ8XRUiJkFVrqwYnlUXV02/VC6q9kxhY5fbd0xZNnky2iWx tAhBi0yrPLPHDbYmBSQTt774FRxsHhL/lwpBxBnuxGXZdU0ApbpuIFOxe0haAMDazsB4 0W6O49NqDPZ7W2YZv5PiccDN31VWb9ehnBJ4efcqw0CTXoW1ihUM+gtNMNyk2vVJtbFA z3uwO1AAjToGbSxDbwnDuwI7d7pUFuxxRlSO6hHYIEy7G8xvSEsQGkmb5Ep1ecK6bgJM u6Qr6vRiacosUei+4DuwIsDD7YpbGMDUOoyXWNEND1RR+Cev9lwsxH9QUmhfe5NBj2sJ w+5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691702290; x=1692307090; 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=/fjyB+/Ev/pPz12OjT6v/5ek1rXsiwDYWApg4s4ExgU=; b=ktwwYDsBxO7yij5odJS4ziTN5FeeARsBrQ3Jrt8guSOQo9weobEkzNHrkZalqFNREp 9noQUQJChDieG9FSbXzQDuxhh47uGZPxwqu6dcJhHgHYuA73RmxcnmJfIms3xTnALIxQ YmTo7NedEzCDyy5HKHIkxFKGvS7TMFuTuZ7hFwcPOGFz8700VcFb2WafjpUI+DYHxTZ9 TwiBwnCJyqcaoNrNYCIMaHFkJ+IMuiWOh3B99cmA2ypxEeqhh4hozAA0hdO+4wSsXRhi Fds+/RLbP8tPcSTybdRnzFXz+AfnpvOqF281MI8NhxPvC0FYrK1S1i+ET6J8CUve7/87 yW8Q== X-Gm-Message-State: AOJu0Ywt1YALHF5FkkoFgRtchq/p6hvjl1pvT/sq1tRP7K3uJ9lDK0I4 SAZFembzKUHxl4LaojzVF7e9FCDBMG0= X-Google-Smtp-Source: AGHT+IE56mq3dwD0or8LcyIhde9dGfO/Cv2xd8qfwsZvmPnk6mpDncjAZ8SexMHFXIhQn8W+dcFqeQ== X-Received: by 2002:a1c:7703:0:b0:3fe:159d:422b with SMTP id t3-20020a1c7703000000b003fe159d422bmr32115wmi.32.1691702290474; Thu, 10 Aug 2023 14:18:10 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id k1-20020a05600c0b4100b003fa95f328afsm6114059wmr.29.2023.08.10.14.18.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Aug 2023 14:18:10 -0700 (PDT) Message-ID: In-Reply-To: References: Date: Thu, 10 Aug 2023 21:18:00 +0000 Subject: [PATCH v2 10/13] trailer --unfold help: prefer "reformat" over "join" Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Christian Couder , Linus Arver , Linus Arver Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Linus Arver From: Linus Arver The phrase "join whitespace-continued values" requires some additional context. For example, "whitespace" means newlines (not just space characters), and "join" means to join only the multiple lines together for a single trailer (and not that we are joining multiple trailers together). That is, "join" means to convert token: This is a very long value, with spaces and newlines in it. to token: This is a very long value, with spaces and newlines in it. and does not mean to convert token: value1 token: value2 to token: value1 value2. Update the help text to resolve the above ambiguity. While we're add it, update the docs to use similar language as the change in the help text. Signed-off-by: Linus Arver --- Documentation/git-interpret-trailers.txt | 4 ++-- builtin/interpret-trailers.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/git-interpret-trailers.txt b/Documentation/git-interpret-trailers.txt index 2d49445b1c3..62ba2b1232e 100644 --- a/Documentation/git-interpret-trailers.txt +++ b/Documentation/git-interpret-trailers.txt @@ -155,8 +155,8 @@ OPTIONS variables. --unfold:: - Remove any whitespace-continuation in trailers, so that each - trailer appears on a line by itself with its full content. + If a trailer has a value that runs over multiple lines (aka "folded"), + reformat the value into a single line. --parse:: A convenience alias for `--only-trailers --only-input diff --git a/builtin/interpret-trailers.c b/builtin/interpret-trailers.c index f70c5df8d4b..832f86a770a 100644 --- a/builtin/interpret-trailers.c +++ b/builtin/interpret-trailers.c @@ -106,7 +106,7 @@ int cmd_interpret_trailers(int argc, const char **argv, const char *prefix) OPT_BOOL(0, "only-trailers", &opts.only_trailers, N_("output only the trailers")), OPT_BOOL(0, "only-input", &opts.only_input, N_("do not apply trailer.* configuration variables")), - OPT_BOOL(0, "unfold", &opts.unfold, N_("join whitespace-continued values")), + OPT_BOOL(0, "unfold", &opts.unfold, N_("reformat multiline trailer values as single-line values")), OPT_CALLBACK_F(0, "parse", &opts, NULL, N_("alias for --only-trailers --only-input --unfold"), PARSE_OPT_NOARG | PARSE_OPT_NONEG, parse_opt_parse), OPT_BOOL(0, "no-divider", &opts.no_divider, N_("do not treat \"---\" as the end of input")), From patchwork Thu Aug 10 21:18:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Arver X-Patchwork-Id: 13349941 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 4E88EC001B0 for ; Thu, 10 Aug 2023 21:18:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230269AbjHJVS1 (ORCPT ); Thu, 10 Aug 2023 17:18:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229940AbjHJVSP (ORCPT ); Thu, 10 Aug 2023 17:18:15 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0083F2D58 for ; Thu, 10 Aug 2023 14:18:12 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-31956020336so324032f8f.0 for ; Thu, 10 Aug 2023 14:18:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691702291; x=1692307091; 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=JLVdEbBLsQwGTTC+nUkYpJ5KWmtroxiICoNeKqfTQU0=; b=kWr5WakBqS4NHGTgYQZpjs1BR+KEYXyRMGedSKc6KtRRwC9e6JQBKRh//ycxMOgGme PC/wluE05QFwh72xhGdCMN3/XlLCocVVBcl2ndAOoZgMQEl6lrK6kWoOkp/guY3MCTRE bTOvh9GdPV9Qg6tMIR/QQlnpVwTK/WmXoSWKC2fN/g1GQNwEDv2GYvGua3YjPqnhyCGC Wsy33q7AB+mXo7j4i5sYPSsPeVR0w7GT/GaltKbHkiU+4WKcv97m2qWi6dm3TtHdkhDm Gw5qBhN6qmjpUJQgEvbbpJPbQpmSG2lAzqSg0I1SN+UbgTP2PvHd3AsO1mcQ5OQA+Uqi RYTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691702291; x=1692307091; 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=JLVdEbBLsQwGTTC+nUkYpJ5KWmtroxiICoNeKqfTQU0=; b=OlMpc6DN9jkWHAQYCmlfAOsVBebck9KmPnsOy3lucvhHaYwqWcUlVqXiQbfwGvdeFA zoZKbUkedYrXwyqW5aRGyF/8Dk38W9MRcPqQt93dJbZu/YfMaaB106+FxI3jBDfb/77i iAIKp6Nh0r6HpZ6l25gxNnWu3mjSnoeGQIQnYwLExQrjTBE2HzQZtkHj407oun5/Qbd4 gx58CphbX8V4SZHL4VFQxakfSm4Dnrmh2F62NhSP8f90wu8RretC7vB6ONHe5nT9SXXH eYGv1eodea4UmcH8p9a8+izksSAhQeM8TxoI/CxZA6X8e5DqUq5GodLRdWIjWx8FoCeR fDJw== X-Gm-Message-State: AOJu0YwySo3g1Roq6YKe8bZ4dz+QZ6TDWd8QNcsnBY6A5xvp+vhcK8gK MyIVYWcnABbpKrI4RribnCOnV385ohk= X-Google-Smtp-Source: AGHT+IFkxZNPmKyxEDMyQFW20r8YQfKHxho5Tl7jhgnZcQVUi9AGb/ZaeqZOIxg6Hd0jtOcRhLg7Aw== X-Received: by 2002:a5d:6386:0:b0:317:dcdd:3fa1 with SMTP id p6-20020a5d6386000000b00317dcdd3fa1mr2642982wru.34.1691702291134; Thu, 10 Aug 2023 14:18:11 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id b13-20020adfe30d000000b003113ed02080sm3224938wrj.95.2023.08.10.14.18.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Aug 2023 14:18:10 -0700 (PDT) Message-ID: <4db823ac3549c031b61b5a0ec0efd56b70d2a45c.1691702283.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Thu, 10 Aug 2023 21:18:01 +0000 Subject: [PATCH v2 11/13] trailer doc: emphasize the effect of configuration variables Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Christian Couder , Linus Arver , Linus Arver Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Linus Arver From: Linus Arver The sentence does not mention the effect of configuration variables at all, when they are actively used by default (unless --parse is specified) to potentially add new trailers, without the user having to always supply --trailer manually. Signed-off-by: Linus Arver --- Documentation/git-interpret-trailers.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Documentation/git-interpret-trailers.txt b/Documentation/git-interpret-trailers.txt index 62ba2b1232e..a288ff111cb 100644 --- a/Documentation/git-interpret-trailers.txt +++ b/Documentation/git-interpret-trailers.txt @@ -34,9 +34,12 @@ This command reads commit messages from either the If `--parse` is specified, the output consists of the parsed trailers coming from the input, without influencing them with any command line options or configuration variables. -Otherwise, this command applies the arguments passed using the -`--trailer` option, if any, to each input file. The result is emitted on the -standard output. + +Otherwise, this command applies `trailer.*` configuration variables +(which could potentially add new trailers, as well as reposition them), +as well as any command line arguments that can override configuration +variables (such as `--trailer=...` which could also add new trailers), +to each input file. The result is emitted on the standard output. This command can also operate on the output of linkgit:git-format-patch[1], which is more elaborate than a plain commit message. Namely, such output From patchwork Thu Aug 10 21:18:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Arver X-Patchwork-Id: 13349942 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 87989C001B0 for ; Thu, 10 Aug 2023 21:18:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230297AbjHJVSd (ORCPT ); Thu, 10 Aug 2023 17:18:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230093AbjHJVSP (ORCPT ); Thu, 10 Aug 2023 17:18:15 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 677582D5B for ; Thu, 10 Aug 2023 14:18:13 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-3180fd48489so992938f8f.3 for ; Thu, 10 Aug 2023 14:18:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691702292; x=1692307092; 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=TgOZP2UTxk6qof7UeF3G3H6T/61SdqkS7V9hwZKLdag=; b=K0maW9Zc+a7SGOCUs9R790FsgNiKm4tcMOrfI4yEq9egFTtA8JV26Y9lFlqrUF3Gmp /Kh+vhltXbieMA6ApqYDm5S4U1FfYQLNdyvxPjfrYOSn2qqOmuBditNFUqn6KxTGOgXu Pwn2iNq97g44CzJBoyN++DLyFOBCvuRm0+iW9DoeYLP2ftVQIMJiRV+IsVhF2iJS6eZ1 u6RDM/F7XY/Y9dhrUUEN+g9XiiixeNatOOCl+uNIyqMvc6ILBAoN/3uXsejZDOrAd+IR 5CGr8mpXjLFC79krJWbXs+16FGCF61YFI0uHGleBfs2UzjLjNsaGkhFHtW4fKsp3WhKv vNVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691702292; x=1692307092; 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=TgOZP2UTxk6qof7UeF3G3H6T/61SdqkS7V9hwZKLdag=; b=eJEIwRjyWSZjPJW0VeYYn/E6t8Dq8uAiADK3rE7tPtQspj5aDQb8+YdguGzACCdnKB OU9JksNo3xj4AOeP73yXA5oLBraZ1EsN+60PiPhpbVuNyE3vtuaIw03tGMlBTTrTi5g7 8pvC2rH5MwlZzP/dnB7/oocR3kl8yyFzr3K104g8VVsTSlWblXZ7Abu/CnEryaK1V4WT T6+IqLV+mRm5lawEaMAkyk+uOaBqBTUIWbyYVGuyDnlEk8G5rJuZXDBrEkmHyZ3R6k69 Ntnxp3JIjIXg2fBC4O9SxpledJJbBZJk+CPh60EuYJ1JrVkNnpSu7sWP3L/wc10RPWbp gv0A== X-Gm-Message-State: AOJu0Yy4NMctblMVzs2Zd7MwS7CNtyXvxsc5Es98PZQKoOruBtMkMwOS rRYzV8a49E6enew79Dqdvw1HXMJ58D4= X-Google-Smtp-Source: AGHT+IHoaf/o1lHWOBuY54Tc8qjMsX0dTk67+SxKLbHJNspFLAtCU/u1Ar+uf5Rf2b6aue7rhjMIgA== X-Received: by 2002:adf:f30b:0:b0:317:5dca:895 with SMTP id i11-20020adff30b000000b003175dca0895mr2912058wro.71.1691702291762; Thu, 10 Aug 2023 14:18:11 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id d10-20020a056000114a00b00301a351a8d6sm3201474wrx.84.2023.08.10.14.18.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Aug 2023 14:18:11 -0700 (PDT) Message-ID: <66087eaf5bd2abc416628cdcf166b8bd7e9cbf2e.1691702283.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Thu, 10 Aug 2023 21:18:02 +0000 Subject: [PATCH v2 12/13] trailer doc: separator within key suppresses default separator Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Christian Couder , 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 --- Documentation/git-interpret-trailers.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/git-interpret-trailers.txt b/Documentation/git-interpret-trailers.txt index a288ff111cb..25433e1a1ff 100644 --- a/Documentation/git-interpret-trailers.txt +++ b/Documentation/git-interpret-trailers.txt @@ -255,8 +255,8 @@ trailer..key:: but this can be changed using the `trailer.separators` config variable. + -If there is a separator, then the key will be used instead of both the - and the default separator when adding the trailer. +If there is a separator in the key, then it overrides the default +separator when adding the trailer. trailer..where:: This option takes the same values as the 'trailer.where' From patchwork Thu Aug 10 21:18:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Arver X-Patchwork-Id: 13349943 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 086F3C41513 for ; Thu, 10 Aug 2023 21:18:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230317AbjHJVSf (ORCPT ); Thu, 10 Aug 2023 17:18:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230000AbjHJVSQ (ORCPT ); Thu, 10 Aug 2023 17:18:16 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D7E02737 for ; Thu, 10 Aug 2023 14:18:14 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3fe24dd8898so12641735e9.2 for ; Thu, 10 Aug 2023 14:18:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691702293; x=1692307093; 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=YaQKnhilHgzeldzskwOlhP2/oK6pbLd0hrP+iKwL+fk=; b=scmTNr6nNoWXM5mf5drP9vg1cCl1F2ID2egWfPtu2Fc8IVh9ncB01N54p088PXM607 ZWwFtPaaw+rewCfkg1dkPF1gBlr3oOGCvBQHDD6L9QuySyqrJ17ovaGUkCNM+LkIOEdr vlGzTdAlrDsFxbbSoLh2RxRRqgAyGQ/f2y0Iq1cxqI5uWSIIWgMdEkn9H8k+nwunyeKn Q/LmZiryA4eEZYaEH1uZfObIKUqcq2Gcf1CeXPYBrU8JgOyD3sMKAJ7alggI/3NIJghi fmsD0ScIGQmpqpXXZXa+pZXZ6HiZnxU3osTpA8Ey5EYzn3MpL2dC2Ym37sq7LtvzyKMb 2bLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691702293; x=1692307093; 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=YaQKnhilHgzeldzskwOlhP2/oK6pbLd0hrP+iKwL+fk=; b=g8x/2dfBkMPUwuIKtyY8vvNRmH8LmpgIK/0/2VRWbE0oyg28oR9rvKc88oUp3aX4SC EHjx6tq3EjdCUYLcMFFVe7IP3sKldgwsWWlv7WwuEOgkkd2zOg7udjcXd7Wfe0Cn2Fga Gsd1ZUdl63ejDrQPBiPGKD/QGskfO4k5EaIm97nfCIA77zWeB42q0WLBuErpWZXtO+CG A2JIdS5YL5oZ2g7VvjHBCBR2HlKF6mPI91GjSDiDmKvs2t5ARtCY5FqdfN/Cah7KMUdb l4J8cIKt2m6PnzByN4hbIUeQj03P8kSYOKyKo/ho4TqHUA+HbXtTqcaRm31cQXm0yW5s V7uA== X-Gm-Message-State: AOJu0YxRLA2LeoO2UStUQMGOoN2XFvwQ4JSguaoGeTwHUyFapx+WQSM8 XdbYCEO/YzCWXzv+1+v0OXSGtI+CkVs= X-Google-Smtp-Source: AGHT+IH2JrgGkEBQvKOr8w6AaWxRkCZBhFCvyXfEtGNTtHC5HFsNX+Hnn233JiNRmyiYuaYKEYoMDg== X-Received: by 2002:a05:600c:234b:b0:3fc:521:8492 with SMTP id 11-20020a05600c234b00b003fc05218492mr64319wmq.5.1691702292383; Thu, 10 Aug 2023 14:18:12 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id v1-20020a05600c214100b003fe215e4492sm3221888wml.4.2023.08.10.14.18.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Aug 2023 14:18:12 -0700 (PDT) Message-ID: <7b66cf29d295ae2420c9f5d1469e1f02d490e559.1691702283.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Thu, 10 Aug 2023 21:18:03 +0000 Subject: [PATCH v2 13/13] trailer doc: is a or , not both Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Christian Couder , Linus Arver , Linus Arver Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Linus Arver From: Linus Arver The `--trailer` option takes a "=" argument, for example --trailer "Acked-by=Bob" And in this exampple it is understood that "Acked-by" is the . However, the user can use a shorter "ack" string by defining configuration like git config trailer.ack.key "Acked-by" However, in the docs we define the above configuration as trailer..key so the can mean either the longer "Acked-by" or the shorter "ack". Separate the two meanings of into and , and update the configuration syntax to say "trailer..key". Signed-off-by: Linus Arver --- Documentation/git-interpret-trailers.txt | 136 +++++++++++++---------- 1 file changed, 76 insertions(+), 60 deletions(-) diff --git a/Documentation/git-interpret-trailers.txt b/Documentation/git-interpret-trailers.txt index 25433e1a1ff..418265f044d 100644 --- a/Documentation/git-interpret-trailers.txt +++ b/Documentation/git-interpret-trailers.txt @@ -9,7 +9,7 @@ SYNOPSIS -------- [verse] 'git interpret-trailers' [--in-place] [--trim-empty] - [(--trailer [(=|:)])...] + [(--trailer (|)[(=|:)])...] [--parse] [...] DESCRIPTION @@ -53,22 +53,32 @@ are applied to each input and the way any existing trailer in the input is changed. They also make it possible to automatically add some trailers. -By default, a '=' or ':' argument given +By default, a '=' or ':' argument given using `--trailer` will be appended after the existing trailers only if -the last trailer has a different (, ) pair (or if there -is no existing trailer). The and parts will be trimmed +the last trailer has a different (, ) pair (or if there +is no existing trailer). The and parts will be trimmed to remove starting and trailing whitespace, and the resulting trimmed - and will appear in the output like this: + and will appear in the output like this: ------------------------------------------------ -token: value +key: value ------------------------------------------------ -This means that the trimmed and will be separated by -`': '` (one colon followed by one space). For convenience, the can be a -shortened string key (e.g., "sign") instead of the full string which should -appear before the separator on the output (e.g., "Signed-off-by"). This can be -configured using the 'trailer..key' configuration variable. +This means that the trimmed and will be separated by +`': '` (one colon followed by one space). + +For convenience, a can be configured to make using `--trailer` +shorter to type on the command line. This can be configured using the +'trailer..key' configuration variable. The must be a prefix +of the full string, although case sensitivity does not matter. For +example, if you have + +------------------------------------------------ +trailer.sign.key "Signed-off-by: " +------------------------------------------------ + +in your configuration, you only need to specify `--trailer="sign: foo"` +on the command line instead of `--trailer="Signed-off-by: foo"`. By default the new trailer will appear at the end of all the existing trailers. If there is no existing trailer, the new trailer will appear @@ -85,14 +95,14 @@ non-whitespace lines before a line that starts with '---' (followed by a space or the end of the line). When reading trailers, there can be no whitespace before or inside the -, but any number of regular space and tab characters are allowed -between the and the separator. There can be whitespaces before, +, but any number of regular space and tab characters are allowed +between the and the separator. There can be whitespaces before, inside or after the . The may be split over multiple lines with each subsequent line starting with at least one whitespace, like the "folding" in RFC 822. Example: ------------------------------------------------ -token: This is a very long value, with spaces and +key: This is a very long value, with spaces and newlines in it. ------------------------------------------------ @@ -109,8 +119,8 @@ OPTIONS the whole trailer will be removed from the output. This applies to existing trailers as well as new trailers. ---trailer [(=|:)]:: - Specify a (, ) pair that should be applied as a +--trailer [(=|:)]:: + Specify a (, ) pair that should be applied as a trailer to the inputs. See the description of this command. @@ -118,7 +128,7 @@ OPTIONS --no-where:: Specify where all new trailers will be added. A setting provided with '--where' overrides the `trailer.where` and any - applicable `trailer..where` configuration variables + applicable `trailer..where` configuration variables 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 @@ -128,9 +138,9 @@ OPTIONS --if-exists :: --no-if-exists:: Specify what action will be performed when there is already at - least one trailer with the same in the input. A setting + least one trailer with the same in the input. A setting provided with '--if-exists' overrides the `trailer.ifExists` and any - applicable `trailer..ifExists` configuration variables + applicable `trailer..ifExists` configuration variables and applies to all '--trailer' options until the next occurrence of '--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 @@ -140,9 +150,9 @@ OPTIONS --if-missing :: --no-if-missing:: Specify what action will be performed when there is no other - trailer with the same in the input. A setting + trailer with the same in the input. A setting provided with '--if-missing' overrides the `trailer.ifMissing` and any - applicable `trailer..ifMissing` configuration variables + applicable `trailer..ifMissing` configuration variables and applies to all '--trailer' options until the next occurrence of '--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 @@ -187,11 +197,11 @@ used when another separator is not specified in the config for this trailer. + For example, if the value for this option is "%=$", then only lines -using the format '' with containing '%', '=' +using the format '' with containing '%', '=' or '$' and then spaces will be considered trailers. And '%' will be the default separator used, so by default trailers will appear like: -'% ' (one percent sign and one space will appear between -the token and the value). +'% ' (one percent sign and one space will appear between +the key and the value). trailer.where:: This option tells where a new trailer will be added. @@ -205,41 +215,41 @@ If it is `start`, then each new trailer will appear at the start, instead of the end, of the existing trailers. + If it is `after`, then each new trailer will appear just after the -last trailer with the same . +last trailer with the same . + If it is `before`, then each new trailer will appear just before the -first trailer with the same . +first trailer with the same . trailer.ifexists:: This option makes it possible to choose what action will be performed when there is already at least one trailer with the - same in the input. + same in the input. + The valid values for this option are: `addIfDifferentNeighbor` (this is the default), `addIfDifferent`, `add`, `replace` or `doNothing`. + With `addIfDifferentNeighbor`, a new trailer will be added only if no -trailer with the same (, ) pair is above or below the line +trailer with the same (, ) pair is above or below the line where the new trailer will be added. + With `addIfDifferent`, a new trailer will be added only if no trailer -with the same (, ) pair is already in the input. +with the same (, ) pair is already in the input. + With `add`, a new trailer will be added, even if some trailers with -the same (, ) pair are already in the input. +the same (, ) pair are already in the input. + -With `replace`, an existing trailer with the same will be +With `replace`, an existing trailer with the same will be deleted and the new trailer will be added. The deleted trailer will be -the closest one (with the same ) to the place where the new one +the closest one (with the same ) to the place where the new one will be added. + With `doNothing`, nothing will be done; that is no new trailer will be -added if there is already one with the same in the input. +added if there is already one with the same in the input. trailer.ifmissing:: This option makes it possible to choose what action will be performed when there is not yet any trailer with the same - in the input. + in the input. + The valid values for this option are: `add` (this is the default) and `doNothing`. @@ -248,34 +258,40 @@ With `add`, a new trailer will be added. + With `doNothing`, nothing will be done. -trailer..key:: - This `key` will be used instead of in the trailer. At - the end of this key, a separator can appear and then some - space characters. By default the only valid separator is ':', - but this can be changed using the `trailer.separators` config - variable. +trailer..key:: + Defines a for the . The must be a + prefix (case does not matter) of the . For example, in `git + config trailer.ack.key "Acked-by"` the "Acked-by" is the and + the "ack" is the . This configuration allows the shorter + `--trailer "ack:..."` invocation on the command line using the "ack" + instead of the longer `--trailer "Acked-by:..."`. ++ +At the end of the , a separator can appear and then some +space characters. By default the only valid separator is ':', +but this can be changed using the `trailer.separators` config +variable. + If there is a separator in the key, then it overrides the default separator when adding the trailer. -trailer..where:: +trailer..where:: This option takes the same values as the 'trailer.where' configuration variable and it overrides what is specified by - that option for trailers with the specified . + that option for trailers with the specified . -trailer..ifexists:: +trailer..ifexists:: This option takes the same values as the 'trailer.ifexists' configuration variable and it overrides what is specified by - that option for trailers with the specified . + that option for trailers with the specified . -trailer..ifmissing:: +trailer..ifmissing:: This option takes the same values as the 'trailer.ifmissing' configuration variable and it overrides what is specified by - that option for trailers with the specified . + that option for trailers with the specified . -trailer..command:: - Deprecated in favor of 'trailer..cmd'. - This option behaves in the same way as 'trailer..cmd', except +trailer..command:: + Deprecated in favor of 'trailer..cmd'. + This option behaves in the same way as 'trailer..cmd', except that it doesn't pass anything as argument to the specified command. Instead the first occurrence of substring $ARG is replaced by the that would be passed as argument. @@ -283,29 +299,29 @@ trailer..command:: Note that $ARG in the user's command is only replaced once and that the original way of replacing $ARG is not safe. + -When both 'trailer..cmd' and 'trailer..command' are given -for the same , 'trailer..cmd' is used and -'trailer..command' is ignored. +When both 'trailer..cmd' and 'trailer..command' are given +for the same , 'trailer..cmd' is used and +'trailer..command' is ignored. -trailer..cmd:: +trailer..cmd:: This option can be used to specify a shell command that will be called - once to automatically add a trailer with the specified , and then - called each time a '--trailer =' argument is specified to + once to automatically add a trailer with the specified , and then + called each time a '--trailer =' argument is specified to modify the of the trailer that this option would produce. + When the specified command is first called to add a trailer -with the specified , the behavior is as if a special -'--trailer =' argument was added at the beginning +with the specified , the behavior is as if a special +'--trailer =' argument was added at the beginning of the "git interpret-trailers" command, where is taken to be the standard output of the command with any leading and trailing whitespace trimmed off. + -If some '--trailer =' arguments are also passed +If some '--trailer =' arguments are also passed on the command line, the command is called again once for each -of these arguments with the same . And the part +of these arguments with the same . And the part of these arguments, if any, will be passed to the command as its first argument. This way the command can produce a computed -from the passed in the '--trailer =' argument. +from the passed in the '--trailer =' argument. EXAMPLES --------