From patchwork Sun Sep 8 17:58:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ren=C3=A9_Scharfe?= X-Patchwork-Id: 11137049 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 08773912 for ; Sun, 8 Sep 2019 17:59:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D8D84214DB for ; Sun, 8 Sep 2019 17:59:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=web.de header.i=@web.de header.b="sYVCPLl1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730694AbfIHR65 (ORCPT ); Sun, 8 Sep 2019 13:58:57 -0400 Received: from mout.web.de ([212.227.15.3]:53469 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730561AbfIHR64 (ORCPT ); Sun, 8 Sep 2019 13:58:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1567965524; bh=SqH7A+iScGS6JOCLx4L2PQmkiov2Pse6dNpzLJiBrkk=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=sYVCPLl1PPgN0/nZlA2oKzp2FdBLSww42aNrWd1Gsy0UtsGaxX6ueP3kwqqFvYPjP VpAr1MXRInfkhArQbogyuT86wFYFSimA0lquUB3Wgo+NFlyknURaojxv6JcYPAu3bl ry2IY/pwQr3jBhnYSvFAcsZUKSLEhmcoJstFwgwA= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from [192.168.178.26] ([79.203.24.71]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0Lba5z-1ia4tT2Wc7-00lH1y; Sun, 08 Sep 2019 19:58:44 +0200 Subject: [PATCH 1/2] log: test --decorate-refs-exclude with --simplify-by-decoration To: Junio C Hamano Cc: =?utf-8?q?=C3=89tienne_SERVAIS?= , git@vger.kernel.org, =?utf-8?q?Rafael_Ascens=C3=A3o?= References: <37283d4e-3f79-a6b1-425a-f90704fbcce2@web.de> <5de287e9-a8e8-780a-7d39-2229b61914ca@web.de> <64bc5556-b098-7991-b7c2-3483277bb73c@web.de> From: =?utf-8?q?Ren=C3=A9_Scharfe?= Message-ID: Date: Sun, 8 Sep 2019 19:58:41 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-Provags-ID: V03:K1:vIb7Vn1vDPRe6qZHruw2RWutkrjqI2CTilkEsOUE4yJ/vqQGnIb BPVMZz3wjqQQigZSLZIYcZjMfhS+xvzEx5UT3thP9Zcl/ZCRrx0kCobHQIVRZshsXl22DRz OsCXdz9vVcx1PDU78nWS0an1PCqwXQwvOJnfkmGqlU1/hdKTg1rFzqSiHA+1W6F6VveCH+V O5efXuRoMWUZvq9ymasVg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:bA6yjr+t9UA=:KrfK23P26XZMGQgpwnet3E P5kJeyeiBPgtVdD1/evQaHZ40ml8mxcWRplWTXF8PAcQRrAc4JMT87WKbIuKA7kmlMhkA3KeP vFhK0dqpkl4lrJAPIhux5ESuPfTgwKAK4LBz7Aojo87Os6nxLn08Lq6GzDYZfpJJQUCgR2MPR 6oNJVa0Vn/0RIoKcMMNoyqTm4JvezYh28uIQrsZxeRmSlfiyBe2+s9B8iIzejAHzdv4TYFa1v eM5rqRKxkNJ27Fw3C68RYKsJ2qiANHMHUn9SW0f7Z4SLw6W7MFzGIsDXez6oBQxvyGvQOViDE SRrTU6MeUcVOrYg/s/CdKyVUGBLMfnnpXK7KT1ZmfTZWfDjjnVvUetCdSqeWZXfuiLeyN/hil AsB7+D+t7yvznBsywwzf1IrpxNjnc+mY1u3CNpoQFNWDkkVSz72IHqm44k9mm02sFYLXDgHOU OYRokZsLu9U+uuDxN1dK+a15VzE+p5f+9hwG83A4ehzBkqRErqQ+7Q6o+Jhznkpm8wSI6hGdH QkhSKCj/gHSQoeVep7G2DxRodK6LpmWnD2ihR+mHwsyKJOnMPRDt9pFAW1nhhQiVsgMOYbTdv 0aow8glLap3EIJComW/DcXgqJKy8N0sa9tdA8fD2fl0bQve6Gbc4SAJWh+RkO8RvK+32vw2oa eaC74uJXScl26fqGRdU2rDjbAN0ckms3UCrypTcdxRy8hvfKexH/tcZgS662LhYJ08ehhRH+m VW9KX9HEcpHBuND9yL6lXs8aRYiucQDqLbB2KD2zxrpKODUjZsuXy2vri3Kdo6ftSsdd3YFRN KuGzmSX7irU13y/ygmB24I+M2d549icdpAkv0gdHjX5or8qvh8yn7OR314PpunYTEI9BvPvRg GiZjK6WjzCI+KW1vPBdQmjWHKI5z/CbQtHlyJwMS8sAnqWg4s5858nZJ46/jkGlezqskWj6aR 86XYT7zJxIpwDQZvkqhJ5DtFFtkDm51xLJnVApV1cQdzp2j27PaCUMNEqKQM+GUB5xKtFHaZ+ 3KwkpCWdICXD+2HOLvNP1oOvnVC8VmNB3vc2VHkBOpOWWmPyTkmpWNSvPyiROe+7Zrg/sMXa5 K5Hb4AfL7F0ObrLtFU+Q0oJPysgoEU6HPij1nBNUuCTV03gPZjiQDlIyHY1oGrOYvK6OQYA+T bFabONFpFgoD7/Kd/gk+VeyueFHRSCd7uFI8+WbfE3CZzgNoRd/OwQkGT9thr4gDMdL/Y= Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Demonstrate that a decoration filter given with --decorate-refs-exclude is inadvertently overruled by --simplify-by-decoration. Reported-by: Étienne SERVAIS Signed-off-by: René Scharfe --- t/t4202-log.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) -- 2.23.0 diff --git a/t/t4202-log.sh b/t/t4202-log.sh index c20209324c..01c95d1375 100755 --- a/t/t4202-log.sh +++ b/t/t4202-log.sh @@ -837,6 +837,21 @@ test_expect_success 'decorate-refs and decorate-refs-exclude' ' test_cmp expect.decorate actual ' +test_expect_failure 'decorate-refs-exclude and simplify-by-decoration' ' + cat >expect.decorate <<-\EOF && + Merge-tag-reach (HEAD -> master) + reach (tag: reach, reach) + seventh (tag: seventh) + Merge-branch-tangle + Merge-branch-side-early-part-into-tangle (tangle) + tangle-a (tag: tangle-a) + EOF + git log -n6 --decorate=short --pretty="tformat:%f%d" \ + --decorate-refs-exclude="*octopus*" \ + --simplify-by-decoration >actual && + test_cmp expect.decorate actual +' + test_expect_success 'log.decorate config parsing' ' git log --oneline --decorate=full >expect.full && git log --oneline --decorate=short >expect.short && From patchwork Sun Sep 8 17:58:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ren=C3=A9_Scharfe?= X-Patchwork-Id: 11137051 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 3014513B1 for ; Sun, 8 Sep 2019 17:59:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0D109214DB for ; Sun, 8 Sep 2019 17:59:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=web.de header.i=@web.de header.b="R09de9jb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730686AbfIHR65 (ORCPT ); Sun, 8 Sep 2019 13:58:57 -0400 Received: from mout.web.de ([212.227.15.3]:42975 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730531AbfIHR64 (ORCPT ); Sun, 8 Sep 2019 13:58:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1567965532; bh=rVPBWlNIEjchLTwATWM6ihUouiZOhlSBup022NoCWLU=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=R09de9jbSqOr4MQlhpYsYCs+bYtst6HzH5cdXNi6551zRDwR7xIRMXsWbRCBwbivQ mUVU3QxDktLpM0rA/WNQWQy//9scFE7lhquxhB2H+gfMrfWD/WAKjyLtvlS899iqtp IALfzXrS8SdanxLlNhE+ddprg/NxPkgYIpKMbCVc= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from [192.168.178.26] ([79.203.24.71]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0M8L3a-1iKrNe2MIk-00vwdG; Sun, 08 Sep 2019 19:58:52 +0200 Subject: [PATCH 2/2] log-tree: call load_ref_decorations() in get_name_decoration() To: Junio C Hamano Cc: =?utf-8?q?=C3=89tienne_SERVAIS?= , git@vger.kernel.org, =?utf-8?q?Rafael_Ascens=C3=A3o?= References: <37283d4e-3f79-a6b1-425a-f90704fbcce2@web.de> <5de287e9-a8e8-780a-7d39-2229b61914ca@web.de> <64bc5556-b098-7991-b7c2-3483277bb73c@web.de> From: =?utf-8?q?Ren=C3=A9_Scharfe?= Message-ID: Date: Sun, 8 Sep 2019 19:58:51 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-Provags-ID: V03:K1:qL1B7Jd+a1L8UM8VUMp+AcJf4VGx/61pQrLeraVvCYcnMQYzmTZ cBgsHs79vYbesoUkou2vcdm45Vdr9GO3y5vh4ZZf/NmESD9tYII9EfxeeXQ/wnKDVTl4HYN 8Z8WPMi+A73gi8cml5sEaB0rqwW2B50R9NNz2K+JbAb6B8Mv9NfUQb2nU90JXVofhRaib0G gaPW2ejr54LnQM7TdM/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H0y0zsPLVmKJavWTsS57JD B76cdpcosCXZaBzWXRNi8MpkC04Eyeq/pdiVzTUmH9GHxrvYpVbW7vuc5W981leWmP8P3OaXM P2d4mEr9B5im/BqerrCrjCqw70Vv2GquQyxzdaohNw/jmfLVUo+4DE++kGxtBcooNbJYJ5I24 E10527LzUkl7Dnon7kigHpXVmUof9R4xUrCGVTO1mtvbLtwfnPU5aHVLKuj6VitrAfndo= Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Load a default set of ref name decorations at the first lookup. This frees direct and indirect callers from doing so. They can still do it if they want to use a filter or are interested in full decorations instead of the default short ones -- the first load_ref_decorations() call wins. This means that the load in builtin/log.c::cmd_log_init_finish() is respected even if --simplify-by-decoration is given, as the previously dominating earlier load in handle_revision_opt() is gone. So a filter given with --decorate-refs-exclude is used for simplification in that case, as expected. Signed-off-by: René Scharfe --- log-tree.c | 1 + pretty.c | 2 -- revision.c | 1 - t/t4202-log.sh | 2 +- 4 files changed, 2 insertions(+), 4 deletions(-) -- 2.23.0 diff --git a/log-tree.c b/log-tree.c index 1e56df62a7..2d5710e707 100644 --- a/log-tree.c +++ b/log-tree.c @@ -77,6 +77,7 @@ void add_name_decoration(enum decoration_type type, const char *name, struct obj const struct name_decoration *get_name_decoration(const struct object *obj) { + load_ref_decorations(NULL, DECORATE_SHORT_REFS); return lookup_decoration(&name_decoration, obj); } diff --git a/pretty.c b/pretty.c index e4ed14effe..b32f036953 100644 --- a/pretty.c +++ b/pretty.c @@ -1239,11 +1239,9 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */ strbuf_addstr(sb, get_revision_mark(NULL, commit)); return 1; case 'd': - load_ref_decorations(NULL, DECORATE_SHORT_REFS); format_decorations(sb, commit, c->auto_color); return 1; case 'D': - load_ref_decorations(NULL, DECORATE_SHORT_REFS); format_decorations_extended(sb, commit, c->auto_color, "", ", ", ""); return 1; case 'S': /* tag/branch like --source */ diff --git a/revision.c b/revision.c index 07412297f0..1df3061e95 100644 --- a/revision.c +++ b/revision.c @@ -2063,7 +2063,6 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg revs->simplify_by_decoration = 1; revs->limited = 1; revs->prune = 1; - load_ref_decorations(NULL, DECORATE_SHORT_REFS); } else if (!strcmp(arg, "--date-order")) { revs->sort_order = REV_SORT_BY_COMMIT_DATE; revs->topo_order = 1; diff --git a/t/t4202-log.sh b/t/t4202-log.sh index 01c95d1375..bb66d1d93c 100755 --- a/t/t4202-log.sh +++ b/t/t4202-log.sh @@ -837,7 +837,7 @@ test_expect_success 'decorate-refs and decorate-refs-exclude' ' test_cmp expect.decorate actual ' -test_expect_failure 'decorate-refs-exclude and simplify-by-decoration' ' +test_expect_success 'decorate-refs-exclude and simplify-by-decoration' ' cat >expect.decorate <<-\EOF && Merge-tag-reach (HEAD -> master) reach (tag: reach, reach)