From patchwork Mon May 1 20:02:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kristoffer Haugsbakk X-Patchwork-Id: 13228261 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 EDA80C77B73 for ; Mon, 1 May 2023 20:05:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233005AbjEAUFg (ORCPT ); Mon, 1 May 2023 16:05:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232987AbjEAUFf (ORCPT ); Mon, 1 May 2023 16:05:35 -0400 Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B56D26B6 for ; Mon, 1 May 2023 13:05:34 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 7C1E632009A0; Mon, 1 May 2023 16:05:33 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 01 May 2023 16:05:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=khaugsbakk.name; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to; s=fm2; t=1682971533; x=1683057933; bh=MZf/MG3lv1cPp1JWbPT3Wnumx JACiJ+LvMo0ocy68jo=; b=eDVdwdzsOJxnghoR4qjZun9IIoJDCEEgB7nHO2gOP W15CLiL8pzf60n1V15hsyt9YyK2J2nk6LmV+EfQpMPjuunBBX737yb8NHPFqhCUb Wc6MLyrZ7SgJa7DWxYEeWwY081LybGvpvs+e9wwtDQkAFkJorFo8pA7oZB3XgVZl Jz5SSdrANh+QKTfeTt66aX2VPRWC+JjVgb2lk2T+JNAYQCtP5AyvHdAINOzJ/77H Kjz125K/M/c2xKmtP/3cpcukoLgy7pbzbS6qFgameeX8JNRtCrYjG829yq4oMD1c CT+gpqGgozcVxAPRy9cB+nUWygbQ0cdcXnbsl+Bp2XcGg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1682971533; x=1683057933; bh=MZf/MG3lv1cPp1JWbPT3WnumxJACiJ+LvMo 0ocy68jo=; b=J0el/Hd5lcwdnTnSn0eLyvzxenB3zz+CYEaxjDhbfdiBxaOY0HP tXMvZO490RJGKU+SuvZqiNSWB8MQ2f0IUmI6aTHjxAY7AvVk8vPs6AZbYcwgCIMa l/l14RdLnlvbBZqiEXbeAi9vUEtHS1E4BfxL8212UaMufDeQlF1QSjLEBOOne2Ow ypFy07HLGjEC16LfXOTQ821DucTFFFo8t58Jzb9nHd9rBnJNQm8lZ14tAz9d+0pf YouCUP+37yNYEmuAcQdpksTqfopKBKw+CootVIo0aNBve9F/c2XKHlYKfsjB+bve Af3GyO1+yn17v3Z94y+1gcovgCH6jX5qJPg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfedvgedgudeghecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvvefufffkofgjfhggtgfgse htkeertdertdejnecuhfhrohhmpefmrhhishhtohhffhgvrhcujfgruhhgshgsrghkkhcu oegtohguvgeskhhhrghughhssggrkhhkrdhnrghmvgeqnecuggftrfgrthhtvghrnhepve fgleevieekgeejieekueevhfelieduvdelgeefkeejtdekvedttefgffevtedtnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheptghouggvsehkhh gruhhgshgsrghkkhdrnhgrmhgv X-ME-Proxy: Feedback-ID: i2671468f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 1 May 2023 16:05:32 -0400 (EDT) From: Kristoffer Haugsbakk To: git@vger.kernel.org Cc: Kristoffer Haugsbakk , Junio C Hamano Subject: [PATCH v4 1/4] =?utf-8?q?doc=3A_interpret-trailers=3A_don=E2=80=99t?= =?utf-8?q?_use_heredoc_in_examples?= Date: Mon, 1 May 2023 22:02:38 +0200 Message-Id: <149dcf964cb0ff056b8bb454602b07b316725400.1682970213.git.code@khaugsbakk.name> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org This file contains four instances of trailing spaces from its inception in commit [1]. These spaces might be intentional, since a user would be prompted with `> ` in an interactive session. On the one hand, this is a whitespace error according to `git diff --check`; on the other hand, the raw documentation—it makes no difference in the rendered output—is just staying faithful to the simulation of the interactive prompt. Let’s get rid of these whitespace errors and also make the examples more friendly to cut-and-paste by replacing the heredocs with files which are shown with cat(1). [1]: dfd66ddf5a (Documentation: add documentation for 'git interpret-trailers', 2014-10-13) Suggested-by: Junio C Hamano Signed-off-by: Kristoffer Haugsbakk --- Documentation/git-interpret-trailers.txt | 74 +++++++++++------------- 1 file changed, 35 insertions(+), 39 deletions(-) diff --git a/Documentation/git-interpret-trailers.txt b/Documentation/git-interpret-trailers.txt index 22ff3a603e..4f4eb7a7fc 100644 --- a/Documentation/git-interpret-trailers.txt +++ b/Documentation/git-interpret-trailers.txt @@ -326,13 +326,12 @@ $ git config trailer.sign.key "Signed-off-by: " $ git config trailer.sign.ifmissing add $ git config trailer.sign.ifexists doNothing $ git config trailer.sign.command 'echo "$(git config user.name) <$(git config user.email)>"' -$ git interpret-trailers < EOF +$ git interpret-trailers -$ git interpret-trailers < Signed-off-by: Alice -> EOF +$ cat msg.txt +Signed-off-by: Alice +$ git interpret-trailers ------------ @@ -357,15 +356,14 @@ Fix #42 $ cat ~/bin/glog-find-author #!/bin/sh test -n "$1" && git log --author="$1" --pretty="%an <%ae>" -1 || true +$ cat msg.txt +subject + +message $ git config trailer.help.key "Helped-by: " $ git config trailer.help.ifExists "addIfDifferentNeighbor" $ git config trailer.help.cmd "~/bin/glog-find-author" -$ git interpret-trailers --trailer="help:Junio" --trailer="help:Couder" < subject -> -> message -> -> EOF +$ git interpret-trailers --trailer="help:Junio" --trailer="help:Couder" $ cat ~/bin/glog-grep #!/bin/sh test -n "$1" && git log --grep "$1" --pretty=reference -1 || true +$ cat msg.txt +subject + +message $ git config trailer.ref.key "Reference-to: " $ git config trailer.ref.ifExists "replace" $ git config trailer.ref.cmd "~/bin/glog-grep" -$ git interpret-trailers --trailer="ref:Add copyright notices." < subject -> -> message -> -> EOF +$ git interpret-trailers --trailer="ref:Add copyright notices." subject -> -> message -> -> see: HEAD~2 -> EOF +$ git interpret-trailers commit_template.txt < ***subject*** -> -> ***message*** -> -> Fixes: Z -> Cc: Z -> Reviewed-by: Z -> Signed-off-by: Z -> EOF +$ cat temp.txt +***subject*** + +***message*** + +Fixes: Z +Cc: Z +Reviewed-by: Z +Signed-off-by: Z +$ sed -e 's/ Z$/ /' temp.txt > commit_template.txt $ git config commit.template commit_template.txt -$ cat >.git/hooks/commit-msg < #!/bin/sh -> git interpret-trailers --trim-empty --trailer "git-version: \$(git describe)" "\$1" > "\$1.new" -> mv "\$1.new" "\$1" -> EOF +$ cat .git/hooks/commit-msg +#!/bin/sh +git interpret-trailers --trim-empty --trailer "git-version: \$(git describe)" "\$1" > "\$1.new" +mv "\$1.new" "\$1" $ chmod +x .git/hooks/commit-msg ------------