From patchwork Wed Nov 20 21:18:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11254793 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 90B17186D for ; Wed, 20 Nov 2019 21:18:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 67C76208C0 for ; Wed, 20 Nov 2019 21:18:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="R3uyG4bT" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725936AbfKTVSa (ORCPT ); Wed, 20 Nov 2019 16:18:30 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:40474 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725819AbfKTVSa (ORCPT ); Wed, 20 Nov 2019 16:18:30 -0500 Received: by mail-pf1-f195.google.com with SMTP id r4so387833pfl.7 for ; Wed, 20 Nov 2019 13:18:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Ds7eK+ykzv9/kr4YgQx3mS7idfg5M+8E1GxpzD8u8kM=; b=R3uyG4bTzqyNjgoVkoy1Zqf6YMj4gzvTNgT0bgl8E8qn58Q2nJhjuc3nrJ9dhmPRHd pGsOAodTcCY7hO9bEJrMj/Ng65PlHv17KFstO7H5ulnbdJ9qqjJG5ncOFX+UhkGRkz0J ffKd9VA/+4PvJfTDNyFAJuhqHNNRGI3QMabgQOYbOI4ecXOTsQnZz80jQZAd5VQ8IjXx bJ8ynwPJ0N8jq2OB5eXogfJB2acvQpksEkF9ll4pIGt+EO/8PILrJTFUj8FYNzPVKaKE t8wwDrjpUcJJdb3KeGGtbJ4TOMBRSEQpZNKxkuzuIdco7GZ+WfUMFqcEXVqqs1IHLDVs gsqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Ds7eK+ykzv9/kr4YgQx3mS7idfg5M+8E1GxpzD8u8kM=; b=A1ZjbzuoO3jjYS/igjf0rvssmnZ2Lv44LoMrieRM4/hP9bg3OVxFefa6pKUaZgGBsg rLm0X9fNYIYos8cJuU+1put7Sglv1/WBPty+zm7qXFy2pYN2Y6lDkIZxF7AIXPMOL2Kh WeRxYVD3PRUr5WcJfzNATZ0pb3acBEmHSq3SMVcUAEnqXYU7G0TnaGr53FifkdT7gS+2 GNd1jWklvvRXaST8x2Tn7wKZOI573Gpm8HDJ8HSf09jYXk8EPHUFYC3Osq1Xzf9rj7mI cYLnwwJHp5BELKOCjrOWrgXuNrUC882Q8KrmJaM6kOo4wIxbTLWr7CT87hW0xesdDoS9 9JRA== X-Gm-Message-State: APjAAAUWxVrzBpRcHH5P5r/qKk5rSwexK/zOSrmRJCAg+FhxvcZ6nidL No4Ew9es/27oxECcPGxD8PxaAX0g X-Google-Smtp-Source: APXvYqwBOjCNpiKUL+BzxtP6CHBerybfiSdsn1E71aqXPagLs2/kws22QiHycVzNVf2H49OFheQ3EQ== X-Received: by 2002:a63:1626:: with SMTP id w38mr5632582pgl.323.1574284708756; Wed, 20 Nov 2019 13:18:28 -0800 (PST) Received: from generichostname ([204.14.239.83]) by smtp.gmail.com with ESMTPSA id 13sm149599pgu.53.2019.11.20.13.18.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2019 13:18:28 -0800 (PST) Date: Wed, 20 Nov 2019 13:18:26 -0800 From: Denton Liu To: Git Mailing List Cc: Johannes Schindelin , Thomas Gummerer , Junio C Hamano , Eric Sunshine Subject: [PATCH v3 01/10] argv-array: add space after `while` Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Signed-off-by: Denton Liu --- argv-array.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/argv-array.c b/argv-array.c index f352ea9357..61ef8c0dfd 100644 --- a/argv-array.c +++ b/argv-array.c @@ -46,7 +46,7 @@ void argv_array_pushl(struct argv_array *array, ...) const char *arg; va_start(ap, array); - while((arg = va_arg(ap, const char *))) + while ((arg = va_arg(ap, const char *))) argv_array_push(array, arg); va_end(ap); } From patchwork Wed Nov 20 21:18:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11254797 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F07556C1 for ; Wed, 20 Nov 2019 21:18:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D12C5208C0 for ; Wed, 20 Nov 2019 21:18:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="tMe8Moc1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726083AbfKTVSd (ORCPT ); Wed, 20 Nov 2019 16:18:33 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:33354 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725819AbfKTVSc (ORCPT ); Wed, 20 Nov 2019 16:18:32 -0500 Received: by mail-pg1-f193.google.com with SMTP id h27so379922pgn.0 for ; Wed, 20 Nov 2019 13:18:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=lJXJmnDX+/pFKtuG+4GW4W7xq7LilAaK4zOcCJ0XC9g=; b=tMe8Moc15Mq0V4F2E3nmD9Gvlf/qYptysKKX18cPs9uyhBnK7sRFhDOIiPHnPYA25Y TKo5+RREfK+P3uSpaVkNc5oN4WxlEpmKRF3uQU/Fj+YqsWJsbxzszbHvIdNML1dcNsIV GJM//FIAE/FCWUg82IrQYs5SYO6mac4sGKmE1N1Jb6wX+B/ie2IgUHzqFM3GW63faDOT W93p8uNWj12bMG8YXB6u54h5eVr5ZClk8F2iocX1DSZTigkgmK0zIZVKOCk/DoS9Uc3a 9CQH7ELGPRQZtFxLe3sMVEDGIczCMuJr+vQgdSt4QyQFylcuWsJ9r9AxXJq7DrXa20A2 Xxww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=lJXJmnDX+/pFKtuG+4GW4W7xq7LilAaK4zOcCJ0XC9g=; b=OAV/7hBKG3d7B/X3Gaov5P6HjQHPM2+v7rpNFREwk7vTJVowq8bE84D3E4KryxTCkK PMvB1HUsBXqTcf78i5uSNbdDBqa7nwIA7VjNx3m/yXUDsk2L7C0U+o7RQE49+nO4UEJp gcn3PZ88EN41Qp5IUQ3D+gYR7l2RVwKTM63fJ/0r/pqYToWDmT3G/buBp09KO+u518SR X0DrOaMXiFBO4UE+LLTiTrvbEBMPLz2V9oMF2nuyaSHV2UluSSs5XkozYiXqzLEj2f1E jgvwqjMui59V9O8qJUiRWdKN7tlDV+cILAGnk/kYKTVQDA6dHcnvdxr8fWUJvE09Krd4 1TtA== X-Gm-Message-State: APjAAAXAjJHG3efyQl3xjatFN6ah0L0gE0VMr/Iv52vYpq/5N9Gpjw+/ XIC9gRF8WDrHUUZI2ALz8RA3TgyP X-Google-Smtp-Source: APXvYqwXbvDLt7Va7sisZV5S7bDFM/j3793jZBvnlVym4F0MHfrF2b2sXnJb3PZauHFVT0C4jdAh3A== X-Received: by 2002:a62:8705:: with SMTP id i5mr5600897pfe.238.1574284711130; Wed, 20 Nov 2019 13:18:31 -0800 (PST) Received: from generichostname ([204.14.239.83]) by smtp.gmail.com with ESMTPSA id 21sm299179pfa.170.2019.11.20.13.18.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2019 13:18:30 -0800 (PST) Date: Wed, 20 Nov 2019 13:18:28 -0800 From: Denton Liu To: Git Mailing List Cc: Johannes Schindelin , Thomas Gummerer , Junio C Hamano , Eric Sunshine Subject: [PATCH v3 02/10] rev-list-options.txt: remove reference to --show-notes Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In ab18b2c0df ("log/pretty-options: Document --[no-]notes and deprecate old notes options", 2011-03-30), the `--show-notes` option was deprecated. However, this reference to it still remains. Change it to reference the replacement option: `--notes`. Signed-off-by: Denton Liu --- Documentation/rev-list-options.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt index 90ff9e2bea..311bc06a9b 100644 --- a/Documentation/rev-list-options.txt +++ b/Documentation/rev-list-options.txt @@ -58,7 +58,7 @@ endif::git-rev-list[] `--all-match`). ifndef::git-rev-list[] + -When `--show-notes` is in effect, the message from the notes is +When `--notes` is in effect, the message from the notes is matched as if it were part of the log message. endif::git-rev-list[] From patchwork Wed Nov 20 21:18:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11254799 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 22D2D14C0 for ; Wed, 20 Nov 2019 21:18:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 03D83208C0 for ; Wed, 20 Nov 2019 21:18:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="pqngbxU3" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726270AbfKTVSg (ORCPT ); Wed, 20 Nov 2019 16:18:36 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:34132 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725819AbfKTVSg (ORCPT ); Wed, 20 Nov 2019 16:18:36 -0500 Received: by mail-pf1-f193.google.com with SMTP id n13so406547pff.1 for ; Wed, 20 Nov 2019 13:18:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=be+YyRDY38TZuonMLsFYhYYjdH2tzjZAZX7TbFqSsxQ=; b=pqngbxU3xILE9kFjiCk79mnQJxxJ1wautXGY9JtBObvXxjbjdY/yxVlO/WsstVQsSw BhDm+JUALTWszw1Mvv4FoqcMQcGFz+u3lfih5vXq8dowSTEU+Ae9s753xgUo/i7VZDO4 InCO9jBRZW6ROy5BfiUiWyClDu4lxr7qlzC/Jd21weYJXYFdU0KbtGEfht2hoyQ1FG75 KOnHON931QyrC5LEY0/XW+qluNT448xboWWSG0oLJgcUCXvw9np1k8lhw1+PFhQcLBbn bNzTfOYT3cZ5TslWlntFP2EDiW+fehGv0Q3RXKATB0OpGW+kUfw0cazyGxb/rM3cW7dI d2nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=be+YyRDY38TZuonMLsFYhYYjdH2tzjZAZX7TbFqSsxQ=; b=VKyuHg2kKFMi3n2dfF5QgFUy6D7uuFGi4Wy1LelNyvaduwYz8vpUbaSNznvtXrtUAB pSS0Zc2PBVY0xR/9OXcU0CwEDWQpPosTh9vTuWVMsZ0pht9QsMTdRU8yBcPivK4ImVN1 jI0lHIiHiDTLIIsOeNpgh/2fGGPPCssJlEhhwUKXDi4kfoU5A84+iVF2827VpferaXgU npdRoDn5PbYDQZpiB4wmr0e1cSBAbXGfDL8QUXSVaCPFIIE7drBDSc9MQDgCYu2COR9C xjCv/G6X9VXm9ytp6Gw0ptZmF09vToUIMuLl6IFO27hPEJD9SNCXibAhbS0Ckd0PICzm 8GFw== X-Gm-Message-State: APjAAAXH3nRYmISk2hL1q6G+KZ3bhDgK/GYQEr2LGjIVCoIMp6ihBsEM TTtlsT1jTapblaMNL8zl7Aa/yKTD X-Google-Smtp-Source: APXvYqxcNqLkZ3eybJLpzyvc8JkqGYQs/hb1xzHuWNPk+TYABlXbb8+15gE8SYHRYXagCrlIRMSTYw== X-Received: by 2002:a63:f207:: with SMTP id v7mr5587580pgh.246.1574284713445; Wed, 20 Nov 2019 13:18:33 -0800 (PST) Received: from generichostname ([204.14.239.83]) by smtp.gmail.com with ESMTPSA id 186sm306618pfe.141.2019.11.20.13.18.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2019 13:18:32 -0800 (PST) Date: Wed, 20 Nov 2019 13:18:31 -0800 From: Denton Liu To: Git Mailing List Cc: Johannes Schindelin , Thomas Gummerer , Junio C Hamano , Eric Sunshine Subject: [PATCH v3 03/10] pretty-options.txt: --notes accepts a ref instead of treeish Message-ID: <4989956f128fe36f743c25aacc89aae14be845ff.1574284470.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Although `--notes=` accepts and handles a tree-ish just fine, it isn't a common use-case for users to pass in bare trees. By having "treeish", it makes it harder to click in users' minds that the argument here is the same type as the `notes.displayRef` configuration variable, for example. Change `treeish` to `ref` so that it will be easier for users to make this connection. Note that we don't completely lose the notion that `--notes=` can accept a tree-ish. In git-notes.txt, we have It is also permitted for a notes ref to point directly to a tree object, in which case the history of the notes can be read with `git log -p -g `. which means that a hardcore user who wants to take advantage of this obscure use-case will be able to infer the connection and not be completely left in the dark. Signed-off-by: Denton Liu --- Documentation/pretty-options.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation/pretty-options.txt b/Documentation/pretty-options.txt index e44fc8f738..6893a4a7ba 100644 --- a/Documentation/pretty-options.txt +++ b/Documentation/pretty-options.txt @@ -57,7 +57,7 @@ message by 4 spaces (i.e. 'medium', which is the default, 'full', and 'fuller'). ifndef::git-rev-list[] ---notes[=]:: +--notes[=]:: Show the notes (see linkgit:git-notes[1]) that annotate the commit, when showing the commit log message. This is the default for `git log`, `git show` and `git whatchanged` commands when @@ -68,8 +68,8 @@ By default, the notes shown are from the notes refs listed in the `core.notesRef` and `notes.displayRef` variables (or corresponding environment overrides). See linkgit:git-config[1] for more details. + -With an optional '' argument, use the treeish to find the notes -to display. The treeish can specify the full refname when it begins +With an optional '' argument, use the ref to find the notes +to display. The ref can specify the full refname when it begins with `refs/notes/`; when it begins with `notes/`, `refs/` and otherwise `refs/notes/` is prefixed to form a full name of the ref. + @@ -85,7 +85,7 @@ being displayed. Examples: "--notes=foo" will show only notes from "--notes --notes=foo --no-notes --notes=bar" will only show notes from "refs/notes/bar". ---show-notes[=]:: +--show-notes[=]:: --[no-]standard-notes:: These options are deprecated. Use the above --notes/--no-notes options instead. From patchwork Wed Nov 20 21:18:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11254801 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C5B4014C0 for ; Wed, 20 Nov 2019 21:18:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A83A1208CC for ; Wed, 20 Nov 2019 21:18:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RKq3cOeu" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726406AbfKTVSh (ORCPT ); Wed, 20 Nov 2019 16:18:37 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:43745 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725819AbfKTVSh (ORCPT ); Wed, 20 Nov 2019 16:18:37 -0500 Received: by mail-pg1-f195.google.com with SMTP id b1so347335pgq.10 for ; Wed, 20 Nov 2019 13:18:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=9JcjKWIXUSWNVVmoQmQ1LIzYLPl7lzPnh8XZSuGo5sI=; b=RKq3cOeu1dMBNfwRhWrhs3p2AOFzB8FwYnt8KeUHtECK+ZUwtpQYr5pNKm3Kf97yDI Y+MmfYPeO8S6IbCVOvuKrUqD87vecYVbVlqcldzdawJpX/KzckPL4FrEWcDVWcvhi61c A1kubda8rryhoStSAJHqanPU/58yaw8UXb9uAoYEKYTB5QK3/6OA91ISfCgFUBE/OyMs 6tDx+pucqZBg+J2CICSwQjGawjrKT8B21idBYdn7VeILtvE7AZTJ2r7UDO/xukrUSVyv xWjbAbGEbbQ7hEAOzgCFw+H4nhedd9Pmz4DOkcFA+fEtlX6qxiN4Mst7LAvlfTIZmumn dkgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=9JcjKWIXUSWNVVmoQmQ1LIzYLPl7lzPnh8XZSuGo5sI=; b=cxTwVPXZ+qa+vmb8YGaXWlnj7pry6QGWlA3dahmH8+1KMjh7xhJwMbxeLh9OzxTPBy dLlcBZ8pRlMBHPABhon9ZBW4edHYmqSh6me16r2VtFp8ORhrMUpEHT7FO+O42RuK9qux GH8Vzohe2XkGjZPqkeOxtobZ+IX+aAEoKvHo0DHkko1uQrE5lqmSb58BfUpoQy7l2as4 0qGZ1ulH33Xdw7G4BCYqAhAKaCwkTMDCmBOCO9geFDQ1RBhoWwfz3Mo/eaV25Fw1SqMn Zj2+VARWmDmYwWkPQtcWEhCtzZ81M+B/gu3jcqoao/W1Xp2E333v7TpXHY0GkwD3gGAH EQIg== X-Gm-Message-State: APjAAAVM8wB4es1HOzEUPpmyG9Iia4DGLHjF/gcE3CVwhY5DWAy+02i7 xg+51JLY2hTztoV6jOpTFfSV334X X-Google-Smtp-Source: APXvYqxrRC68qDN1D/CruQen2PJwKpcQjdSj6O1UCIZBSxvsOPDF57sUKivYwA1wA6G1+LWu7lYrXw== X-Received: by 2002:aa7:93ce:: with SMTP id y14mr5653231pff.138.1574284716051; Wed, 20 Nov 2019 13:18:36 -0800 (PST) Received: from generichostname ([204.14.239.83]) by smtp.gmail.com with ESMTPSA id i2sm154627pgt.34.2019.11.20.13.18.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2019 13:18:35 -0800 (PST) Date: Wed, 20 Nov 2019 13:18:33 -0800 From: Denton Liu To: Git Mailing List Cc: Johannes Schindelin , Thomas Gummerer , Junio C Hamano , Eric Sunshine Subject: [PATCH v3 04/10] t3206: remove spaces after redirect operators Message-ID: <85fcacf3f90454900bbc7983fee4cba82ac02651.1574284470.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org For shell scripts, the usual convention is for there to be no space after redirection operators, (e.g. `>file`, not `> file`). Remove the one instance of this. Signed-off-by: Denton Liu --- t/t3206-range-diff.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t3206-range-diff.sh b/t/t3206-range-diff.sh index 0579cd9969..87c6c029db 100755 --- a/t/t3206-range-diff.sh +++ b/t/t3206-range-diff.sh @@ -8,7 +8,7 @@ test_description='range-diff tests' # harm than good. We need some real history. test_expect_success 'setup' ' - git fast-import < "$TEST_DIRECTORY"/t3206/history.export && + git fast-import <"$TEST_DIRECTORY"/t3206/history.export && test_oid_cache <<-EOF # topic t1 sha1:4de457d From patchwork Wed Nov 20 21:18:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11254803 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A59686C1 for ; Wed, 20 Nov 2019 21:18:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 869AD208A3 for ; Wed, 20 Nov 2019 21:18:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eV81E/DJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726500AbfKTVSj (ORCPT ); Wed, 20 Nov 2019 16:18:39 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:38695 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725819AbfKTVSj (ORCPT ); Wed, 20 Nov 2019 16:18:39 -0500 Received: by mail-pl1-f195.google.com with SMTP id q18so395016pls.5 for ; Wed, 20 Nov 2019 13:18:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ur6KdM4pG0VbrIOUonCcng9RoCMhYGLp0D5rysZWvIo=; b=eV81E/DJfrSWa2lQOrCumBPy255YW8GfuCapYw06pm3Ja6u10HTHb//gNtX7Z1wS+o OcnYr064R2rTSGPdvo8XjL+TGVX86nTedwSCiNjcNBz4iVJAO7VZUKivarrSWEFoEBDQ mHCttphS9bKA7tnaK9bs8WAKQwDkH2ooJgOq4KSm3rheVFRa0/cgng7fSdemc62/fMli 0V5oLtznlFrEv5QHV0TQAu/Bx15h0WH8I+NtK4YM8cY21UAVpAzhF4EgSep/kVkWxbwo sFobioh3uB5A+Dkgb9HkCwqtMEltQWhF0T5bYhaTsQZqk1KpRZx4KCPSajQl0enco06e QBqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ur6KdM4pG0VbrIOUonCcng9RoCMhYGLp0D5rysZWvIo=; b=E+Y4vu3ZCyHtak/ERL95TQTpy4MmEcQzgNWtv0P7UOR8Ar4PY4lCXBU0WOolxrL4ug hK9Se78VjCcqCrsu+YlpfkZ7wLva7IOEQ8wARVP+LEHKXJctWKRjmoJ5S5VvRVBxuMtI KA1pOnhc7ulIOe++Co+TKl29il6mD2d4JdigYbfZ3rwx56wVHIACStCcbDUFz+0FLVcH zrnScgENWs6EnLQbR3tNd5d1QpFoEjQOLvu+t6N6CkAcPFfBITiV8l/50kVQZLumgzml eYbLGbPTusB8kXZgZhrQzF618ef9OFWhXePwyCV4NwQjm8RnhzjIJd2QlRQ/oLornDym +SJg== X-Gm-Message-State: APjAAAXHNrOcFF8pIXZdzkuvUyOYQMNmdwxSnPgdtipuTuRYQvO0n8+y o2xEdm7p9ZnFwL7Q+36FfyKOwQe2 X-Google-Smtp-Source: APXvYqykN200GrgCsbD3zSf0fO4hWqx0TDcchDlds0GUk0P5TiORc2xJ7m6vgrOy6ym47wbjwSyBJg== X-Received: by 2002:a17:90a:f496:: with SMTP id bx22mr6747156pjb.101.1574284718281; Wed, 20 Nov 2019 13:18:38 -0800 (PST) Received: from generichostname ([204.14.239.83]) by smtp.gmail.com with ESMTPSA id a26sm299865pff.155.2019.11.20.13.18.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2019 13:18:37 -0800 (PST) Date: Wed, 20 Nov 2019 13:18:36 -0800 From: Denton Liu To: Git Mailing List Cc: Johannes Schindelin , Thomas Gummerer , Junio C Hamano , Eric Sunshine Subject: [PATCH v3 05/10] t3206: disable parameter substitution in heredoc Message-ID: <855a3df542a63ff77bd7164a4a7aab6d3b0fa447.1574284470.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In the first heredoc, parameter substitution is not used so prevent it from happening in the future (perhaps by accident) by escaping the limit EOF. The remaining heredocs use parameter substitution so they cannot be changed. Signed-off-by: Denton Liu --- t/t3206-range-diff.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t3206-range-diff.sh b/t/t3206-range-diff.sh index 87c6c029db..41606775d4 100755 --- a/t/t3206-range-diff.sh +++ b/t/t3206-range-diff.sh @@ -9,7 +9,7 @@ test_description='range-diff tests' test_expect_success 'setup' ' git fast-import <"$TEST_DIRECTORY"/t3206/history.export && - test_oid_cache <<-EOF + test_oid_cache <<-\EOF # topic t1 sha1:4de457d t2 sha1:fccce22 From patchwork Wed Nov 20 21:18:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11254805 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DF7AF6C1 for ; Wed, 20 Nov 2019 21:18:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B2B4A206F4 for ; Wed, 20 Nov 2019 21:18:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="N2rsv+Sj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726541AbfKTVSn (ORCPT ); Wed, 20 Nov 2019 16:18:43 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:35129 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725819AbfKTVSn (ORCPT ); Wed, 20 Nov 2019 16:18:43 -0500 Received: by mail-pl1-f193.google.com with SMTP id s10so404076plp.2 for ; Wed, 20 Nov 2019 13:18:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=5p2ZOQuy+iNIQ2CYDd7NpARtwccGqLHTFui/tKgJLs4=; b=N2rsv+SjzyH2B5vTR8XtmigzQA8bLMJ2QIgujUeAH1TrRHS+pbPd/D1s/hqQO74jb2 jUzQlcQNngiNRSeRJD9feueRMand03Cr+QYSMC6k0JD4Qtot0Sh5mWMxZLFV9+7jokW/ T4EC9+HA/oTYyhChciPGe6yAtdtzfr/Q8g9WYROxPCLG8227YyiTp1Wfd967my8FQTG/ uevIBQvWMSyR/0xPxkL9ZLvm5R+qQMzbMt6F0LJ4JqGs3jPeoxkl0Tbnl96qwYNDf2bV Ne3/9R011Z5JdaT9zvFBwI5WoEt35evcFmN7jwJeVdhmfbcAWZ3ZlYj4fSa44lMpS4kC mm+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=5p2ZOQuy+iNIQ2CYDd7NpARtwccGqLHTFui/tKgJLs4=; b=dkd99YeCL67uMvCL2c3yNpbambhCDoyia13+NDlAwv0trRFqPVFSEGT+x25BiipUQ+ qX5jd/U3mUa2JgcX1iQFC5Kq/ye/hoRldUi2qZR5QhYscsyW0ucf7MYw4EkGmEajIM5g pUg+LPdUxtW23+UjdaB+UDhpJNmvjq8yI8eXT3A7T447VyKau6lU19rLLCyYFrVfjFAm I6pZVuKcQ8WhFxktI+UFp9YQBTmZks7l2goCuo9FgitHr8JvKqYrmXo303oxxYAwKWS8 vxI90dHunBcglD680+i/NHUdgjiWZ+aVujUlVfGona2VSsetx5MhN4Ul5VF9A2A2wx/u HUxQ== X-Gm-Message-State: APjAAAWLf3xbE7HIZJN3tlzFAY2NRbxMLn1KspAWx4iukVdAzhGoHou0 rEBHnGsIX1b3Knk89v15hnHlpTLn X-Google-Smtp-Source: APXvYqz4RZSsduKMAFpbiTFstNJKDsfVw5wOWtzD4mGlnkDvgjiUPrfM0NDLuzk5Vh/gJOO4Ex7/DQ== X-Received: by 2002:a17:902:126:: with SMTP id 35mr5155033plb.105.1574284720729; Wed, 20 Nov 2019 13:18:40 -0800 (PST) Received: from generichostname ([204.14.239.83]) by smtp.gmail.com with ESMTPSA id w2sm330458pfj.22.2019.11.20.13.18.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2019 13:18:40 -0800 (PST) Date: Wed, 20 Nov 2019 13:18:38 -0800 From: Denton Liu To: Git Mailing List Cc: Johannes Schindelin , Thomas Gummerer , Junio C Hamano , Eric Sunshine Subject: [PATCH v3 06/10] t3206: s/expected/expect/ Message-ID: <92df18b261ce9299a5f76ab61c93ffeb0503521b.1574284470.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org For test cases, the usual convention is to name expected output files "expect", not "expected". Replace all instances of "expected" with "expect". Signed-off-by: Denton Liu --- t/t3206-range-diff.sh | 64 +++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/t/t3206-range-diff.sh b/t/t3206-range-diff.sh index 41606775d4..f654aed54f 100755 --- a/t/t3206-range-diff.sh +++ b/t/t3206-range-diff.sh @@ -121,88 +121,88 @@ test_expect_success 'setup' ' test_expect_success 'simple A..B A..C (unmodified)' ' git range-diff --no-color master..topic master..unmodified \ >actual && - cat >expected <<-EOF && + cat >expect <<-EOF && 1: $(test_oid t1) = 1: $(test_oid u1) s/5/A/ 2: $(test_oid t2) = 2: $(test_oid u2) s/4/A/ 3: $(test_oid t3) = 3: $(test_oid u3) s/11/B/ 4: $(test_oid t4) = 4: $(test_oid u4) s/12/B/ EOF - test_cmp expected actual + test_cmp expect actual ' test_expect_success 'simple B...C (unmodified)' ' git range-diff --no-color topic...unmodified >actual && - # same "expected" as above - test_cmp expected actual + # same "expect" as above + test_cmp expect actual ' test_expect_success 'simple A B C (unmodified)' ' git range-diff --no-color master topic unmodified >actual && - # same "expected" as above - test_cmp expected actual + # same "expect" as above + test_cmp expect actual ' test_expect_success 'trivial reordering' ' git range-diff --no-color master topic reordered >actual && - cat >expected <<-EOF && + cat >expect <<-EOF && 1: $(test_oid t1) = 1: $(test_oid r1) s/5/A/ 3: $(test_oid t3) = 2: $(test_oid r2) s/11/B/ 4: $(test_oid t4) = 3: $(test_oid r3) s/12/B/ 2: $(test_oid t2) = 4: $(test_oid r4) s/4/A/ EOF - test_cmp expected actual + test_cmp expect actual ' test_expect_success 'removed a commit' ' git range-diff --no-color master topic removed >actual && - cat >expected <<-EOF && + cat >expect <<-EOF && 1: $(test_oid t1) = 1: $(test_oid d1) s/5/A/ 2: $(test_oid t2) < -: $(test_oid __) s/4/A/ 3: $(test_oid t3) = 2: $(test_oid d2) s/11/B/ 4: $(test_oid t4) = 3: $(test_oid d3) s/12/B/ EOF - test_cmp expected actual + test_cmp expect actual ' test_expect_success 'added a commit' ' git range-diff --no-color master topic added >actual && - cat >expected <<-EOF && + cat >expect <<-EOF && 1: $(test_oid t1) = 1: $(test_oid a1) s/5/A/ 2: $(test_oid t2) = 2: $(test_oid a2) s/4/A/ -: $(test_oid __) > 3: $(test_oid a3) s/6/A/ 3: $(test_oid t3) = 4: $(test_oid a4) s/11/B/ 4: $(test_oid t4) = 5: $(test_oid a5) s/12/B/ EOF - test_cmp expected actual + test_cmp expect actual ' test_expect_success 'new base, A B C' ' git range-diff --no-color master topic rebased >actual && - cat >expected <<-EOF && + cat >expect <<-EOF && 1: $(test_oid t1) = 1: $(test_oid b1) s/5/A/ 2: $(test_oid t2) = 2: $(test_oid b2) s/4/A/ 3: $(test_oid t3) = 3: $(test_oid b3) s/11/B/ 4: $(test_oid t4) = 4: $(test_oid b4) s/12/B/ EOF - test_cmp expected actual + test_cmp expect actual ' test_expect_success 'new base, B...C' ' # this syntax includes the commits from master! git range-diff --no-color topic...rebased >actual && - cat >expected <<-EOF && + cat >expect <<-EOF && -: $(test_oid __) > 1: $(test_oid b5) unrelated 1: $(test_oid t1) = 2: $(test_oid b1) s/5/A/ 2: $(test_oid t2) = 3: $(test_oid b2) s/4/A/ 3: $(test_oid t3) = 4: $(test_oid b3) s/11/B/ 4: $(test_oid t4) = 5: $(test_oid b4) s/12/B/ EOF - test_cmp expected actual + test_cmp expect actual ' test_expect_success 'changed commit' ' git range-diff --no-color topic...changed >actual && - cat >expected <<-EOF && + cat >expect <<-EOF && 1: $(test_oid t1) = 1: $(test_oid c1) s/5/A/ 2: $(test_oid t2) = 2: $(test_oid c2) s/4/A/ 3: $(test_oid t3) ! 3: $(test_oid c3) s/11/B/ @@ -226,23 +226,23 @@ test_expect_success 'changed commit' ' +B 13 EOF - test_cmp expected actual + test_cmp expect actual ' test_expect_success 'changed commit with --no-patch diff option' ' git range-diff --no-color --no-patch topic...changed >actual && - cat >expected <<-EOF && + cat >expect <<-EOF && 1: $(test_oid t1) = 1: $(test_oid c1) s/5/A/ 2: $(test_oid t2) = 2: $(test_oid c2) s/4/A/ 3: $(test_oid t3) ! 3: $(test_oid c3) s/11/B/ 4: $(test_oid t4) ! 4: $(test_oid c4) s/12/B/ EOF - test_cmp expected actual + test_cmp expect actual ' test_expect_success 'changed commit with --stat diff option' ' git range-diff --no-color --stat topic...changed >actual && - cat >expected <<-EOF && + cat >expect <<-EOF && 1: $(test_oid t1) = 1: $(test_oid c1) s/5/A/ a => b | 0 1 file changed, 0 insertions(+), 0 deletions(-) @@ -256,12 +256,12 @@ test_expect_success 'changed commit with --stat diff option' ' a => b | 0 1 file changed, 0 insertions(+), 0 deletions(-) EOF - test_cmp expected actual + test_cmp expect actual ' test_expect_success 'changed commit with sm config' ' git range-diff --no-color --submodule=log topic...changed >actual && - cat >expected <<-EOF && + cat >expect <<-EOF && 1: $(test_oid t1) = 1: $(test_oid c1) s/5/A/ 2: $(test_oid t2) = 2: $(test_oid c2) s/4/A/ 3: $(test_oid t3) ! 3: $(test_oid c3) s/11/B/ @@ -285,12 +285,12 @@ test_expect_success 'changed commit with sm config' ' +B 13 EOF - test_cmp expected actual + test_cmp expect actual ' test_expect_success 'renamed file' ' git range-diff --no-color --submodule=log topic...renamed-file >actual && - sed s/Z/\ /g >expected <<-EOF && + sed s/Z/\ /g >expect <<-EOF && 1: $(test_oid t1) = 1: $(test_oid n1) s/5/A/ 2: $(test_oid t2) ! 2: $(test_oid n2) s/4/A/ @@ Metadata @@ -330,12 +330,12 @@ test_expect_success 'renamed file' ' Z 10 Z B EOF - test_cmp expected actual + test_cmp expect actual ' test_expect_success 'file with mode only change' ' git range-diff --no-color --submodule=log topic...mode-only-change >actual && - sed s/Z/\ /g >expected <<-EOF && + sed s/Z/\ /g >expect <<-EOF && 1: fccce22 ! 1: 4d39cb3 s/4/A/ @@ Metadata ZAuthor: Thomas Rast @@ -370,12 +370,12 @@ test_expect_success 'file with mode only change' ' + ## other-file (mode change 100644 => 100755) ## 3: a63e992 = 3: 4c1e0f5 s/12/B/ EOF - test_cmp expected actual + test_cmp expect actual ' test_expect_success 'file added and later removed' ' git range-diff --no-color --submodule=log topic...added-removed >actual && - sed s/Z/\ /g >expected <<-EOF && + sed s/Z/\ /g >expect <<-EOF && 1: $(test_oid t1) = 1: $(test_oid s1) s/5/A/ 2: $(test_oid t2) ! 2: $(test_oid s2) s/4/A/ @@ Metadata @@ -411,7 +411,7 @@ test_expect_success 'file added and later removed' ' + ## new-file (deleted) ## 4: $(test_oid t4) = 4: $(test_oid s4) s/12/B/ EOF - test_cmp expected actual + test_cmp expect actual ' test_expect_success 'no commits on one side' ' @@ -421,7 +421,7 @@ test_expect_success 'no commits on one side' ' test_expect_success 'changed message' ' git range-diff --no-color topic...changed-message >actual && - sed s/Z/\ /g >expected <<-EOF && + sed s/Z/\ /g >expect <<-EOF && 1: $(test_oid t1) = 1: $(test_oid m1) s/5/A/ 2: $(test_oid t2) ! 2: $(test_oid m2) s/4/A/ @@ Metadata @@ -436,7 +436,7 @@ test_expect_success 'changed message' ' 3: $(test_oid t3) = 3: $(test_oid m3) s/11/B/ 4: $(test_oid t4) = 4: $(test_oid m4) s/12/B/ EOF - test_cmp expected actual + test_cmp expect actual ' test_expect_success 'dual-coloring' ' From patchwork Wed Nov 20 21:18:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11254807 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 37EBA186D for ; Wed, 20 Nov 2019 21:18:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 182A62071C for ; Wed, 20 Nov 2019 21:18:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JO35SIHf" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726613AbfKTVSp (ORCPT ); Wed, 20 Nov 2019 16:18:45 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:33737 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725819AbfKTVSo (ORCPT ); Wed, 20 Nov 2019 16:18:44 -0500 Received: by mail-pf1-f195.google.com with SMTP id c184so411137pfb.0 for ; Wed, 20 Nov 2019 13:18:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=wEEg5Em9M80m2qrBVvnD55D8JA6XPSx+tu87ITXhLWo=; b=JO35SIHfP+f25jnaslRlogn6a6SjIFo2dxtEGVAu6JZRdoaH5p6vmINpkE+NUrSF9I zigF4MdwRhJ0tyM59FRreAlJkN67BolLZYEzu0fukUe1QNjZtUM2G1WSBvAWY51NjrV/ haiR4u3EXqRLgVVnzFVFaHV2Ykahfh+P54pxJ5vaO80z4e17b5AuigTv5QJXtjr3f+rT pKVjcXtbIsiVfHwoOX80/1xHgf5NuwTQf2r8RqsZBjEuYd2T1OJ51o/k7Og1k6JvkDtX j/mkbjSyH2RAV4/MOHi8ajtCVxo4Spsz3Xd8/71IlQdnMaRZFmPKYqwh3xUHxyBjHgog IL8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=wEEg5Em9M80m2qrBVvnD55D8JA6XPSx+tu87ITXhLWo=; b=ON3bYNXKI2r07YMr25jdi9rMesimyJx61D9PR38qdSgrwvHwQIS7e2adSy35Nf2rfO Jv2qlpfcLhdHFmETyipVcLVikwM+ts0K7S1KNfwVNt4rqePc2VclZwMDfq/WYarOHNXD NsWs0FeC2S0l+nxI0dCdo622zfcm64E0tqkKT8qJlwUSta+JwrTFYLqTO4kUptQH7v3D sJGbNjBkUXYbYnM5QIph7GcJ2VD4ljEdvAL1cAhYdl8xheeDYJLurlUUEEzwptDUlQ1Y CySwA+ykEX72q9uKERiA4H2CKc6QYGcNt66W/hL9rwvUVxd8ggna3zUlMnAwIqYlDlMy mUKw== X-Gm-Message-State: APjAAAUUTtbIJfbQRqQXILqbSda6GU09XYzgiWrhpV5qgnf29RpFeBgb RIUPP1QCJT6ypR16V6j5PLPtvWFU X-Google-Smtp-Source: APXvYqzo9roNfgCDv751X8XsZWWum12QdttBQN1KN85WUP+CabstUM6kMUNGxbO2YpmcozaYRmKl/w== X-Received: by 2002:a62:2a4c:: with SMTP id q73mr6374864pfq.94.1574284723209; Wed, 20 Nov 2019 13:18:43 -0800 (PST) Received: from generichostname ([204.14.239.83]) by smtp.gmail.com with ESMTPSA id h26sm307682pfo.93.2019.11.20.13.18.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2019 13:18:42 -0800 (PST) Date: Wed, 20 Nov 2019 13:18:41 -0800 From: Denton Liu To: Git Mailing List Cc: Johannes Schindelin , Thomas Gummerer , Junio C Hamano , Eric Sunshine Subject: [PATCH v3 07/10] t3206: range-diff compares logs with commit notes Message-ID: <093d32ac4f198341232a46bf867317b8c3c7d566.1574284470.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The test suite had a blindspot where it did not check the behavior of range-diff and format-patch when notes were present. Cover this blindspot. Signed-off-by: Denton Liu --- t/t3206-range-diff.sh | 52 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/t/t3206-range-diff.sh b/t/t3206-range-diff.sh index f654aed54f..19ba644933 100755 --- a/t/t3206-range-diff.sh +++ b/t/t3206-range-diff.sh @@ -505,4 +505,56 @@ test_expect_success 'range-diff overrides diff.noprefix internally' ' git -c diff.noprefix=true range-diff HEAD^... ' +test_expect_success 'range-diff compares notes by default' ' + git notes add -m "topic note" topic && + git notes add -m "unmodified note" unmodified && + test_when_finished git notes remove topic unmodified && + git range-diff --no-color master..topic master..unmodified \ + >actual && + sed s/Z/\ /g >expect <<-EOF && + 1: $(test_oid t1) = 1: $(test_oid u1) s/5/A/ + 2: $(test_oid t2) = 2: $(test_oid u2) s/4/A/ + 3: $(test_oid t3) = 3: $(test_oid u3) s/11/B/ + 4: $(test_oid t4) ! 4: $(test_oid u4) s/12/B/ + @@ Metadata + Z + Z ## Commit message ## + Z s/12/B/ + - topic note + + unmodified note + Z + Z ## file ## + Z@@ file: A + EOF + test_cmp expect actual +' + +test_expect_success 'format-patch --range-diff compares notes by default' ' + git notes add -m "topic note" topic && + git notes add -m "unmodified note" unmodified && + test_when_finished git notes remove topic unmodified && + git format-patch --cover-letter --range-diff=$prev \ + master..unmodified >actual && + test_when_finished "rm 000?-*" && + test_line_count = 5 actual && + test_i18ngrep "^Range-diff:$" 0000-* && + grep "= 1: .* s/5/A" 0000-* && + grep "= 2: .* s/4/A" 0000-* && + grep "= 3: .* s/11/B" 0000-* && + grep "! 4: .* s/12/B" 0000-* && + sed s/Z/\ /g >expect <<-EOF && + @@ Metadata + Z + Z ## Commit message ## + Z s/12/B/ + - topic note + + unmodified note + Z + Z ## file ## + Z@@ file: A + EOF + sed "/@@ Metadata/,/@@ file: A/!d" 0000-* >actual && + test_cmp expect actual +' + test_done From patchwork Wed Nov 20 21:18:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11254809 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 47C2814C0 for ; Wed, 20 Nov 2019 21:18:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 24AA1206F4 for ; Wed, 20 Nov 2019 21:18:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qpjTXUdu" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726634AbfKTVSs (ORCPT ); Wed, 20 Nov 2019 16:18:48 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:34133 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725819AbfKTVSr (ORCPT ); Wed, 20 Nov 2019 16:18:47 -0500 Received: by mail-pg1-f195.google.com with SMTP id z188so375574pgb.1 for ; Wed, 20 Nov 2019 13:18:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=saq1sIiKvHUKZa9S6Brdpex6Ut71yq+oK+oYi6wLdkY=; b=qpjTXUduP5uz2PDLUmMoWaONLKLwW7Gp+diQ/I7sGnP/v4EfnCvVIgGreUT5Jmuo/X IjVBBWCWQiS5YuYAPolPZj4IlAyFQSd7gL/17IalWUrxrpM6GOZ4VFlDk+/j3P8v8BMY BvBlne1x+HgHJVzkCEqgzFrKXJM5FJ2bFwgM8u6nxXaMPM7C5c15L+0MtRqvsijrmj7j iq+UALxRMTUnH0JOEiHS9d/hWlTAUaRBcYftiGUstl4Q7NFiIslzNEd8dXUZTilScrHw OsMuoQbfTVcJSaOmcG+zA7ekLUkW2kWfsxzuG4IaZoPpE3cMicG1lZzZVQ6o9648U/Yg Q3Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=saq1sIiKvHUKZa9S6Brdpex6Ut71yq+oK+oYi6wLdkY=; b=qMIKucQ/gSkM/Ug3q9q2sN/PI5Jd5CyQ0cg+9f3mje9r9Sd3XfAoMtxXoMp7+hVEq4 i3IG1xRWAPGk6Ey7Q9M/fFBLDRxXLG6uuCXJwm5bPQXX81higBvgZqcFfqyKE4EHCtji FXhzOcP6AjPtR0vV3U8ZFVDSO++nQuA0jbS4d82I4CCyZeMNK/1F30v67049aWpmo6C2 6nYd9AhZMrK3vrT55E78H6WdXsV0jEu9b6i0NeLJh+1Gm9MYCAMAJl4YpezKv3cx2zcp oQTv/JRklMhqux8crBFNUe5MlrH8XV4yS1QWVr9JGU+cBPzUicfpTZJWqqo7FaLhCQHS gRtw== X-Gm-Message-State: APjAAAXZj6ev6P19M94BxJljbiALB88vJv/jBeIq45sBAY6EiMXr+5NO KOvAvQXCQqFqh+6/UvpuPk++xGYc X-Google-Smtp-Source: APXvYqwS2JkiH16R79x/GTpvQ+2h3A+JfFqPv/Clhc3MbmSPgkavbOyL6/ip2yh3SQyLhFTZFomwCw== X-Received: by 2002:a62:e519:: with SMTP id n25mr6403613pff.220.1574284725459; Wed, 20 Nov 2019 13:18:45 -0800 (PST) Received: from generichostname ([204.14.239.83]) by smtp.gmail.com with ESMTPSA id i22sm194465pjx.1.2019.11.20.13.18.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2019 13:18:44 -0800 (PST) Date: Wed, 20 Nov 2019 13:18:43 -0800 From: Denton Liu To: Git Mailing List Cc: Johannes Schindelin , Thomas Gummerer , Junio C Hamano , Eric Sunshine Subject: [PATCH v3 08/10] range-diff: output `## Notes ##` header Message-ID: <2d1c849ecc30c14ace8a99753c35c96d168347bc.1574284470.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When notes were included in the output of range-diff, they were just mashed together with the rest of the commit message. As a result, users wouldn't be able to clearly distinguish where the commit message ended and where the notes started. Output a `## Notes ##` header when notes are detected so that notes can be compared more clearly. Note that we handle case of `Notes (): -> ## Notes () ##` with this code as well. We can't test this in this patch, however, since there is currently no way to pass along different notes refs to `git log`. This will be fixed in a future patch. Signed-off-by: Denton Liu --- range-diff.c | 6 ++++++ t/t3206-range-diff.sh | 14 +++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/range-diff.c b/range-diff.c index 7fed5a3b4b..623397221d 100644 --- a/range-diff.c +++ b/range-diff.c @@ -144,6 +144,12 @@ static int read_patches(const char *range, struct string_list *list) strbuf_addstr(&buf, line); strbuf_addstr(&buf, "\n\n"); strbuf_addstr(&buf, " ## Commit message ##\n"); + } else if (starts_with(line, "Notes") && + line[strlen(line) - 1] == ':') { + strbuf_addstr(&buf, "\n\n"); + /* strip the trailing colon */ + strbuf_addf(&buf, " ## %.*s ##\n", + (int)(strlen(line) - 1), line); } else if (starts_with(line, " ")) { p = line + len - 2; while (isspace(*p) && p >= line) diff --git a/t/t3206-range-diff.sh b/t/t3206-range-diff.sh index 19ba644933..b936c16dd1 100755 --- a/t/t3206-range-diff.sh +++ b/t/t3206-range-diff.sh @@ -516,10 +516,10 @@ test_expect_success 'range-diff compares notes by default' ' 2: $(test_oid t2) = 2: $(test_oid u2) s/4/A/ 3: $(test_oid t3) = 3: $(test_oid u3) s/11/B/ 4: $(test_oid t4) ! 4: $(test_oid u4) s/12/B/ - @@ Metadata + @@ Commit message Z - Z ## Commit message ## - Z s/12/B/ + Z + Z ## Notes ## - topic note + unmodified note Z @@ -543,17 +543,17 @@ test_expect_success 'format-patch --range-diff compares notes by default' ' grep "= 3: .* s/11/B" 0000-* && grep "! 4: .* s/12/B" 0000-* && sed s/Z/\ /g >expect <<-EOF && - @@ Metadata + @@ Commit message Z - Z ## Commit message ## - Z s/12/B/ + Z + Z ## Notes ## - topic note + unmodified note Z Z ## file ## Z@@ file: A EOF - sed "/@@ Metadata/,/@@ file: A/!d" 0000-* >actual && + sed "/@@ Commit message/,/@@ file: A/!d" 0000-* >actual && test_cmp expect actual ' From patchwork Wed Nov 20 21:18:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11254811 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3CD046C1 for ; Wed, 20 Nov 2019 21:18:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 12BD12068E for ; Wed, 20 Nov 2019 21:18:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Lt4xi4/a" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726658AbfKTVSu (ORCPT ); Wed, 20 Nov 2019 16:18:50 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:44195 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725819AbfKTVSt (ORCPT ); Wed, 20 Nov 2019 16:18:49 -0500 Received: by mail-pl1-f196.google.com with SMTP id az9so376296plb.11 for ; Wed, 20 Nov 2019 13:18:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=GJy7X3pKqJj9Y40YvoPbGXtnc6cAxsPSDRUu9ErTuZw=; b=Lt4xi4/ahr3QNZoGz8a07zPkmO96gWUt0dqG30FxoPKLKpPB8rzdc6LdurW1bxsJt6 0B0lv3+zvsWgynh9cxdWEx99SD0fDBb0VQ00gu9ml05nX5PVot249hX+j5bqM9IcVVHh wxBPlIc+65nFk66TxoFBe/pLpWV7ZCICMx4T3xuHss2U65DDGYROlG2fZvOnApvsZ/yv Rx0Gq3ZGmD1ZDKVqdC23TYEkJsQj66iaaVHry0ilOEMRqhJfoDSLwhPONxO4UYmOJOhD 1voovW908/mS3tdnukY8Spy6zFxuOLi+yappSKHN3QZrFgHmjMWEHvYyudxrdijpLbEJ TMdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=GJy7X3pKqJj9Y40YvoPbGXtnc6cAxsPSDRUu9ErTuZw=; b=tUJ9yDK3cTS4xn8k9v+C6RAjyM4ZnrJZG8Njli/MPzeC2Q49TDHKOFqFbqZMirRodE 1GzURrZC/Owi04EJg7awqk/J5T8XFi1jYA0WsBbno9b9Z86lh4hKyqSqw3kQ2NHv/ohj 12mLisKPYi3waMuhUuqVxHbB5fZPwq9NmMYYAea57ZAu/JSWADbS9lg535jTVPiFh8c0 0GNYosF3dMnkPq9H31AifKKfTxnKPQWOv23CHtdC9OOat/mhlxzGoiaglmvTcFMsm6tz 26wOeT54QWpjS0cvlRoHlxhKklX+0aLdcAzqUuY/j1xTUWoAqt4BY9U6sDBIJn8/SnYy zx9Q== X-Gm-Message-State: APjAAAXdKo0qXbHJUMWPMmuMN22vl9FGhMr+4rm6RqLxU74PnYwE6oPY 41m5NyY6fm2VQgeY8YvThX8YTZYC X-Google-Smtp-Source: APXvYqxkQVP8Q4drKNKDQvh6H/Zd9337nhV6bk965W5PDcvNLaZ4zmjA8Przw88UsHig3RkJFCCSpg== X-Received: by 2002:a17:90b:d85:: with SMTP id bg5mr6876252pjb.5.1574284727744; Wed, 20 Nov 2019 13:18:47 -0800 (PST) Received: from generichostname ([204.14.239.83]) by smtp.gmail.com with ESMTPSA id c3sm315724pfi.91.2019.11.20.13.18.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2019 13:18:47 -0800 (PST) Date: Wed, 20 Nov 2019 13:18:45 -0800 From: Denton Liu To: Git Mailing List Cc: Johannes Schindelin , Thomas Gummerer , Junio C Hamano , Eric Sunshine Subject: [PATCH v3 09/10] range-diff: pass through --notes to `git log` Message-ID: <9c144e14c52ddc5ea3c280d51124fbf56c54c215.1574284470.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When a commit being range-diff'd has a note attached to it, the note will be compared as well. However, if a user has multiple notes refs or if they want to suppress notes from being printed, there is currently no way to do this. Pass through `--[no-]notes[=]` to the `git log` call so that this option is customizable. Signed-off-by: Denton Liu --- Documentation/git-range-diff.txt | 6 +++- builtin/log.c | 2 +- builtin/range-diff.c | 6 +++- log-tree.c | 2 +- range-diff.c | 15 ++++++---- range-diff.h | 4 ++- t/t3206-range-diff.sh | 47 ++++++++++++++++++++++++++++++++ 7 files changed, 72 insertions(+), 10 deletions(-) diff --git a/Documentation/git-range-diff.txt b/Documentation/git-range-diff.txt index 8a6ea2c6c5..a2c25f4490 100644 --- a/Documentation/git-range-diff.txt +++ b/Documentation/git-range-diff.txt @@ -57,6 +57,10 @@ to revert to color all lines according to the outer diff markers See the ``Algorithm`` section below for an explanation why this is needed. +--[no-]notes[=]:: + This flag is passed to the `git log` program + (see linkgit:git-log[1]) that generates the patches. + :: Compare the commits specified by the two ranges, where `` is considered an older version of ``. @@ -75,7 +79,7 @@ to revert to color all lines according to the outer diff markers linkgit:git-diff[1]), most notably the `--color=[]` and `--no-color` options. These options are used when generating the "diff between patches", i.e. to compare the author, commit message and diff of -corresponding old/new commits. There is currently no means to tweak the +corresponding old/new commits. There is currently no means to tweak most of the diff options passed to `git log` when generating those patches. OUTPUT STABILITY diff --git a/builtin/log.c b/builtin/log.c index a26f223ab4..047ac4594d 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -1189,7 +1189,7 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout, diff_setup_done(&opts); fprintf_ln(rev->diffopt.file, "%s", rev->rdiff_title); show_range_diff(rev->rdiff1, rev->rdiff2, - rev->creation_factor, 1, &opts); + rev->creation_factor, 1, &opts, NULL); } } diff --git a/builtin/range-diff.c b/builtin/range-diff.c index 9202e75544..98acf3533e 100644 --- a/builtin/range-diff.c +++ b/builtin/range-diff.c @@ -15,12 +15,16 @@ int cmd_range_diff(int argc, const char **argv, const char *prefix) { int creation_factor = RANGE_DIFF_CREATION_FACTOR_DEFAULT; struct diff_options diffopt = { NULL }; + struct argv_array other_arg = ARGV_ARRAY_INIT; int simple_color = -1; struct option range_diff_options[] = { OPT_INTEGER(0, "creation-factor", &creation_factor, N_("Percentage by which creation is weighted")), OPT_BOOL(0, "no-dual-color", &simple_color, N_("use simple diff colors")), + OPT_PASSTHRU_ARGV(0, "notes", &other_arg, + N_("notes"), N_("passed to 'git log'"), + PARSE_OPT_OPTARG), OPT_END() }; struct option *options; @@ -78,7 +82,7 @@ int cmd_range_diff(int argc, const char **argv, const char *prefix) FREE_AND_NULL(options); res = show_range_diff(range1.buf, range2.buf, creation_factor, - simple_color < 1, &diffopt); + simple_color < 1, &diffopt, &other_arg); strbuf_release(&range1); strbuf_release(&range2); diff --git a/log-tree.c b/log-tree.c index 923a299e70..151e12f415 100644 --- a/log-tree.c +++ b/log-tree.c @@ -770,7 +770,7 @@ void show_log(struct rev_info *opt) opts.use_color = opt->diffopt.use_color; diff_setup_done(&opts); show_range_diff(opt->rdiff1, opt->rdiff2, - opt->creation_factor, 1, &opts); + opt->creation_factor, 1, &opts, NULL); memcpy(&diff_queued_diff, &dq, sizeof(diff_queued_diff)); } diff --git a/range-diff.c b/range-diff.c index 623397221d..f56b4012a2 100644 --- a/range-diff.c +++ b/range-diff.c @@ -40,7 +40,8 @@ static size_t find_end_of_line(char *buffer, unsigned long size) * Reads the patches into a string list, with the `util` field being populated * as struct object_id (will need to be free()d). */ -static int read_patches(const char *range, struct string_list *list) +static int read_patches(const char *range, struct string_list *list, + struct argv_array *other_arg) { struct child_process cp = CHILD_PROCESS_INIT; struct strbuf buf = STRBUF_INIT, contents = STRBUF_INIT; @@ -61,8 +62,11 @@ static int read_patches(const char *range, struct string_list *list) "--output-indicator-new=>", "--output-indicator-old=<", "--output-indicator-context=#", - "--no-abbrev-commit", range, + "--no-abbrev-commit", NULL); + if (other_arg) + argv_array_pushv(&cp.args, other_arg->argv); + argv_array_push(&cp.args, range); cp.out = -1; cp.no_stdin = 1; cp.git_cmd = 1; @@ -502,16 +506,17 @@ static struct strbuf *output_prefix_cb(struct diff_options *opt, void *data) int show_range_diff(const char *range1, const char *range2, int creation_factor, int dual_color, - struct diff_options *diffopt) + struct diff_options *diffopt, + struct argv_array *other_arg) { int res = 0; struct string_list branch1 = STRING_LIST_INIT_DUP; struct string_list branch2 = STRING_LIST_INIT_DUP; - if (read_patches(range1, &branch1)) + if (read_patches(range1, &branch1, other_arg)) res = error(_("could not parse log for '%s'"), range1); - if (!res && read_patches(range2, &branch2)) + if (!res && read_patches(range2, &branch2, other_arg)) res = error(_("could not parse log for '%s'"), range2); if (!res) { diff --git a/range-diff.h b/range-diff.h index 08a50b6e98..7d918ab9ed 100644 --- a/range-diff.h +++ b/range-diff.h @@ -2,6 +2,7 @@ #define RANGE_DIFF_H #include "diff.h" +#include "argv-array.h" #define RANGE_DIFF_CREATION_FACTOR_DEFAULT 60 @@ -12,6 +13,7 @@ */ int show_range_diff(const char *range1, const char *range2, int creation_factor, int dual_color, - struct diff_options *diffopt); + struct diff_options *diffopt, + struct argv_array *other_arg); #endif diff --git a/t/t3206-range-diff.sh b/t/t3206-range-diff.sh index b936c16dd1..521b4a83ec 100755 --- a/t/t3206-range-diff.sh +++ b/t/t3206-range-diff.sh @@ -529,6 +529,53 @@ test_expect_success 'range-diff compares notes by default' ' test_cmp expect actual ' +test_expect_success 'range-diff with --no-notes' ' + git notes add -m "topic note" topic && + git notes add -m "unmodified note" unmodified && + test_when_finished git notes remove topic unmodified && + git range-diff --no-color --no-notes master..topic master..unmodified \ + >actual && + cat >expect <<-EOF && + 1: $(test_oid t1) = 1: $(test_oid u1) s/5/A/ + 2: $(test_oid t2) = 2: $(test_oid u2) s/4/A/ + 3: $(test_oid t3) = 3: $(test_oid u3) s/11/B/ + 4: $(test_oid t4) = 4: $(test_oid u4) s/12/B/ + EOF + test_cmp expect actual +' + +test_expect_success 'range-diff with multiple --notes' ' + git notes --ref=note1 add -m "topic note1" topic && + git notes --ref=note1 add -m "unmodified note1" unmodified && + test_when_finished git notes --ref=note1 remove topic unmodified && + git notes --ref=note2 add -m "topic note2" topic && + git notes --ref=note2 add -m "unmodified note2" unmodified && + test_when_finished git notes --ref=note2 remove topic unmodified && + git range-diff --no-color --notes=note1 --notes=note2 master..topic master..unmodified \ + >actual && + sed s/Z/\ /g >expect <<-EOF && + 1: $(test_oid t1) = 1: $(test_oid u1) s/5/A/ + 2: $(test_oid t2) = 2: $(test_oid u2) s/4/A/ + 3: $(test_oid t3) = 3: $(test_oid u3) s/11/B/ + 4: $(test_oid t4) ! 4: $(test_oid u4) s/12/B/ + @@ Commit message + Z + Z + Z ## Notes (note1) ## + - topic note1 + + unmodified note1 + Z + Z + Z ## Notes (note2) ## + - topic note2 + + unmodified note2 + Z + Z ## file ## + Z@@ file: A + EOF + test_cmp expect actual +' + test_expect_success 'format-patch --range-diff compares notes by default' ' git notes add -m "topic note" topic && git notes add -m "unmodified note" unmodified && From patchwork Wed Nov 20 21:18:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11254813 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 804A514C0 for ; Wed, 20 Nov 2019 21:18:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5349B206F4 for ; Wed, 20 Nov 2019 21:18:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JWY5CYLZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726712AbfKTVSx (ORCPT ); Wed, 20 Nov 2019 16:18:53 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:40499 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725819AbfKTVSx (ORCPT ); Wed, 20 Nov 2019 16:18:53 -0500 Received: by mail-pf1-f194.google.com with SMTP id r4so388275pfl.7 for ; Wed, 20 Nov 2019 13:18:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=b6LOaSWxTK1jOSeJo+C17Dxov4Wyr4HkbzrDMBMrjjU=; b=JWY5CYLZXZXnRQrirHCMPhAV3c6qxhpXKbgoeC7lRWpEQHEJ0QhJEQf+bx54ZYuL34 qzyxyorroMx722ZtyEW53ZALZPjVuA6twCnzVMFmjJ03w2kqyPAkV8VPEQlQBEFEyEOO LxQtHClz5nWrHKAOJVNEaeYu5Jjm4K5ZctY3iYB49NuG+f0CM/XbOOch77yugh9vWqCI 6FK2Zmw0orMv9X7PT/QHfVfLqva81Bqs3t9+zw8MR1JCXjl5xQxN42m6/EBrEvCtMWSe R7qT8qGa7b/gGx0UY1LWL/5m4ZaXkdZPovgHyvDnQHNjfdlbAYHN3dS+mp7mF3FbXgCE w6WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=b6LOaSWxTK1jOSeJo+C17Dxov4Wyr4HkbzrDMBMrjjU=; b=FC9EDVeHeursRMTrx0b4MVUBZbba7vZkwzZfiTCkFXA+SbGngWpkqOsDEci50arRml dDJA9KKJqOFIhXT9Vght2KHcbD+DIjZ3cxfjEd+ANdEvAYaYLZsT4ZWPsXv0C51+AYOP I4AfOScUbjRRfSRNaqXuKQYzOAjSyvBAqOi9h7MCgixQ/QY5KDcZg+8phPnOmmmdKTiE 4tpqhaLSKny7jfS3/Edd5CN2HIpuN1bhU1GSXFf/xR8Xe0hn3W9NhGd8x++pXBlbgTiA Ip+ka5VQEKZEmWLzXl4+69DpCFhKDsNJ0Jib45m3KID0eQadGe+7i39TMTKAhTkq2usZ jahQ== X-Gm-Message-State: APjAAAVl4xOE2pxJgsmEl6h6R6ZxqfmTlYJ2OcPWR48hgmAXFgIEoQYX Ppkevv4lV0tNik2Yl5n+CwDElWw/ X-Google-Smtp-Source: APXvYqxb0DH1hRwJvoWw3JWaKgdU0ZRkhghT5sEoCocFVYOW+jloAtSVQjCWUQFYHtfpqr5JcOGVrw== X-Received: by 2002:a65:530d:: with SMTP id m13mr5415828pgq.172.1574284730012; Wed, 20 Nov 2019 13:18:50 -0800 (PST) Received: from generichostname ([204.14.239.83]) by smtp.gmail.com with ESMTPSA id v24sm318982pfn.53.2019.11.20.13.18.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2019 13:18:49 -0800 (PST) Date: Wed, 20 Nov 2019 13:18:47 -0800 From: Denton Liu To: Git Mailing List Cc: Johannes Schindelin , Thomas Gummerer , Junio C Hamano , Eric Sunshine Subject: [PATCH v3 10/10] format-patch: pass notes configuration to range-diff Message-ID: <86318b3fe7b53f5bad0f0094bc237afc74108ecc.1574284470.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Since format-patch accepts `--[no-]notes`, one would expect the range-diff generated to also respect the setting. Unfortunately, the range-diff we currently generate only uses the default option (which always outputs default notes, even when notes are not being used elsewhere). Pass the notes configuration to range-diff so that it can honor it. Signed-off-by: Denton Liu --- builtin/log.c | 24 +++++++++- t/t3206-range-diff.sh | 101 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 123 insertions(+), 2 deletions(-) diff --git a/builtin/log.c b/builtin/log.c index 047ac4594d..e192f219d9 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -1111,6 +1111,25 @@ static void prepare_cover_text(struct pretty_print_context *pp, strbuf_release(&subject_sb); } +static int get_notes_refs(struct string_list_item *item, void *arg) +{ + argv_array_pushf(arg, "--notes=%s", item->string); + return 0; +} + +static void get_notes_args(struct argv_array *arg, struct rev_info *rev) +{ + if (!rev->show_notes) { + argv_array_push(arg, "--no-notes"); + } else if (rev->notes_opt.use_default_notes > 0 || + (rev->notes_opt.use_default_notes == -1 && + !rev->notes_opt.extra_notes_refs.nr)) { + argv_array_push(arg, "--notes"); + } else { + for_each_string_list(&rev->notes_opt.extra_notes_refs, get_notes_refs, arg); + } +} + static void make_cover_letter(struct rev_info *rev, int use_stdout, struct commit *origin, int nr, struct commit **list, @@ -1183,13 +1202,16 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout, * can be added later if deemed desirable. */ struct diff_options opts; + struct argv_array other_arg = ARGV_ARRAY_INIT; diff_setup(&opts); opts.file = rev->diffopt.file; opts.use_color = rev->diffopt.use_color; diff_setup_done(&opts); fprintf_ln(rev->diffopt.file, "%s", rev->rdiff_title); + get_notes_args(&other_arg, rev); show_range_diff(rev->rdiff1, rev->rdiff2, - rev->creation_factor, 1, &opts, NULL); + rev->creation_factor, 1, &opts, &other_arg); + argv_array_clear(&other_arg); } } diff --git a/t/t3206-range-diff.sh b/t/t3206-range-diff.sh index 521b4a83ec..ec2b456dbb 100755 --- a/t/t3206-range-diff.sh +++ b/t/t3206-range-diff.sh @@ -576,7 +576,7 @@ test_expect_success 'range-diff with multiple --notes' ' test_cmp expect actual ' -test_expect_success 'format-patch --range-diff compares notes by default' ' +test_expect_success 'format-patch --range-diff does not compare notes by default' ' git notes add -m "topic note" topic && git notes add -m "unmodified note" unmodified && test_when_finished git notes remove topic unmodified && @@ -588,6 +588,40 @@ test_expect_success 'format-patch --range-diff compares notes by default' ' grep "= 1: .* s/5/A" 0000-* && grep "= 2: .* s/4/A" 0000-* && grep "= 3: .* s/11/B" 0000-* && + grep "= 4: .* s/12/B" 0000-* && + ! grep "Notes" 0000-* && + ! grep "note" 0000-* +' + +test_expect_success 'format-patch --range-diff with --no-notes' ' + git notes add -m "topic note" topic && + git notes add -m "unmodified note" unmodified && + test_when_finished git notes remove topic unmodified && + git format-patch --no-notes --cover-letter --range-diff=$prev \ + master..unmodified >actual && + test_when_finished "rm 000?-*" && + test_line_count = 5 actual && + test_i18ngrep "^Range-diff:$" 0000-* && + grep "= 1: .* s/5/A" 0000-* && + grep "= 2: .* s/4/A" 0000-* && + grep "= 3: .* s/11/B" 0000-* && + grep "= 4: .* s/12/B" 0000-* && + ! grep "Notes" 0000-* && + ! grep "note" 0000-* +' + +test_expect_success 'format-patch --range-diff with --notes' ' + git notes add -m "topic note" topic && + git notes add -m "unmodified note" unmodified && + test_when_finished git notes remove topic unmodified && + git format-patch --notes --cover-letter --range-diff=$prev \ + master..unmodified >actual && + test_when_finished "rm 000?-*" && + test_line_count = 5 actual && + test_i18ngrep "^Range-diff:$" 0000-* && + grep "= 1: .* s/5/A" 0000-* && + grep "= 2: .* s/4/A" 0000-* && + grep "= 3: .* s/11/B" 0000-* && grep "! 4: .* s/12/B" 0000-* && sed s/Z/\ /g >expect <<-EOF && @@ Commit message @@ -604,4 +638,69 @@ test_expect_success 'format-patch --range-diff compares notes by default' ' test_cmp expect actual ' +test_expect_success 'format-patch --range-diff with --notes' ' + git notes add -m "topic note" topic && + git notes add -m "unmodified note" unmodified && + test_when_finished git notes remove topic unmodified && + test_config format.notes true && + git format-patch --cover-letter --range-diff=$prev \ + master..unmodified >actual && + test_when_finished "rm 000?-*" && + test_line_count = 5 actual && + test_i18ngrep "^Range-diff:$" 0000-* && + grep "= 1: .* s/5/A" 0000-* && + grep "= 2: .* s/4/A" 0000-* && + grep "= 3: .* s/11/B" 0000-* && + grep "! 4: .* s/12/B" 0000-* && + sed s/Z/\ /g >expect <<-EOF && + @@ Commit message + Z + Z + Z ## Notes ## + - topic note + + unmodified note + Z + Z ## file ## + Z@@ file: A + EOF + sed "/@@ Commit message/,/@@ file: A/!d" 0000-* >actual && + test_cmp expect actual +' + +test_expect_success 'format-patch --range-diff with multiple notes' ' + git notes --ref=note1 add -m "topic note1" topic && + git notes --ref=note1 add -m "unmodified note1" unmodified && + test_when_finished git notes --ref=note1 remove topic unmodified && + git notes --ref=note2 add -m "topic note2" topic && + git notes --ref=note2 add -m "unmodified note2" unmodified && + test_when_finished git notes --ref=note2 remove topic unmodified && + git format-patch --notes=note1 --notes=note2 --cover-letter --range-diff=$prev \ + master..unmodified >actual && + test_when_finished "rm 000?-*" && + test_line_count = 5 actual && + test_i18ngrep "^Range-diff:$" 0000-* && + grep "= 1: .* s/5/A" 0000-* && + grep "= 2: .* s/4/A" 0000-* && + grep "= 3: .* s/11/B" 0000-* && + grep "! 4: .* s/12/B" 0000-* && + sed s/Z/\ /g >expect <<-EOF && + @@ Commit message + Z + Z + Z ## Notes (note1) ## + - topic note1 + + unmodified note1 + Z + Z + Z ## Notes (note2) ## + - topic note2 + + unmodified note2 + Z + Z ## file ## + Z@@ file: A + EOF + sed "/@@ Commit message/,/@@ file: A/!d" 0000-* >actual && + test_cmp expect actual +' + test_done