From patchwork Sun Mar 17 18:36:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Martin_=C3=85gren?= X-Patchwork-Id: 10856515 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0034614DE for ; Sun, 17 Mar 2019 18:36:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0D1C29011 for ; Sun, 17 Mar 2019 18:36:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D407E291D3; Sun, 17 Mar 2019 18:36:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 38DCC29011 for ; Sun, 17 Mar 2019 18:36:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726717AbfCQSg4 (ORCPT ); Sun, 17 Mar 2019 14:36:56 -0400 Received: from mail-lj1-f174.google.com ([209.85.208.174]:37182 "EHLO mail-lj1-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726333AbfCQSgz (ORCPT ); Sun, 17 Mar 2019 14:36:55 -0400 Received: by mail-lj1-f174.google.com with SMTP id a17so12053570ljd.4 for ; Sun, 17 Mar 2019 11:36:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WR2ae7C12OGlWJ7eMj3WsScuNbqV2IiIc/0tqfOECQ8=; b=WToPZSIrLKxJDvovAASPuWZVCvyVh2tE6whGfGpqHNbqvSN1nJ235L0+CabeN95s9M iopLaoU0Oau0ooG4UL0/OU/eHWVkzlYbJFoBhhhTS/9NqOJVH3I60f8664gFyuwSpG+O lHKskkw7xPuV4qGm2osG7t7WzN7DSrcAT4E6cCyDVFYhOIS7Vowsg6cre0Rifq/yjaUJ Se0W2u3Qh9H6yrFh58edtg6KFO7uKlcb7s978iSdDnjVw682HQER+EsLNqNug8UAWdH0 gh2n6iXcMIRHK5jnODVotpvnRfV3ry5tQlsP6iswcz9V5ADNoCRCpZDR7USim/J0KtD5 f3Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WR2ae7C12OGlWJ7eMj3WsScuNbqV2IiIc/0tqfOECQ8=; b=Rlwy9R/jrWHhscnH6wCbndQA95Esm1bt9iUMzJ6s+Nvrm2//c9/CnRXsYuwaAIr11v J+hhmo17jk9ZBtw+gmXYS6xuNxoJEkHIJ13nlnCyKfyV2xeiQCuWi1iTXR4x7ku9gtRB Em4Xku83+e2lJKBqi7vjpPNJJXCFuV094/OGJmrFtHAf4PDzpaW2QOCsrTTRrspPdeHf PTvKiGOpV2O7oynAu+7RndJ3xtqdr+VE8R/KbYjjxfmIZf//2K64O+nj+AKx6jiPN6xV 44Ys7FOFeQ1OO3zks9Ku+jjrMkzXTX5U70pvphOPXJ85WVPnkYf+6C5Xr837wWPkIv94 b+Kg== X-Gm-Message-State: APjAAAWR0V6DSXUrTPMjLHrFFxSuIZhuuQ38UkJ0GkP9UtQV7EuS9XUI OsyrxnJOCf2NT34WgDzO+q1jIdmf X-Google-Smtp-Source: APXvYqxTX1Bwhd6OVb/M238Rp+aOAKccuZYlv+w2c3oBM2Th6xRckzj422dP7RcydFqu8wck4Wghhw== X-Received: by 2002:a2e:1508:: with SMTP id s8mr8392600ljd.8.1552847813195; Sun, 17 Mar 2019 11:36:53 -0700 (PDT) Received: from localhost.localdomain (31-211-229-121.customers.ownit.se. [31.211.229.121]) by smtp.gmail.com with ESMTPSA id e2sm1589484lfc.75.2019.03.17.11.36.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Mar 2019 11:36:51 -0700 (PDT) From: =?utf-8?q?Martin_=C3=85gren?= To: git@vger.kernel.org Cc: Jeff King Subject: [PATCH 1/4] Doc: auto-detect changed build flags Date: Sun, 17 Mar 2019 19:36:00 +0100 Message-Id: X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If you build the documentation switching between different options, e.g., to build with both Asciidoc and Asciidoctor, you'll probably find yourself running `make -C Documentation clean` either too often (wasting time) or too rarely (getting mixed builds). Track the flags we're using in the documentation build, similar to how the main Makefile tracks CFLAGS and prefix flags. Track ASCIIDOC_COMMON directly rather than its individual components -- that should make it harder to forget to update the tracking if/when we modify the build commands. Signed-off-by: Martin Ågren --- Documentation/.gitignore | 1 + Documentation/Makefile | 23 +++++++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Documentation/.gitignore b/Documentation/.gitignore index 3ef54e0adb..bf2bf271b5 100644 --- a/Documentation/.gitignore +++ b/Documentation/.gitignore @@ -13,3 +13,4 @@ mergetools-*.txt manpage-base-url.xsl SubmittingPatches.txt tmp-doc-diff/ +GIT-ASCIIDOCFLAGS diff --git a/Documentation/Makefile b/Documentation/Makefile index 26a2342bea..b534623012 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -331,6 +331,15 @@ mergetools-list.made: ../git-mergetool--lib.sh $(wildcard ../mergetools/*) show_tool_names can_merge "* " || :' >mergetools-merge.txt && \ date >$@ +TRACK_ASCIIDOCFLAGS = $(subst ','\'',$(ASCIIDOC_COMMON):$(ASCIIDOC_HTML):$(ASCIIDOC_DOCBOOK)) + +GIT-ASCIIDOCFLAGS: FORCE + @FLAGS='$(TRACK_ASCIIDOCFLAGS)'; \ + if test x"$$FLAGS" != x"`cat GIT-ASCIIDOCFLAGS 2>/dev/null`" ; then \ + echo >&2 " * new asciidoc flags"; \ + echo "$$FLAGS" >GIT-ASCIIDOCFLAGS; \ + fi + clean: $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7 $(RM) *.texi *.texi+ *.texi++ git.info gitman.info @@ -340,13 +349,14 @@ clean: $(RM) SubmittingPatches.txt $(RM) $(cmds_txt) $(mergetools_txt) *.made $(RM) manpage-base-url.xsl + $(RM) GIT-ASCIIDOCFLAGS -$(MAN_HTML): %.html : %.txt asciidoc.conf +$(MAN_HTML): %.html : %.txt asciidoc.conf GIT-ASCIIDOCFLAGS $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \ $(TXT_TO_HTML) -d manpage -o $@+ $< && \ mv $@+ $@ -$(OBSOLETE_HTML): %.html : %.txto asciidoc.conf +$(OBSOLETE_HTML): %.html : %.txto asciidoc.conf GIT-ASCIIDOCFLAGS $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \ $(TXT_TO_HTML) -o $@+ $< && \ mv $@+ $@ @@ -358,12 +368,12 @@ manpage-base-url.xsl: manpage-base-url.xsl.in $(QUIET_XMLTO)$(RM) $@ && \ $(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $< -%.xml : %.txt asciidoc.conf +%.xml : %.txt asciidoc.conf GIT-ASCIIDOCFLAGS $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \ $(TXT_TO_XML) -d manpage -o $@+ $< && \ mv $@+ $@ -user-manual.xml: user-manual.txt user-manual.conf +user-manual.xml: user-manual.txt user-manual.conf GIT-ASCIIDOCFLAGS $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \ $(TXT_TO_XML) -d book -o $@+ $< && \ mv $@+ $@ @@ -373,7 +383,8 @@ technical/api-index.txt: technical/api-index-skel.txt \ $(QUIET_GEN)cd technical && '$(SHELL_PATH_SQ)' ./api-index.sh technical/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../ -$(patsubst %,%.html,$(API_DOCS) technical/api-index $(TECH_DOCS)): %.html : %.txt asciidoc.conf +$(patsubst %,%.html,$(API_DOCS) technical/api-index $(TECH_DOCS)): %.html : %.txt \ + asciidoc.conf GIT-ASCIIDOCFLAGS $(QUIET_ASCIIDOC)$(TXT_TO_HTML) $*.txt SubmittingPatches.txt: SubmittingPatches @@ -430,7 +441,7 @@ $(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt WEBDOC_DEST = /pub/software/scm/git/docs howto/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../ -$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt +$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt GIT-ASCIIDOCFLAGS $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \ sed -e '1,/^$$/d' $< | \ $(TXT_TO_HTML) - >$@+ && \ From patchwork Sun Mar 17 18:36:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Martin_=C3=85gren?= X-Patchwork-Id: 10856517 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5544214DE for ; Sun, 17 Mar 2019 18:37:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 416EB29011 for ; Sun, 17 Mar 2019 18:37:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 31F76291D3; Sun, 17 Mar 2019 18:37:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C14C129011 for ; Sun, 17 Mar 2019 18:37:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726748AbfCQSg7 (ORCPT ); Sun, 17 Mar 2019 14:36:59 -0400 Received: from mail-lf1-f53.google.com ([209.85.167.53]:37120 "EHLO mail-lf1-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726333AbfCQSg7 (ORCPT ); Sun, 17 Mar 2019 14:36:59 -0400 Received: by mail-lf1-f53.google.com with SMTP id u2so10069207lfd.4 for ; Sun, 17 Mar 2019 11:36:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/VHZ6okNGVPzedtErZrbF5RtEXmBVcbXIZYqJXNlcGE=; b=Ef+qxrAp3k3hJkdRNLj4RteGevLYLW232qMMSr5R4U0PpfWOHPT6oMe3wJqZJoyorZ wp65LKVsWxOS9t/PgPWk0MpcNsiU/gy8NQDbUn9KHJpugr3+3sokXlBm+hVK7dajXGpv 8q7Z+Ea9U5SwHjY2zrySs3y2d8YXrmcHPsfs7+0GrU3ZrZCoCyEzIwPWTvjcNgEyZTr0 tPDK0dvhpZonQWQ/8zVf5A8Pm+UNGQjlQslbWDDQRMPNLH1ewxHhikt+pSs3fCEMzWpy h4fn+duk2H9Tyzl/RG3waJODsRBv6lKqsEF0FmQidQIpVzeqNLUBXtIiuGcI/MdG1jZ+ Z3kQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/VHZ6okNGVPzedtErZrbF5RtEXmBVcbXIZYqJXNlcGE=; b=tc3tpJbqE39TPq9rSg+wU9JHixB6Lj0NX+KOMUXXDpfRxyb7BlMYGMfCMvwEKvchRF 602y+efqvQhg0MvJ0PSaUrknl5Bk81vLvdrtSa2ZZEWnE6L0sHv/rnFafvo0eq8qo2Tt MkVnnl4skNmfJxgcmpgYDeDCX4LSL59k09/I8WQARD8Qg2jjhA0gXQWrnKVjGR/YedOF BpESbXLbWsWo/PhjyBJR4miUGW1dycHhB2JTET7/6bqx2I3jN+DKQwCJy5B/OCtasMFq 03LaiIySVGkK8iGcBFB6LdmlrYug9Lz0xg72zRJ6eE+2uYwbGSwiOsoFBXUFh/fEog/H vtMg== X-Gm-Message-State: APjAAAXoK/sDgUJN0rp4cIdKFQP71gAeoaBLyEFBoU/LH5IbuQ0mWWQ/ GLcnk9mBJZg3wqbf/MvZzNAXIqgc X-Google-Smtp-Source: APXvYqzBKuOEHPMw3o8Cj6KTO1bodQzuJ4c7onaxWaOeGzdwp75Ry+OgfOFDk0WZ19gelc+UPhVVmA== X-Received: by 2002:a19:6e0b:: with SMTP id j11mr7432606lfc.124.1552847817191; Sun, 17 Mar 2019 11:36:57 -0700 (PDT) Received: from localhost.localdomain (31-211-229-121.customers.ownit.se. [31.211.229.121]) by smtp.gmail.com with ESMTPSA id e2sm1589484lfc.75.2019.03.17.11.36.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Mar 2019 11:36:56 -0700 (PDT) From: =?utf-8?q?Martin_=C3=85gren?= To: git@vger.kernel.org Cc: Jeff King Subject: [PATCH 2/4] doc-diff: let `render_tree()` take an explicit directory name Date: Sun, 17 Mar 2019 19:36:01 +0100 Message-Id: <249372bed148417dcc77423f53e7f5f7d7a67757.1552838239.git.martin.agren@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In `render_tree()`, `$1` is documented to be the commit-ish/oid and we use it as that with `git checkout`, but we mostly use it to form the name of various directories. To separate these concerns, and because we are about to construct the directory names a bit differently, take two distinct arguments instead. Signed-off-by: Martin Ågren --- Documentation/doc-diff | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/Documentation/doc-diff b/Documentation/doc-diff index 32c83dd26f..3e975d3c5d 100755 --- a/Documentation/doc-diff +++ b/Documentation/doc-diff @@ -79,6 +79,9 @@ then ln -s "$dots/config.mak" "$tmp/worktree/config.mak" fi +from_dir=$from_oid && +to_dir=$to_oid && + # generate_render_makefile generate_render_makefile () { find "$1" -type f | @@ -94,7 +97,7 @@ generate_render_makefile () { done } -# render_tree +# render_tree render_tree () { # Skip install-man entirely if we already have an installed directory. # We can't rely on make here, since "install-man" unconditionally @@ -102,28 +105,31 @@ render_tree () { # we then can't rely on during the render step). We use "mv" to make # sure we don't get confused by a previous run that failed partway # through. - if ! test -d "$tmp/installed/$1" + oid=$1 && + dname=$2 && + if ! test -d "$tmp/installed/$dname" then - git -C "$tmp/worktree" checkout --detach "$1" && + git -C "$tmp/worktree" checkout --detach "$oid" && make -j$parallel -C "$tmp/worktree" \ GIT_VERSION=omitted \ SOURCE_DATE_EPOCH=0 \ - DESTDIR="$tmp/installed/$1+" \ + DESTDIR="$tmp/installed/$dname+" \ install-man && - mv "$tmp/installed/$1+" "$tmp/installed/$1" + mv "$tmp/installed/$dname+" "$tmp/installed/$dname" fi && # As with "installed" above, we skip the render if it's already been # done. So using make here is primarily just about running in # parallel. - if ! test -d "$tmp/rendered/$1" + if ! test -d "$tmp/rendered/$dname" then - generate_render_makefile "$tmp/installed/$1" "$tmp/rendered/$1+" | + generate_render_makefile "$tmp/installed/$dname" \ + "$tmp/rendered/$dname+" | make -j$parallel -f - && - mv "$tmp/rendered/$1+" "$tmp/rendered/$1" + mv "$tmp/rendered/$dname+" "$tmp/rendered/$dname" fi } -render_tree $from_oid && -render_tree $to_oid && -git -C $tmp/rendered diff --no-index "$@" $from_oid $to_oid +render_tree $from_oid $from_dir && +render_tree $to_oid $to_dir && +git -C $tmp/rendered diff --no-index "$@" $from_dir $to_dir From patchwork Sun Mar 17 18:36:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Martin_=C3=85gren?= X-Patchwork-Id: 10856519 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 235E914DE for ; Sun, 17 Mar 2019 18:37:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F23829011 for ; Sun, 17 Mar 2019 18:37:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 039C4291D3; Sun, 17 Mar 2019 18:37:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C40229011 for ; Sun, 17 Mar 2019 18:37:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727173AbfCQShD (ORCPT ); Sun, 17 Mar 2019 14:37:03 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:32850 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726333AbfCQShD (ORCPT ); Sun, 17 Mar 2019 14:37:03 -0400 Received: by mail-lj1-f193.google.com with SMTP id z7so12073247lji.0 for ; Sun, 17 Mar 2019 11:37:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=44u+RIEyIMcUDg105N+zULv77JrXUZRISakECMhX3bs=; b=OGpH1WNzPjTcm5E5ncl9BNXSuY5LMkOpedhm3Nb7onrYGMlJ7JmgdqNO2pi2xaJXuc GwzgdovaWq3+jNl0E9XYVRuAeMGzdjZvljEBZs01UiHsIFCDb2sHWXj6CGvRPvm2FUit HAOgms9oTcZWNQLyW41AZna7x0udrKN8NdYtmL8op/aQ4RILir87xwY8o4Oun69OEvLx QZYLtMzN/miSGgg/BKu8Pj3KefY0t0HEAgMmELjLmhW2kaH5yaLB4ogbESYgx8zQKmC9 W5vi6AnWcRdgHqvKbR5oOq5hUPfbDeDAe1SAVLwdOJM7EJ169CjKBDNp0vXHupAexg23 nf1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=44u+RIEyIMcUDg105N+zULv77JrXUZRISakECMhX3bs=; b=M8TKNbjUXCC6cP5Wa2aOmVZ6ZLxeE1M+qRZ0TpNsLiOjLMiXDcPF6aeAmYSitHsVZY w2MMqoapwNub6Mta9ax2l2pKbsK5nr/5GWN2U7NNyKVRrppjfqDTwjvQ4+wSn+wxvyvR IdRJrRY6dkeq2xNQFutupffslpOzXCYkANZHvwLx9q+39XwPITrXw6XVHZsdaCUlQHl2 7N9g4d61zry/Gj3t9AxBqtmg6QVq9yHKjaXL1bNRYQ0vWWTZ7mzZyqlMuyxspcYSnPk0 310pJXYTUa94Lz9LKbSfnsdWRZYW/XwT3hMMjZkq5PPmyOrj89t20epkaz+PwO/d7bA7 Xuig== X-Gm-Message-State: APjAAAX+8tbJgx48A0aaWDnrO03MthYFacEuSYDR6PLh9RjtxpUS2gtC /U5CysPAruB9lmyDHzasTaJfoNjo X-Google-Smtp-Source: APXvYqzb72O+eSkbq0n5CHnwtb7UF0cuPBHJUmEgWQbtRd/2Vd66/nxyMJLA+y2TdHhQ3cwBQWr7Ow== X-Received: by 2002:a2e:b001:: with SMTP id y1mr8144726ljk.130.1552847820559; Sun, 17 Mar 2019 11:37:00 -0700 (PDT) Received: from localhost.localdomain (31-211-229-121.customers.ownit.se. [31.211.229.121]) by smtp.gmail.com with ESMTPSA id e2sm1589484lfc.75.2019.03.17.11.36.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Mar 2019 11:36:59 -0700 (PDT) From: =?utf-8?q?Martin_=C3=85gren?= To: git@vger.kernel.org Cc: Jeff King Subject: [PATCH 3/4] doc-diff: support diffing from/to AsciiDoc(tor) Date: Sun, 17 Mar 2019 19:36:02 +0100 Message-Id: X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Provide `--from-asciidoctor` and `--to-asciidoctor` to select that the "from" resp. "to" commit should be built with Asciidoctor, and provide an `--asciidoctor` shortcut for giving both. Similarly, provide --{from-,to-,}asciidoc for explicitly selecting AsciiDoc. Implement this using the USE_ASCIIDOCTOR flag. Let's not enforce a default here, but instead just let the Makefile fall back on whatever is in config.mak, so that `./doc-diff foo bar` without any of of these new options behaves exactly like it did before this commit. Encode the choice into the directory names of our "installed" and "rendered" files, so that we can run `./doc-diff --from-asciidoc --to-asciidoctor HEAD HEAD` without our two runs stomping on each other. Signed-off-by: Martin Ågren --- Documentation/doc-diff | 53 +++++++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 8 deletions(-) diff --git a/Documentation/doc-diff b/Documentation/doc-diff index 3e975d3c5d..36fc2307a7 100755 --- a/Documentation/doc-diff +++ b/Documentation/doc-diff @@ -12,9 +12,15 @@ OPTIONS_SPEC="\ doc-diff [options] [-- ] doc-diff (-c|--clean) -- -j=n parallel argument to pass to make -f force rebuild; do not rely on cached results -c,clean cleanup temporary working files +j=n parallel argument to pass to make +f force rebuild; do not rely on cached results +c,clean cleanup temporary working files +from-asciidoc use asciidoc with the 'from'-commit +from-asciidoctor use asciidoctor with the 'from'-commit +asciidoc use asciidoc with both commits +to-asciidoc use asciidoc with the 'to'-commit +to-asciidoctor use asciidoctor with the 'to'-commit +asciidoctor use asciidoctor with both commits " SUBDIRECTORY_OK=1 . "$(git --exec-path)/git-sh-setup" @@ -22,6 +28,8 @@ SUBDIRECTORY_OK=1 parallel= force= clean= +from_program= +to_program= while test $# -gt 0 do case "$1" in @@ -31,6 +39,20 @@ do clean=t ;; -f) force=t ;; + --from-asciidoctor) + from_program=-asciidoctor ;; + --to-asciidoctor) + to_program=-asciidoctor ;; + --asciidoctor) + from_program=-asciidoctor + to_program=-asciidoctor ;; + --from-asciidoc) + from_program=-asciidoc ;; + --to-asciidoc) + to_program=-asciidoc ;; + --asciidoc) + from_program=-asciidoc + to_program=-asciidoc ;; --) shift; break ;; *) @@ -79,8 +101,21 @@ then ln -s "$dots/config.mak" "$tmp/worktree/config.mak" fi -from_dir=$from_oid && -to_dir=$to_oid && +construct_makemanflags () { + if test "$1" = "-asciidoc" + then + echo USE_ASCIIDOCTOR= + elif test "$1" = "-asciidoctor" + then + echo USE_ASCIIDOCTOR=YesPlease + fi +} + +from_makemanflags=$(construct_makemanflags "$from_program") && +to_makemanflags=$(construct_makemanflags "$to_program") && + +from_dir=$from_oid$from_program && +to_dir=$to_oid$to_program && # generate_render_makefile generate_render_makefile () { @@ -97,7 +132,7 @@ generate_render_makefile () { done } -# render_tree +# render_tree render_tree () { # Skip install-man entirely if we already have an installed directory. # We can't rely on make here, since "install-man" unconditionally @@ -107,10 +142,12 @@ render_tree () { # through. oid=$1 && dname=$2 && + makemanflags=$3 && if ! test -d "$tmp/installed/$dname" then git -C "$tmp/worktree" checkout --detach "$oid" && make -j$parallel -C "$tmp/worktree" \ + $makemanflags \ GIT_VERSION=omitted \ SOURCE_DATE_EPOCH=0 \ DESTDIR="$tmp/installed/$dname+" \ @@ -130,6 +167,6 @@ render_tree () { fi } -render_tree $from_oid $from_dir && -render_tree $to_oid $to_dir && +render_tree $from_oid $from_dir $from_makemanflags && +render_tree $to_oid $to_dir $to_makemanflags && git -C $tmp/rendered diff --no-index "$@" $from_dir $to_dir From patchwork Sun Mar 17 18:36:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Martin_=C3=85gren?= X-Patchwork-Id: 10856521 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 34E6614DE for ; Sun, 17 Mar 2019 18:37:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 21AD329011 for ; Sun, 17 Mar 2019 18:37:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1657A291D3; Sun, 17 Mar 2019 18:37:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A524D29011 for ; Sun, 17 Mar 2019 18:37:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727276AbfCQShG (ORCPT ); Sun, 17 Mar 2019 14:37:06 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:36328 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726333AbfCQShG (ORCPT ); Sun, 17 Mar 2019 14:37:06 -0400 Received: by mail-lf1-f68.google.com with SMTP id d18so10146419lfn.3 for ; Sun, 17 Mar 2019 11:37:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=K7c5YDSgyoawrfmqf/oFmLzUxQUdk/OeK/sp494Ht4c=; b=nm50bhIb5PMMJz/PWjSiwkSXp9iNVlO6I8TKZDWyoaR9FGosg2b7oWbweaO2RDbwT8 Q0LgnZ1RoLyXIOIDjM4O88vQCvIHW36742Kl5T8x2jkKcxtfpE3GlFrabAeoqz/Ud2q7 J3p5124whc30Ro8oiCUjXbHauOAupwxcyZgrmJiCCjtlS84h2LcQmhVnNkzpTtMHA8lJ k9LBqbZwCcjYOQu+wzyn8Xv72LpBow25Qx+eEkX5aberZa1UrhpMb6ObHLi76DXl24La 0XSi8Sosl3XgJHMviLfFiwOOyHRJ96Jv2Y1F8s7uUtbwTATVGfzwHtZ7ZVi7WQrxKHl5 p1HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=K7c5YDSgyoawrfmqf/oFmLzUxQUdk/OeK/sp494Ht4c=; b=D5kMFQR/s/Q904O0qnsxIKFbzF3CxRls5a6SyI1fX7u+08R6+w6LaGuAO2jG7CG/qp zYnLtOsxUr4Xsq6onU/Heu8hHtVVapM8tD4oGaisk3YOBW6fq6lXsUS0iI5E4/5oM8lA Hvzgp3AvaM8cTd7+N6s2IQEQWr2zWIj9sPHBt2hC0KEmCA1miqf9bm1p1GEPTlljyUrr /KxPLE/cYnH4DMEr70DHa4GgBIKrEYFmUGTwEBfUTQnyW9SRO3kEsY7SoxPCQL4rKs+7 mNcXME92N32/TUrB8XaTuBEKxrZ4o/XKdaiRwWh4816ymTKpWoRh2JygckME2mRP3Lxw on7w== X-Gm-Message-State: APjAAAWQIyVNM/fOIzZbjitqQ5gnSKivdOf103eijQMmGYDkpKwtrr4l Fd0qjys4N+VrSLrzFznGfje0BCPP X-Google-Smtp-Source: APXvYqzOrGONPm1VHbU3Qqd/lvh7AxCu8a2DgG8Tz47uSgaBTmtglUiFppDngb35CbzjhEqT8U4G6w== X-Received: by 2002:ac2:5921:: with SMTP id v1mr7824933lfi.135.1552847824025; Sun, 17 Mar 2019 11:37:04 -0700 (PDT) Received: from localhost.localdomain (31-211-229-121.customers.ownit.se. [31.211.229.121]) by smtp.gmail.com with ESMTPSA id e2sm1589484lfc.75.2019.03.17.11.37.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Mar 2019 11:37:03 -0700 (PDT) From: =?utf-8?q?Martin_=C3=85gren?= To: git@vger.kernel.org Cc: Jeff King Subject: [PATCH 4/4] doc-diff: add `--cut-header-footer` Date: Sun, 17 Mar 2019 19:36:03 +0100 Message-Id: <7ce7aa6f2f1ea40442c17c15fe8d7744b29d8650.1552838239.git.martin.agren@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP AsciiDoc and Asciidoctor do not agree on what to write in the header and footer of each man-page, i.e., the very first and the very last line of *.[157]. Those differences can certainly be interesting in their own right, but they clutter the output of `./doc-diff --from-asciidoc --to-asciidoctor HEAD HEAD` quite a bit since the diff contains some 10-15 lines of noise per file diffed. Teach doc-diff to cut away the first two and last two lines, i.e., the header/footer and the empty line immediately following/preceding it. Because Asciidoctor uses an extra empty line compared to AsciiDoc, remove one more line at each end of the file, but only if it's empty. An alternative approach might be to pass down `--no-header-footer`, which both AsciiDoc and Asciidoctor understand, but it has some drawbacks. First of all, the result doesn't build -- `xmlto` stumbles on the resulting xml since it has multiple root elements. Second, it cuts too much -- dropping the header loses the synopsis, which would be interesting to diff. Like in the previous commit, encode this option into the directory name of the "installed" and "rendered" files. Otherwise, we wouldn't be able to trust that what we use out of that cache actually corresponds to the options given for this run. (We could optimize this caching a little since this flag doesn't affect the contents of "installed" at all, but let's punt on that.) Signed-off-by: Martin Ågren --- Documentation/doc-diff | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Documentation/doc-diff b/Documentation/doc-diff index 36fc2307a7..3355be4798 100755 --- a/Documentation/doc-diff +++ b/Documentation/doc-diff @@ -21,6 +21,7 @@ asciidoc use asciidoc with both commits to-asciidoc use asciidoc with the 'to'-commit to-asciidoctor use asciidoctor with the 'to'-commit asciidoctor use asciidoctor with both commits +cut-header-footer cut away header and footer " SUBDIRECTORY_OK=1 . "$(git --exec-path)/git-sh-setup" @@ -30,6 +31,7 @@ force= clean= from_program= to_program= +cut_header_footer= while test $# -gt 0 do case "$1" in @@ -53,6 +55,8 @@ do --asciidoc) from_program=-asciidoc to_program=-asciidoc ;; + --cut-header-footer) + cut_header_footer=-cut-header-footer ;; --) shift; break ;; *) @@ -114,8 +118,8 @@ construct_makemanflags () { from_makemanflags=$(construct_makemanflags "$from_program") && to_makemanflags=$(construct_makemanflags "$to_program") && -from_dir=$from_oid$from_program && -to_dir=$to_oid$to_program && +from_dir=$from_oid$from_program$cut_header_footer && +to_dir=$to_oid$to_program$cut_header_footer && # generate_render_makefile generate_render_makefile () { @@ -164,6 +168,17 @@ render_tree () { "$tmp/rendered/$dname+" | make -j$parallel -f - && mv "$tmp/rendered/$dname+" "$tmp/rendered/$dname" + + if test "$cut_header_footer" = "-cut-header-footer" + then + for f in $(find "$tmp/rendered/$dname" -type f) + do + tail -n +3 "$f" | head -n -2 | + sed -e '1{/^$/d}' -e '${/^$/d}' >"$f+" && + mv "$f+" "$f" || + return 1 + done + fi fi }