From patchwork Thu Sep 7 22:19: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: 13376885 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 82AC7EC875F for ; Thu, 7 Sep 2023 22:20:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241274AbjIGWUY (ORCPT ); Thu, 7 Sep 2023 18:20:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237664AbjIGWUV (ORCPT ); Thu, 7 Sep 2023 18:20:21 -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 5239C1BC7 for ; Thu, 7 Sep 2023 15:20:14 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-401ec23be82so16502305e9.0 for ; Thu, 07 Sep 2023 15:20:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694125212; x=1694730012; darn=vger.kernel.org; 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=onBPZ/ABRIXevAgE6XQaR/WcbNWZvJHsskejk0VaSP7UCgQ13fp4FwV/T6Vejl+3+H KnXA1Ku5nJT/irhocH/+UQo50Cwg8UGQRUp0EKt3HB/DNoD+6nCGbXLgDoY1igGNaMcw 9Zzc6lRWWq6mlViqdSOszgNLIMhf9Xzd7ajpluZzg2NpUmsr7vHRM0DnH+/wVGXWyOHH v0jUy6epA+WNqHha3mtS3Eu4k4RfmjpHQBURonVGatcJODUSnm/dnCIkNTupFFFA+7jc xdm98I08S5VWAOXSTxOHpmhxnqTLA6aunux9yxzqRXXFqn+KHYTrLiJNsWSsM3Wd8Wu9 hZcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694125212; x=1694730012; 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=XuquFx1Lpkt+WwnvrPBSzHHiZWjeYoRpUWVWypS6/xOBWj8yFnAyC6QUnf/1eyhcPH Z73nzpOX13etKU2aVTiCW5bhOoieWEqFiu1F4J28JIH2mKbI2IwTfdnZRvL+yjjfBxqL JzF4fUKxfEsJDXOaATh/0xeACHdVTT2+Sx492xsDUx7TlQptDwF+2b+/xZIA3OdHMQ5U gR2pazLftl4N4qWrFg6CnQEfHpDUNpLSZaqXH1fR+j7LeKTVFvXSSk1rN1YL8tbEGVY9 25uaX7zIaEdo8wj0eAQd+ChrCM3UPzaxvPy8iVVcXgBcP+RcpbPwdjEQc1f6DoGaB9IQ 1lYA== X-Gm-Message-State: AOJu0YwGUGWXvVzBEId60Gq5rGk+kXj1VtwVF5it/WqSM8IUmwZxq46s gJh/4H0km4Vv3sF+Soe4BsCgfn/bmI8= X-Google-Smtp-Source: AGHT+IGCUJCM5F79qFutGu+ZcSbNyiJ1X8hsQN40zVu/cZ2lFPerX7o5etA6WGJfZojdLf6QFdszEQ== X-Received: by 2002:a7b:cd97:0:b0:3f6:9634:c8d6 with SMTP id y23-20020a7bcd97000000b003f69634c8d6mr735359wmj.18.1694125212307; Thu, 07 Sep 2023 15:20:12 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id v18-20020a05600c215200b00401c9228bf7sm376671wml.18.2023.09.07.15.20.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 15:20:11 -0700 (PDT) Message-ID: <1623dd000ddef40ffb6ca44cf7ce66d1c42b0d13.1694125210.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Thu, 07 Sep 2023 22:19:57 +0000 Subject: [PATCH v3 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 Sep 7 22:19: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: 13376882 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 60285EC875F for ; Thu, 7 Sep 2023 22:20:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237501AbjIGWUU (ORCPT ); Thu, 7 Sep 2023 18:20:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234773AbjIGWUS (ORCPT ); Thu, 7 Sep 2023 18:20:18 -0400 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1806E1BC6 for ; Thu, 7 Sep 2023 15:20:15 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-401bbfc05fcso16259535e9.3 for ; Thu, 07 Sep 2023 15:20:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694125213; x=1694730013; darn=vger.kernel.org; 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=HRQ5n78JbO6+3uZwgM2iWgCvTDQ+5+h7NIkQ/UEbB6u/hl0HAfV5er4j94lnB0YpGt ZISsyLir4nrCO7gf54vL4eSilQ1cXlA9nR4wm8OBMWOHg8BVZq5XrwyxgOSdzO0ql3vD dZCowuHYRv6ho/+2KCHqRgMyYbhgti+6RvFII5hNzZynMNJMlWkycFltPY+t3k02f2Qe AtCExQfcFT1cyQzZ6huf7G8rIYnMLXHdx6HIC72i8pPAk6Pln5R2Vtf8eB+HJzeiz6ce vtkVAICMks8biV0nmpvypFX+7r5B1SWvdfauii9HBu7oif76/XeaFx3p+Z/COiSmNXCi Qrjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694125213; x=1694730013; 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=CCCzXdS0NWmTSI9P95ZU5CfmWMKcEmZ7YO2mj1BugK9mbtsSe8pu7HpABxXgreS6fU GEenKtGpKPNivL3Pe971tZvA2eoo80pzNfMSL4w1BgYnrPtiF/uqsyrhZLwNxl2YVVYD Lz3NNYG7xYyvEjfILDsF1GUQAiA5GjzQNYG2Dr2Pl+g1aLFQ6ui89RRfghu4kiDuQMOd jt2AKoL6X3AyfhXhtfEVP6IpRAATbZ+4QD9AH68LDSSS2TPk6sxqpMyz12I36p0Qua/G 3FtHDdfqSUmQKBbXTEZeuMe1YrO1StHqpBOi9eY7sxbSf4zKu3Wx94T8Emlmpx0NjgTP XGfQ== X-Gm-Message-State: AOJu0YxdxfMVPtYiJdxOCtzB6SM/0aQOiMmfTFtfy1QZEO63QaH92N5t NouvzlLFe7aeAmr+Z3+u0+jSMbRzcFs= X-Google-Smtp-Source: AGHT+IGRfSJnRUqmM6F4iP7xG7ToPoUynEDMmKSzebxNQ+O6UMdj0g43qIvnomjGcuSzmpO1hIb63w== X-Received: by 2002:adf:de02:0:b0:317:727f:3bc7 with SMTP id b2-20020adfde02000000b00317727f3bc7mr462198wrm.17.1694125213312; Thu, 07 Sep 2023 15:20:13 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id a10-20020a5d508a000000b00319756d5b80sm451225wrt.29.2023.09.07.15.20.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 15:20:12 -0700 (PDT) Message-ID: In-Reply-To: References: Date: Thu, 07 Sep 2023 22:19:58 +0000 Subject: [PATCH v3 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 Sep 7 22:19: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: 13376883 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 79D08CCFA0A for ; Thu, 7 Sep 2023 22:20:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237730AbjIGWUW (ORCPT ); Thu, 7 Sep 2023 18:20:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234773AbjIGWUV (ORCPT ); Thu, 7 Sep 2023 18:20:21 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F3E31BC6 for ; Thu, 7 Sep 2023 15:20:16 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-31aec0a1a8bso936571f8f.0 for ; Thu, 07 Sep 2023 15:20:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694125214; x=1694730014; darn=vger.kernel.org; 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=HRakSchlvdd5N49C4oOW89lHSnD3h8le/PsCetDbuJ2l3zJ7+mAJYf2UjjFsg1kQFI j6rAb4A1DC+DHF+BLW/8C5SD5cdvGJSus+MoaXxdmQKlNkDbTSusdvnYOT4UgUyOJ3Do 9TNFZ8RXOFp7Pqep2M2mK5QyzmAxxkU9oyGiRdmdNa2dBNElhKhm80Bsdis9IC86JM1g waSfBGHgX8htCdQeuHtcu0UuibAyg50Q9mx2b3+R1y/6zkbs6cfkIZynaMTxKS4oic+H 01lraAFZeW1qfOkosLweoWci0+hLYb2yk7q+W0i/C+gP3wLZsLO6ruNAyDaLkicy8s4z xgZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694125214; x=1694730014; 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=b1zaAAM4QocYk19SZIcr8aa920lh5z64ryY+DNPwbPQ8gHiGXdgm0Um0HeCb6LOGxp 5F6WPCl2yN7zYq7Y8dZarsBJisz4UTDKtmlOrG8weqdJJrL1ewjBtD7hR09XQ6r95YNH Ubm5R3j1KKRh5yoj8d6PP+0u31JShPRWhUk/i2LbhPJqh+Gf4YUGEy9lRONwVsWybzH/ g9SG2Th4BFdHwGyOc5lU8VUwOjMi/GSPoGCcyTQZ+2eHvcpXLTcDlI9d+5AnqtBnACCE Lh+bvzfXUbbcAuAF9CkhFkN14CPXFvGdlUYx2uXuZsWhzON+7mle87sdSz5CXkGgafLb WmFg== X-Gm-Message-State: AOJu0YyeDTC/PjYQ+ZM59INyhPEx7KAc5RLEXkSC2nQkKwgtORjRR9Ib gOV9m6dmwShWpWTuv/MN0khaMxxXiJ4= X-Google-Smtp-Source: AGHT+IHK+ZJumksFso5zp2TnCRDDXzbX2APOu1OR14EvFiANYSf+3vqYpEPTzNE54igOPBAl+hfTxA== X-Received: by 2002:a5d:4241:0:b0:317:5efa:c46a with SMTP id s1-20020a5d4241000000b003175efac46amr467261wrr.27.1694125214055; Thu, 07 Sep 2023 15:20:14 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id e15-20020a5d65cf000000b0030647449730sm433063wrw.74.2023.09.07.15.20.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 15:20:13 -0700 (PDT) Message-ID: <4b5c458ef436c2d208e6d6d0a1f99c65e9a11125.1694125210.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Thu, 07 Sep 2023 22:19:59 +0000 Subject: [PATCH v3 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 Sep 7 22:20: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: 13376884 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 5544EEC875E for ; Thu, 7 Sep 2023 22:20:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241303AbjIGWUZ (ORCPT ); Thu, 7 Sep 2023 18:20:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238225AbjIGWUW (ORCPT ); Thu, 7 Sep 2023 18:20:22 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CA3A1BC8 for ; Thu, 7 Sep 2023 15:20:16 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-31f615afa52so1486685f8f.3 for ; Thu, 07 Sep 2023 15:20:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694125214; x=1694730014; darn=vger.kernel.org; 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=lSizjL+Rw5Zy/IOBY2uAZPlDs72al+qAAxFnIaPeMCKY8M2oxYYmlSgu2suliLYAIv hCmV6BP1imI+NWkJqwgVW6tnnE/tvg4CTE7Q2WX2mD0GWSUUZYYqeybzShAKKXhY1Fwo jHYgSEiroBmv2snIDM4J1x5nD6HQwNzIjdx1ZNS5huO6cPhVpDIF0PViT5VWsrKdbJOT TMdBXfR774dLjPsPQ3V/BVs95zWJWnEYN1ZcypLWYxcPP1d9f2YNfdRMP9+m+rYo+AEb 76IYNsVU0AxkVVJGV78pI1xqaZ7aeHrSfYZNXnEriEuQ9XZYTnic4ld+TeqaP9Ni8p5L QZ4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694125214; x=1694730014; 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=lWxshDKNVQ9pzKeRYbnrIPvEvJmUgwa1Zm9gwFbozZJTWSsh71hG2TDJL9TzoqOYG6 fYmXWx3cxzb/rovkhYTC7wnYy/aiqcDWs/Hr0b1rGghOW1WrCgSxE4Tp+WfxKOlvWkUr ZZmUhertPgiqeyKnYz9t7QGLAnWLuXi2Vb2YrdhGNw6ZoAjJnaT284iyVofomTWlKGEu Vr5PxBSQEVLLuAYHMIKr3dTLG8VVtO0Ns1kG8zMGS1SMOTXdefNPyo9AXIblNBr7W6z6 VwiFYskyNopoVBqKju+ZgxSa4hGXypJENYF+NamH6luHqieFh1fXuneIVLw94UwGOpUt 11EA== X-Gm-Message-State: AOJu0YxT007j9LOMILQOT5bwMzFMJieslIPHCyXS6hofDM4cqw7LBrRN RtuZ7Bi+KndhwDldxneB7Wtx5Ey6l94= X-Google-Smtp-Source: AGHT+IHluwoHb3zM8tZysla9SPvruVYtJyhaQydRb2O83oaa/3zvZyoBYkTMAdtFhoCj1U7snnyAPA== X-Received: by 2002:a5d:4d4b:0:b0:31a:d2b2:f29d with SMTP id a11-20020a5d4d4b000000b0031ad2b2f29dmr550763wru.8.1694125214608; Thu, 07 Sep 2023 15:20:14 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id q10-20020adfea0a000000b0031ae2a7adb5sm429485wrm.85.2023.09.07.15.20.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 15:20:14 -0700 (PDT) Message-ID: <0df12c5c2dda5799074f0dcea696df0a63ca1145.1694125210.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Thu, 07 Sep 2023 22:20:00 +0000 Subject: [PATCH v3 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 Sep 7 22:20: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: 13376887 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 F01ABEC875E for ; Thu, 7 Sep 2023 22:20:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241347AbjIGWU1 (ORCPT ); Thu, 7 Sep 2023 18:20:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239664AbjIGWUW (ORCPT ); Thu, 7 Sep 2023 18:20:22 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13C231BC9 for ; Thu, 7 Sep 2023 15:20:17 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-401c90ed2ecso15935035e9.0 for ; Thu, 07 Sep 2023 15:20:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694125215; x=1694730015; darn=vger.kernel.org; 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=AGjxM5Ti4R0w2BnIGM8haEkYDhI/5myzcnq477aVSxcqiDV+Xc6gN22gsvI4qVmCwh GFfksiugAaIlCg+NrFsWBuwnVHzCSMfty4GKfnIe4Oq8vG+XUYro9szQoMMK0M2t/kwn UIKiA0T13IJh81fQWt02AIgZr7iT2v8aqEPbMI6k5AYFnL61TAsiskucVy3IhvsR+vV2 GsgDuZk+cMNquLERNqBBtybz1Sw3CZ4pVPVYqpaRX5lsbHn4W9lL8Md9FIkKWnH2qKpH ozKoSd9K1xMr2feMtaPP0x54h/BonK0rPMSX7O9I419JnTRu7+/SWuZkyTw6sCny8TDu bNdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694125215; x=1694730015; 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=cd5k2FHRunPK0HI5POuMUl1Au6eXJ6TrUVRgb09DT3y9kzdyTdh4tu+t9quamTUYDO hk0Hia7w3qzsZI7cTf2QV8RigJVwxYEIovSnNZjnpU2l3/BuT2YuzD9qIoacZyaMz/FB ueuB7X6O2h9ZCdJV2OE1G+NREASAXMHKZZMtfirZgFRlKQjYcb7u9SppluUls4ayKXB9 1TiUgcOp3sC7l/qnQ/B6gE4RHIFEShX1fx0yBtnTFK+Ik0u9hDDF5afpz9NTyhfqsVaB Fr1U7EuTM+yjdEPaGIFPtwF0IVCpnvx2arUuq4fr/jty/X3dyfv+GTbD0SaYp77JFo/F 9USg== X-Gm-Message-State: AOJu0YyXQwvK9y51DaZQ+JH7iMVpZuEY+Byqs2Qxw+CBf4fmgUCMS+Xo pbqa38dITHg/VyGND/i0ovB1VlJFMZw= X-Google-Smtp-Source: AGHT+IGZn3gLFbgjsUF/W+2jire0U+ZOEub5pKoHC/+ld9Baz6It3IiQj85CKYH+muyZrgLp4wPUpQ== X-Received: by 2002:a7b:c7cb:0:b0:3fb:a506:5656 with SMTP id z11-20020a7bc7cb000000b003fba5065656mr648309wmk.32.1694125215359; Thu, 07 Sep 2023 15:20:15 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id b13-20020a05600c11cd00b003fefcbe7fa8sm374424wmi.28.2023.09.07.15.20.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 15:20:14 -0700 (PDT) Message-ID: <040766861e21afe5f686299560677e429be11844.1694125210.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Thu, 07 Sep 2023 22:20:01 +0000 Subject: [PATCH v3 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 Sep 7 22:20: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: 13376886 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 DFED3EB8FB1 for ; Thu, 7 Sep 2023 22:20:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241332AbjIGWU1 (ORCPT ); Thu, 7 Sep 2023 18:20:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238954AbjIGWUW (ORCPT ); Thu, 7 Sep 2023 18:20:22 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1F371BD5 for ; Thu, 7 Sep 2023 15:20:17 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-401bbfc05fcso16260075e9.3 for ; Thu, 07 Sep 2023 15:20:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694125216; x=1694730016; darn=vger.kernel.org; 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=Jv5xs57B+xhzzuXmyl/hOlDwdhyb8Cg6DD/0Vyy+1bkDdT/uFn6R9NHOb9T98cIybi 61JM7WwbDWqkT0NiUgvCPF66XFvyA7zMIful61lW5xc0z/4jhwlEnad/cfXAcgzF+yM1 0mk/JO2VNNJZtW4RrDaMFoy92wBpMTf3Mb1MCF2tLrRYJXG4jl2rLVif8ud1BqIponB0 fHLxNKkQHrt5ex1FoXq20tyPS50JaK3lMMJrR4zEWNR8l+8w8F+402y7eA6AS//qpg0q gOW2VO9Sbu6/IAejKcpN87rK8jMPmpf75kRMRYygogpkHILqJs6SQyTHHDYUreBSnNQy QKDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694125216; x=1694730016; 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=xEJm/CgVvKUfTLWMNmwyw197a0O8zIR8Mc0RLZ58x3IwHdrBfuZOnQWIdQIK9HUjV3 U3huraaLkvZ5aFRKCqraZzB/TaB77HzPAy0KOdklOjRVfjBH9HHAMZD4+lnyNdksY3O+ 5ch2UjPAJYuQ/9q+vljo/aXi/gnckNZoLaSjdqcnJoMxwe2fcb4l1lg1DbqJHImX/9Tm bON3ZYzijRTmt0Z2ixSEkc+QyGfeh/u3hP6JIAwtbBShLRUB2pZN0Xm+jnUKOEsvnPa/ ZisyC9ueCnIE4N8uakGrZU9jKxa+nacLBoFL7VQfmtdLfz64jCUI60XB6lX9B+K7CL32 iSHA== X-Gm-Message-State: AOJu0Yy4K6OL7+Dp2USqEsLb4o3mKsBqZcuWObSx3Eq0YCtLkClw+dBu fPyL6ZwVmn9aiEixoh0HpOBWg8e4YbY= X-Google-Smtp-Source: AGHT+IECtbXzo3zsX93qwvh5MGe2f0gqYf6f5t0ieMbcqk6w3fLXyFeCXbTrnuct6sBPDHaALFTpFw== X-Received: by 2002:a1c:7719:0:b0:400:2dc5:2006 with SMTP id t25-20020a1c7719000000b004002dc52006mr649947wmi.36.1694125215961; Thu, 07 Sep 2023 15:20:15 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id v8-20020a05600c214800b003fee65091fdsm3625121wml.40.2023.09.07.15.20.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 15:20:15 -0700 (PDT) Message-ID: <3e58b6f5ea264a2c42ffbd008405b46626e0f864.1694125210.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Thu, 07 Sep 2023 22:20:02 +0000 Subject: [PATCH v3 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 Sep 7 22:20: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: 13376891 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 08486EC875E for ; Thu, 7 Sep 2023 22:20:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241650AbjIGWUh (ORCPT ); Thu, 7 Sep 2023 18:20:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240775AbjIGWUW (ORCPT ); Thu, 7 Sep 2023 18:20:22 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0B651BDC for ; Thu, 7 Sep 2023 15:20:18 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-31c3726cc45so1432268f8f.0 for ; Thu, 07 Sep 2023 15:20:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694125217; x=1694730017; darn=vger.kernel.org; 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=ZbgL9qhDRSF2Fe/A6I+4Vzv8Ur6NONdol7A4D4XziDek0AkYLnrrTiiaQYgrU6nbHK 8JOjwupwFt8Y5xKLyKYDYhFp7tf2wS3+qcS+6h+s8/bqPb+zflWL+HOWB5pO/DiPyDxt h87dTwtRvBFJl46TxhINeiJHfTwqdcm5ZqKSqyt51JGWGk6s442BDxQSD/9K++u+06gC osi40SnNIIS2/AEr4QHTp16JjTii/bUi6U7ce6CDp0F9o/iHjWpJOgALdfje52WqD0FJ /hw2u80JhImUeMDYVj8eA6TMJxnmFy6QOPsjFQICIm94HKb/s1Xqjh3Tjc4fqdtCA+zn /YKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694125217; x=1694730017; 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=MWSZb/4btoY5aFcFi6QswiBJkD+SI725mJfTKLvbii5GxEBM/JhKYZqfXSmR3k9cAc Na/DSyf8/gidKmm77y8NSndRXL1bm44T5cjTTald4V+U+qP8L7gl4Q9W5p008liJ1Y/y JnotW92lC5+wd9hqG/K/EFZBNGZLwi9KvQ41R/ouidmonOeWwRLWZ0RN+MGUbTnXw0of ZgVi5eDlw6elzPcmtFXK5PE+IL7C0MgymmDHJXCtVZO97RreADGpQ1N8P52rTeX2Bz8R syn8+34ULkBKhVuyfubOsd5ORXCaLuELyFyDwkgNpP66cYZ3vNbjFEJQ/zkvTPbpbP5s uCOg== X-Gm-Message-State: AOJu0Yy9Rg0ZHeEZR8I/26d1dG86/FwKFUkXNYzTi2TWRqZ71xFxRq8z ZqJP903CXRbRlcN5ypvvdzCffSHjJYo= X-Google-Smtp-Source: AGHT+IGGBTd9t37Dvl7h2ZTtTj7ScZkC/+eBaaupCqi1pnl/IO6xXCSa4Gfx1wI3RZpeMLOKCeDRsQ== X-Received: by 2002:a5d:4e47:0:b0:313:f45f:74a1 with SMTP id r7-20020a5d4e47000000b00313f45f74a1mr490144wrt.51.1694125216619; Thu, 07 Sep 2023 15:20:16 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id a12-20020a5d456c000000b00317afc7949csm438853wrc.50.2023.09.07.15.20.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 15:20:16 -0700 (PDT) Message-ID: In-Reply-To: References: Date: Thu, 07 Sep 2023 22:20:03 +0000 Subject: [PATCH v3 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 Sep 7 22:20:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Arver X-Patchwork-Id: 13376888 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 DB0D5EC875F for ; Thu, 7 Sep 2023 22:20:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241575AbjIGWUd (ORCPT ); Thu, 7 Sep 2023 18:20:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240244AbjIGWUX (ORCPT ); Thu, 7 Sep 2023 18:20:23 -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 D4D961BDD for ; Thu, 7 Sep 2023 15:20:18 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-401bdff4cb4so15631605e9.3 for ; Thu, 07 Sep 2023 15:20:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694125217; x=1694730017; darn=vger.kernel.org; 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=onHAW9K6y5rwJmuRdr0q72RlZjMFZNl6lRPJn5C3GCHTZr9dk+2XxkH2kqxcK8l45d d7+TnJ7h9ukLFBDkFsIqxlfaMTQx8lQc3EG+wIYrXYf0Sv+EEuoQkdh6wK68TvFJZaTd nUBFdz33SsYNTlSzc7z5BR+sNJfKkuqkHWGIr5MKnZh55wgqjcTBCG621BFjrbs4sQ4+ N30hUmdZ6JdvCmSt3sQ+KJnmWDXeAq+aawNOGm0MaVF47aXn1NS2+CnRf2X8t7wcQG+j 7JndkwyKr6UImgCzITEgK+GyacWT0ygkosjrGEWEzQy+ubmsIB8S8k/0rAeSkiO98ZBQ gBhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694125217; x=1694730017; 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=i595MdZrfQGtnrppz6e+HiBUxWkPBr2zhS0HWG6Lfl6wq9u7fxF26RB1RuHtZ+J/8x neoif+C0tZ4QMyA61aECgkRlWJXIvztj/VxtnWW6AjZ0ZRhQVCi6ReiDEFWtkWVVkc1Y CzXGuf0DUQQXLGLydDsWt5E+aomtvMg6NoI4oi7JkWhfcPS5IciJKgImyew7SfhP308g n3x9Nk0k5ofb5Zqtsd34hQuT8aYaLdwMRk6YPNxuB090Ev/SJZN0ieYaAZqaTULtMiUQ JeBJGVL29HmDQygz1slx6WNQ/nDVfPQoyt9B47z0JL0luy4Z5BvRqtpv2vBodY2EM9cA ps7Q== X-Gm-Message-State: AOJu0YxEgIt325tKqE2jB6IrJBUhy+rfE05MbBQwQYuDgUVddsDvdFfT jJkuk98kPvpFp5L0mAbJvbi1p+VV4TQ= X-Google-Smtp-Source: AGHT+IHpya4cMJ7gzLDUOvxImCWw2IrH7hlIRcu4+rl2HkrHECUMEe34lw7P4WQYaW0YwDp16zYOaQ== X-Received: by 2002:a5d:4c4f:0:b0:317:69d2:35c2 with SMTP id n15-20020a5d4c4f000000b0031769d235c2mr531422wrt.2.1694125217124; Thu, 07 Sep 2023 15:20:17 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id d10-20020a5d538a000000b0031c7682607asm424494wrv.111.2023.09.07.15.20.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 15:20:16 -0700 (PDT) Message-ID: <5cfff52da8ff586248ba394248e7b086ed792549.1694125210.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Thu, 07 Sep 2023 22:20:04 +0000 Subject: [PATCH v3 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 Sep 7 22:20:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Arver X-Patchwork-Id: 13376890 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 9BF1EEC875F for ; Thu, 7 Sep 2023 22:20:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241619AbjIGWUf (ORCPT ); Thu, 7 Sep 2023 18:20:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234773AbjIGWUX (ORCPT ); Thu, 7 Sep 2023 18:20:23 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9171E1BC7 for ; Thu, 7 Sep 2023 15:20:19 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-307d58b3efbso1294078f8f.0 for ; Thu, 07 Sep 2023 15:20:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694125218; x=1694730018; darn=vger.kernel.org; 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=NpycQfuRrkNHpn6jmXQw0WSte39JWGMIxBEJc/ZstMHtW1tUtBSInK2E4d7kGnrtP4 ebw9BhSPvkK7DXytb558oExTTT4n3yrXCInw6/RuRFgsnyjY2dqkY3xl6yRFi2YYFDfq 8ct7+2+F9fo/x49Pf+V56Iqej2RO3MY2f6t21Ac1lfhIpgYbAra14CXwGdbbbJ1shIqx RkBHBiwgJ4fiKc/TArxg+xQtAPDwkBdgU7KxnN+6QyRRpdHIxZkcZsZdi2xLCLFuFICE S6vAS82PZnCPQhmOkMj/iBv5e+wrnbWxivPrsf8dj4e59C0pBeIgc8CtMsszuvQLc7pL Dj5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694125218; x=1694730018; 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=sfUIdw3W1cWitEMe91jg5SQqQpRb4a5BjjlxRtwTMKTyMoBXf5q9pAq42l/XQ//oAX I62XGVL56WM+q7bu5lH6d31N9FcmWuCI5sQkZXU1eBq7H7YQyrrznZwryfF8R4FT0H8g Yiqbj4sk5sCB3eHxZqoy279SQwehnmnhJyJxGgF2guysm7ofOcHHHz1x1bJY8ppse9zk c2/DJ/g9XcRCqwN041U3kgA11zwT8Lcu7VAyWoYYgJdW3QrdYtWLw87nNoeFRtmp71Xb uIQSxBWs4hIpSfPPPhirw3L9iUbsBVdq+HoIyUc1ql3WUfBZ67ja2wg/O8rN0g+yDo8B xYrA== X-Gm-Message-State: AOJu0Yw8WWlziUuRFvPoWt3zrRhbZ83ybKZkC1iAZG45JW4kM7vYWcO6 FRLlnk72KoBhhNAmpgP2HOWRvu1ywT8= X-Google-Smtp-Source: AGHT+IEASm5o7gskwbPLwrdWP4DnPniwIEq5K5UrLqGJgKMu+ho/Y5s+CzIjiqwy75p+lLHBgcaQsQ== X-Received: by 2002:a5d:654d:0:b0:319:8dcf:5c00 with SMTP id z13-20020a5d654d000000b003198dcf5c00mr439524wrv.69.1694125217796; Thu, 07 Sep 2023 15:20:17 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id l6-20020adff486000000b003180155493esm433076wro.67.2023.09.07.15.20.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 15:20:17 -0700 (PDT) Message-ID: In-Reply-To: References: Date: Thu, 07 Sep 2023 22:20:05 +0000 Subject: [PATCH v3 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 Sep 7 22:20:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Arver X-Patchwork-Id: 13376889 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 934C8EC875E for ; Thu, 7 Sep 2023 22:20:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241446AbjIGWUe (ORCPT ); Thu, 7 Sep 2023 18:20:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241205AbjIGWUY (ORCPT ); Thu, 7 Sep 2023 18:20:24 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 568631BC9 for ; Thu, 7 Sep 2023 15:20:20 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-401d24f1f27so16389455e9.1 for ; Thu, 07 Sep 2023 15:20:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694125218; x=1694730018; darn=vger.kernel.org; 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=mtrYAvVYgXj3SU4qTrKyPmk2LqhOpej+JNuCTCsxENnvx0UDqgE6SbhlaRn/Mu5qkn MHOjCLRVhdlsg3oNCGBJJ94RSSJUGAz4ZqlDTDHdb7pqZ1DVlRFUnceuhjrLZuV1owNP xnBynsZOvSzGrZrc7yb997W5afGbuiWjKAPE0T8F7sI56jvXG70xSZWV0WZj+YmgxEyd 4kESlHdYOn/MY3hUhffHnEtyGPnwPXT4rxhHsaNviRbWZtAnQDDmXRse4pXNQotTPzWe EhYeWjflqubSPgZPKRQPWbrCNDstD1mO5c+B6K5h9O5r13JcFO+y/FVO1nh3zKlfSMhD vTqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694125218; x=1694730018; 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=wnE2PqAmIrEcAYzY0RDXiSKaeqIcs/lJbyuCOks23bUzgBZicN5PPYnhZmGGu7NnPl cOgsklg/4XsNUFhatXBbX8EyAkdoMbf4nqOF6UujufAyU05i2rg0mi6lh8kVU8iyl/ER r1EpLcxll5IDgczl/7M/OaSZ8gvE3u8FSeRc7d4v9zxk6BjHmhEs47R0UlBxV/k9apGk AO9fAsoPtQZm1Cd5uhBeCswxVKrgByJkwwy00VyUQsB3G/qK/fxB5R/Fw6sBKxTxZhJ/ 5yT1/F24xSN6FOtfCiOn2LZRaYsm8gidzFrrdfDmowufCppmj8ZZ1RD1K3nMnKNGG3rf Y9aQ== X-Gm-Message-State: AOJu0YyjbLtaSthlF6jAeT0DmC0uok4+rwgw7Qa1G5JNacy+JY0t1cBb C1YnQwbWhcec3AHi4GuxO9R/hvTYK2E= X-Google-Smtp-Source: AGHT+IFODvbGy+5mHgTbauKYbDeVhkaGa74fEcBeL4+SqDQx0fxAibKbqr+JvaFyadU0EIGk1Vj1VQ== X-Received: by 2002:a1c:4b0b:0:b0:402:ee59:ff49 with SMTP id y11-20020a1c4b0b000000b00402ee59ff49mr761363wma.9.1694125218454; Thu, 07 Sep 2023 15:20:18 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id 3-20020a05600c020300b003fc04d13242sm3611848wmi.0.2023.09.07.15.20.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 15:20:18 -0700 (PDT) Message-ID: In-Reply-To: References: Date: Thu, 07 Sep 2023 22:20:06 +0000 Subject: [PATCH v3 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 Sep 7 22:20:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Arver X-Patchwork-Id: 13376893 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 88D9EEC875F for ; Thu, 7 Sep 2023 22:20:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232067AbjIGWUk (ORCPT ); Thu, 7 Sep 2023 18:20:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241454AbjIGWUc (ORCPT ); Thu, 7 Sep 2023 18:20:32 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 530B71BE2 for ; Thu, 7 Sep 2023 15:20:21 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-401da71b7c5so16322925e9.2 for ; Thu, 07 Sep 2023 15:20:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694125219; x=1694730019; darn=vger.kernel.org; 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=CDpq+4eLSwaUIKah0itUHKSQmeQpvPyYoglNtprdk6jSQ1qnh5QZQ6DUVKFR3Fxyxn CWNly4IK3L2PWObdDk+f4wm5r46UWrIBpMQ7gLdNIFozyJVXt2HjeJ+Tq5RtdJP3LKxJ 0hKTCVvXEZUqZQU/b9lUtzq9A4KRbO3In0zgpBd4Q6quC4l1JIEloryBJvKEM9PXEDSG AYWsU0POQ4ESr3DQgWXS3QIYr6457WaIAB2oid7Ib12ztjZ0XyfRjid/QfHqmmeHHSB+ N4xTqIVntXkwEzxSPUo6kQHVuqWzSW8IprmtJe8neiau6rIsyQGwmn4+yKako1KgEsPt ew4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694125219; x=1694730019; 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=CYioMVdA0fRAJL2uSRlgvfYFEjPuov4P1vMlCOaTKWuuIAS0hghfn1lpYQHYfpj2YZ 95VRSoxVXSFNhsgp4m3iDg/T2Qq6M1AoExNusBB/MX8hNnmRC4YoeR37jZ0p77t3wWXm mnHio2bKMruvDh76GPEh39VK7gfj6zwH7T/ML23msnRqQYAyaYgSwrYmVx9U+TvoPEkU JJtbDcRx8wDyMdZJkmsWTSQMqXyAXTfZKp/vr6ADH50tD21d3TizvV22txbwDIWovNKY bj4Z+qMSfLjNZD7Nhj2UNetEs05OAIzkbQWBk+LyLsAivmLOYE9rJh4yLWskH02YeQPk qQ3A== X-Gm-Message-State: AOJu0Yzt9cFUKFSL5z1B0QWu4TfXKZgND8uuY2vZzSTrvd5Ahq/vAmBL ICBxiJ77B4s9aj9CaODlf3kvjDOjhCw= X-Google-Smtp-Source: AGHT+IEtNeracSmhpfW3xDF7x0ashKItT8HnPAH7TX8U94bdLcxGDcw7m3q/0OCIbQ6VtXtH012j7A== X-Received: by 2002:a5d:54d0:0:b0:319:8a5a:ab5e with SMTP id x16-20020a5d54d0000000b003198a5aab5emr495696wrv.38.1694125219340; Thu, 07 Sep 2023 15:20:19 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id g3-20020a5d6983000000b003197c7d08ddsm433233wru.71.2023.09.07.15.20.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 15:20:18 -0700 (PDT) Message-ID: <4db823ac3549c031b61b5a0ec0efd56b70d2a45c.1694125210.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Thu, 07 Sep 2023 22:20:07 +0000 Subject: [PATCH v3 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 Sep 7 22:20:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Arver X-Patchwork-Id: 13376892 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 8801FEC875E for ; Thu, 7 Sep 2023 22:20:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241652AbjIGWUi (ORCPT ); Thu, 7 Sep 2023 18:20:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241407AbjIGWUc (ORCPT ); Thu, 7 Sep 2023 18:20:32 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F14991BEB for ; Thu, 7 Sep 2023 15:20:21 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4018af103bcso9354105e9.1 for ; Thu, 07 Sep 2023 15:20:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694125220; x=1694730020; darn=vger.kernel.org; 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=sAP0hbv1LzKQ+V94+h1azGAPqU14SK4rl2+ap4V/6nCGyEaULccuvgMDLbTvzwWQw4 o5eZiGUaG+7C818hUrH1ZO042t7XbSBQ/Sc8ZewqDyZuDEdGtgJ1augbAQWEsf7ZJLS1 JJDq9sclTWrsKzuhQTsKlOMBBTN0jFA2shodPthWIlclIgGyVodEv2kge5MG2ZLaKSEf 0WFEqv2cDDC1lKHzEujVNerzn8BlnO3Nf/1rYdgv79N5xiVuP1RMEgvIH3S/MeQ23i1d aD4+bDS42k7VF0j8GmH1b5g5pv8eg7oGwk6707Mrdy3ZCpiDP6euLGj+T9OM7WMa4S+X +16g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694125220; x=1694730020; 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=J7+XWhsgP2bwiXWC6v255qkig+p1f94kylV62cSTwqi/Z7ain9LVQuAgOC5gHiWQbg EZ0M/SSafqtRajEqTqnLwlLMv0OHVeIyye5PE/g+qYCXAO72gvsuYrYo78eoeckcygbE xoW0twPSEGxCOjl0QHeHNCMCjejOOo/aVDSwXxVPIJqYuR5EWlsN9Agqs1diTCeJPcaT b71PjW42pQSUVz2hyNXhKoMRc1H5wECBu+HDjDkt3ZnCMMU3NXhTajRovqwDaQmDW7Ss tQtGt+sbjhUTpEa91/MozEmXmYWWjaaQnqRnwL6DqOsHjbJR6J7bPISo/GDcKvY5oMnr rXJQ== X-Gm-Message-State: AOJu0YykbSxp8qfV24d3kXZUwiHb62gtB52I7TiPixlQdj43JF0UjyNo NX0rVcmW3JS7KWC7t4xSemqUS5OC7WM= X-Google-Smtp-Source: AGHT+IHwu/Xwj7MTXhOZPeOnZYxrNS6LO6JVu17dmHuak9IlNO6Om+linCggqMhwoAya9cXRji0v2Q== X-Received: by 2002:a05:600c:6013:b0:401:c7ec:b930 with SMTP id az19-20020a05600c601300b00401c7ecb930mr3162991wmb.10.1694125220281; Thu, 07 Sep 2023 15:20:20 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id v3-20020a5d6103000000b00316eb7770b8sm448047wrt.5.2023.09.07.15.20.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 15:20:19 -0700 (PDT) Message-ID: <66087eaf5bd2abc416628cdcf166b8bd7e9cbf2e.1694125210.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Thu, 07 Sep 2023 22:20:08 +0000 Subject: [PATCH v3 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 Sep 7 22:20:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Arver X-Patchwork-Id: 13376894 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 DE9DFEC875E for ; Thu, 7 Sep 2023 22:20:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241366AbjIGWUm (ORCPT ); Thu, 7 Sep 2023 18:20:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238877AbjIGWUc (ORCPT ); Thu, 7 Sep 2023 18:20:32 -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 EAF2A1BF3 for ; Thu, 7 Sep 2023 15:20:22 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-31c65820134so1293132f8f.1 for ; Thu, 07 Sep 2023 15:20:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694125221; x=1694730021; darn=vger.kernel.org; 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=fY09o0eIjQAOX4i11ObRwSPzY+XFP7GgwXI2YvGZ6Jg=; b=pozJR5Ine5Lbd8yl5objvS/D+id5rfEoL4x0E8iVKUjEauAmQQ3KcC50qYXN0kzRTx hTJfztMvu1f5ezLXQU19julK7CXOKKNTbUhuRhhR2IEBjwu83lEFIDRa8GU3ojVPHmFI M5rSx5ik3a06oBSQVS41Ddy9E5HVx8qAjrWi0U9HVXwQnHlB0u5xo04HZisk+oPuCmJF ks9o+hF5d3Pg8PVZq7aEKCUjCgBzhNCtPshw7RlCDklEp58NF2q5cDE4MYing61WLaKM +Cb6f+buJXs1kwxYzP/VyU7kajRMAiYsUKGUIjOAqfuAnYJt7Kl7+wQBI8yte2MIu/zI k2UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694125221; x=1694730021; 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=fY09o0eIjQAOX4i11ObRwSPzY+XFP7GgwXI2YvGZ6Jg=; b=GOoLBb7LhwCCWc9XR76+BKRmnj/+9x5HDtje23ih1tIi/IcHhxqQzn/pX2fRBo+SCs /ZjUzU1axeejWK2LOzpXstTYgvkaxSYqOYAcLgpkDnm2DwGj6Zw5FezvtlDoe/T0EFMt dtn4oL63T68dO2C2vxvI4IvSHHWUokBDHzli04w0Btk/B6nPP5pkcWQ0Dc9c4Pll07T7 99xtUGjLhcdC4XDqjObVQWbdvp++rfWEF93RVEPec2IFhD7H6RQ8ShdVYjByusnkGRn8 A9sM/i6ktLo4tFMEBgSsbaFF0H5zjtBQp15Bn2SnWkPrdz1ZtuCevBXLdS6S2R5mR0aQ guQA== X-Gm-Message-State: AOJu0Yy82sZ+zeO6xmYvD2B1k9CUZB5BiR2hQOxbyGyaIiVc4+n04tFY T2PRxPLllxTjYFgig3SRdYEdTmK0oOs= X-Google-Smtp-Source: AGHT+IHOwANvMGNV7qX0BhQTooBc4kNolddZb0+BAFBh9EVDhbuubagGMhPiqXbn6J5l8ZMoLjIkig== X-Received: by 2002:adf:e6cc:0:b0:31a:d6cb:7f9d with SMTP id y12-20020adfe6cc000000b0031ad6cb7f9dmr453886wrm.24.1694125220902; Thu, 07 Sep 2023 15:20:20 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id r3-20020a5d4983000000b00317ab75748bsm433268wrq.49.2023.09.07.15.20.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 15:20:20 -0700 (PDT) Message-ID: <0b9525db5a0787fdc71834abad9151aa03acc497.1694125210.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Thu, 07 Sep 2023 22:20:09 +0000 Subject: [PATCH v3 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 +++++++++++++---------- builtin/interpret-trailers.c | 2 +- 2 files changed, 77 insertions(+), 61 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 -------- diff --git a/builtin/interpret-trailers.c b/builtin/interpret-trailers.c index 832f86a770a..d2d78fd961f 100644 --- a/builtin/interpret-trailers.c +++ b/builtin/interpret-trailers.c @@ -14,7 +14,7 @@ static const char * const git_interpret_trailers_usage[] = { N_("git interpret-trailers [--in-place] [--trim-empty]\n" - " [(--trailer [(=|:)])...]\n" + " [(--trailer (|)[(=|:)])...]\n" " [--parse] [...]"), NULL };