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