From patchwork Fri Dec 6 20:16:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11277025 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 C9B1C112B for ; Fri, 6 Dec 2019 20:16:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A7CF22245C for ; Fri, 6 Dec 2019 20:16:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VTdOBxSR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726374AbfLFUQA (ORCPT ); Fri, 6 Dec 2019 15:16:00 -0500 Received: from mail-pj1-f65.google.com ([209.85.216.65]:45277 "EHLO mail-pj1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726325AbfLFUQA (ORCPT ); Fri, 6 Dec 2019 15:16:00 -0500 Received: by mail-pj1-f65.google.com with SMTP id r11so3186076pjp.12 for ; Fri, 06 Dec 2019 12:15:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Mr0XFPIClcusKf6Rx7Xj/y46/nvxOEMC78qoleAMLX0=; b=VTdOBxSR4+0V7SA3k+zzgXaqj+mOrQKgz4Om1jqsQtCNyhQBCVJtOK3OCr3xPiIRRn tBxs6hUmAJRLKWhKSZBw0fCzq1gudEVKfj3guCKG2dAwvjbV3Pz4KZbDfIRQSwHhSQoI ceCoBJenX//T3tOOqNpIWbcilfFj1SapETLaa9feccOkOTKSA3E62M8ICwRub3Nh1pkm GyppOzxhvb6pve8zHbe1bVzPkV4hYU+bdJnjITW5PFV+oWPObYgm7dz+ig6LaS1YXvL8 IvpQLPBpJDSgRoOfAQEkiXV0CCwUdExghHOekqkxGn1BYOYAC/SYjesjQ75WJH2TWetU 7fiw== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Mr0XFPIClcusKf6Rx7Xj/y46/nvxOEMC78qoleAMLX0=; b=IhRcGKrTPGmrX4HjLjvNM7av8mulVO7ECIrn2haJrEhHGPm9phTjM5cowZMjhwGo1G ub3d+c897VCNUH61UYYOkWMFaHfawX1LdzIFxWuEdLaGJmqoZPu76ZAxu/CxmRFQn7Ei L6SVAZo/b0xEBjiNieFZRlpipPzSqsbRGkvPeylpX8+F/jUEg/BI6pApiwntAdM8CarM OFKcMM0T3lNwachkoAg+B7QuCroiT71iMHboj4SCzaVZiZQI3YXcRt4NonzQhUMo4OY1 jNCk5n33uh12r7TTDbV303B2JMvoXidy7Age9hJHDkwtccB+pJiNUVVwBkm5qxor7h+7 f66w== X-Gm-Message-State: APjAAAXA4FhGSQFt/EAJfb2MRfyPehVqUx8LsG6njNka7x+oT/PJIPio qhFLbGXosJ5Ucy3HR6e2b9FvBbYP X-Google-Smtp-Source: APXvYqym/JCr/hQfVkZz9keyh+za0wsqq5Ja5lbaRNXa7w+/LqjiPozJeg9e47MFTMQoxMdkDVzpRw== X-Received: by 2002:a17:90a:c390:: with SMTP id h16mr17934448pjt.131.1575663358901; Fri, 06 Dec 2019 12:15:58 -0800 (PST) Received: from generichostname ([204.14.239.137]) by smtp.gmail.com with ESMTPSA id b73sm18199519pfb.72.2019.12.06.12.15.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2019 12:15:58 -0800 (PST) Date: Fri, 6 Dec 2019 12:16:22 -0800 From: Denton Liu To: Git Mailing List Subject: [PATCH 1/3] t3206: fix incorrect test name Message-ID: <766adb34858c39c446dc9d0211c3f9b34693b99e.1575663345.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 name of the test used to indicate that it was testing the `--notes` option but it was really testing the `format.notes` configuration. Correct the test name to reflect 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 ec2b456dbb..0575dd72b1 100755 --- a/t/t3206-range-diff.sh +++ b/t/t3206-range-diff.sh @@ -638,7 +638,7 @@ test_expect_success 'format-patch --range-diff with --notes' ' test_cmp expect actual ' -test_expect_success 'format-patch --range-diff with --notes' ' +test_expect_success 'format-patch --range-diff with format.notes config' ' git notes add -m "topic note" topic && git notes add -m "unmodified note" unmodified && test_when_finished git notes remove topic unmodified && From patchwork Fri Dec 6 20:16: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: 11277027 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 3A971138D for ; Fri, 6 Dec 2019 20:16:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 162142075C for ; Fri, 6 Dec 2019 20:16:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="q4d2jbWr" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726395AbfLFUQE (ORCPT ); Fri, 6 Dec 2019 15:16:04 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:41610 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726325AbfLFUQE (ORCPT ); Fri, 6 Dec 2019 15:16:04 -0500 Received: by mail-pf1-f196.google.com with SMTP id s18so3883335pfd.8 for ; Fri, 06 Dec 2019 12:16:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=aBzk+gwqp9sM8ylnvZ/AWW5w4k5p2wCnR8/8pQ+jqYg=; b=q4d2jbWrxOogz16fj110D0pUlRDOzHXINIWsY2fRXUGtDP2DhESJ247VjZjvqEZWAK GQCn8dyEO9v4SDBAZ6ZRcq7prMLpklBVD6IU4OUfsh7RcSNGk9zs4vQuyQPenvhGkDx1 ZZkxxNDO6BpM3hW4/C1574wj2aEc5mVF6VyrRHVmQy7IEItyFT9nzQ+ocNYMcHs6fisK +0zgbVpgL2WessXfG744Ye4lUNGzGOiHVvY1aEuixrIMWT4wmL1m9aCqi0dfPZQtXpPB 25oLh+ANn3Y/yZsNlDW5XpNTwdiB6e05IbV9bjDo4zdZzVjUDIXRKRBn/ThDsqbSMhL0 Y/LQ== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=aBzk+gwqp9sM8ylnvZ/AWW5w4k5p2wCnR8/8pQ+jqYg=; b=r3oIctHVcXe5BPChsCmGKp5mCU0bPlnU4LV62rZXvBuep6WAZfGC1WRubGKM1AZK+k 31fGSyPzIT+QbQH7dtIqdN2UVhh1owzqHw67G5ldTU5B+9FErns/CFkKr5mFG3SE+5ff XTETM0DXNxjIJuSY6jjQpYbNLk6jg93nNqmIMMxfzNW1o5R4XbbuuxagJ3bP4X5eyLDA GLWCS+kROeGN0KQFQztsywhKiGRKIPoW3rca0Lvj4YuyP779rh65u47aE4JqXyBkbehZ QJWeTPlPp16Q/u576gfGrD1RczzR9lPCY1LBunwrRrS5MPJQd2jUlgHFQQFoe7ad6ULM uDbw== X-Gm-Message-State: APjAAAUH9g/emgK83cTOru/iJqAaOUi9l83gzw+TwQTenr4QZH7qWSdi PD7F0lzUGclXnbtIfJW92E4DCT+B X-Google-Smtp-Source: APXvYqwAQ1N0RbjkiI5KRIiallWtLjIf+gylSXK/NuiniNa4Pb7Q8NLftZZxPMWtUJLTHCjMFVKBwA== X-Received: by 2002:aa7:801a:: with SMTP id j26mr14222911pfi.50.1575663363224; Fri, 06 Dec 2019 12:16:03 -0800 (PST) Received: from generichostname ([204.14.239.137]) by smtp.gmail.com with ESMTPSA id d85sm17485000pfd.146.2019.12.06.12.16.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2019 12:16:02 -0800 (PST) Date: Fri, 6 Dec 2019 12:16:26 -0800 From: Denton Liu To: Git Mailing List Subject: [PATCH 2/3] range-diff: mark pointers as const Message-ID: <159516cf99c445604d82d8760e8d2f7497db05a5.1575663345.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 contents pointed to by `diffopt` and `other_arg` should not be modified. Mark these as `const` to indicate this. Signed-off-by: Denton Liu --- range-diff.c | 6 +++--- range-diff.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/range-diff.c b/range-diff.c index f56b4012a2..f745567cf6 100644 --- a/range-diff.c +++ b/range-diff.c @@ -41,7 +41,7 @@ static size_t find_end_of_line(char *buffer, unsigned long size) * as struct object_id (will need to be free()d). */ static int read_patches(const char *range, struct string_list *list, - struct argv_array *other_arg) + const struct argv_array *other_arg) { struct child_process cp = CHILD_PROCESS_INIT; struct strbuf buf = STRBUF_INIT, contents = STRBUF_INIT; @@ -506,8 +506,8 @@ 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 argv_array *other_arg) + const struct diff_options *diffopt, + const struct argv_array *other_arg) { int res = 0; diff --git a/range-diff.h b/range-diff.h index 7d918ab9ed..381d52f4d3 100644 --- a/range-diff.h +++ b/range-diff.h @@ -13,7 +13,7 @@ */ int show_range_diff(const char *range1, const char *range2, int creation_factor, int dual_color, - struct diff_options *diffopt, - struct argv_array *other_arg); + const struct diff_options *diffopt, + const struct argv_array *other_arg); #endif From patchwork Fri Dec 6 20:16: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: 11277029 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 91020138D for ; Fri, 6 Dec 2019 20:16:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6FECB2245C for ; Fri, 6 Dec 2019 20:16:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="uVfgBy75" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726403AbfLFUQI (ORCPT ); Fri, 6 Dec 2019 15:16:08 -0500 Received: from mail-pj1-f67.google.com ([209.85.216.67]:35541 "EHLO mail-pj1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726325AbfLFUQI (ORCPT ); Fri, 6 Dec 2019 15:16:08 -0500 Received: by mail-pj1-f67.google.com with SMTP id w23so3204295pjd.2 for ; Fri, 06 Dec 2019 12:16:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=PA9RcFV4ckgHj7Am4nFj/uTlBzaD3s4YTGvBQNOr2Vg=; b=uVfgBy75H8wemPWOx/gC2b5SwFW7lSoxAsDdpxnuUvvVEvRCPkcA2n7Pux8NBFZUce xNZ2IGt2a0L8bcOitI3j3cdZQHdQU0510Rrfm55ixcw3r9yXmE3hGbb+2YgZDxFqhmN0 e+zgaFJxklXYjdq5MX6g+KsTfhDmLOY5UfpBLsXboio2ZCUa6a6lKQUSj2eRKu1DGK/Z yvlqqn2oulG+hJzzCdG46BrTqBkppCVSKRMOJ8gXWgnhsZ7PxsDuXLnWrxkp+/ovyJnO QGFZtq+6f0Iu7v9WmSq/PjsdJqtvF3aV4auikmIoDGX2NQj6/iIzvPWb8TM2W0z+feq4 R46g== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=PA9RcFV4ckgHj7Am4nFj/uTlBzaD3s4YTGvBQNOr2Vg=; b=Niqv56v//6o4fRC1Cx1r6IZa77BMrRQ9ylmV9FMTUJY13JnQFKT+npIy91/I6VUlNY p5Cm8e3yU+mqgJilrRmrCksM43VKBHFQ9ZBy7aNc7Mr7XXoX8/7fMmhYrA8Z5nLP9F6t s+lxNLIIFAnfhwL1h8Yx2iQqDZ801z2SxHv3MstRdIN419Oo3tGsTurll0cbXnPAZf3M +K0MpBAKw/lbOrBoGayPifWDsMXjqUyRQ8yxyzGdVpruWSedklOpNAvWsy343+6yEVb8 jGF0zMjIzDE5Oq0etZE9YJtpv1Ivlo8F2ipze70DBjA5FmGkgvBvYvh2jp1Fh8frLtDv E1yA== X-Gm-Message-State: APjAAAWkw0kNkmWI/0k4pVntF2n/ESh1xsp8Gwn3KuGrolVc9O4sBmZO y9c+Nr3T9WWo+Hll0HeD5UzB/Fco X-Google-Smtp-Source: APXvYqwsrG1vjBByOqbTuhNn10eE5icjyeRSpEWONWcmeuKyP6c9qG/PHwtkHYXfNmYYZwCcMJJAMg== X-Received: by 2002:a17:902:aa85:: with SMTP id d5mr17091327plr.16.1575663367492; Fri, 06 Dec 2019 12:16:07 -0800 (PST) Received: from generichostname ([204.14.239.137]) by smtp.gmail.com with ESMTPSA id b65sm16967307pgc.18.2019.12.06.12.16.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2019 12:16:07 -0800 (PST) Date: Fri, 6 Dec 2019 12:16:31 -0800 From: Denton Liu To: Git Mailing List Subject: [PATCH 3/3] range-diff: clear `other_arg` at end of function 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 We were leaking memory by not clearing `other_arg` after we were done using it. Clear it after we've finished using it. Note that this isn't strictly necessary since the memory will be reclaimed once the command exits. However, since we are releasing the strbufs, we should also clear `other_arg` for consistency. Signed-off-by: Denton Liu --- builtin/range-diff.c | 1 + 1 file changed, 1 insertion(+) diff --git a/builtin/range-diff.c b/builtin/range-diff.c index 98acf3533e..d8a4670629 100644 --- a/builtin/range-diff.c +++ b/builtin/range-diff.c @@ -84,6 +84,7 @@ int cmd_range_diff(int argc, const char **argv, const char *prefix) res = show_range_diff(range1.buf, range2.buf, creation_factor, simple_color < 1, &diffopt, &other_arg); + argv_array_clear(&other_arg); strbuf_release(&range1); strbuf_release(&range2);