From patchwork Thu Aug 27 17:44:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shourya Shukla X-Patchwork-Id: 11741213 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 627D1739 for ; Thu, 27 Aug 2020 17:45:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 42DEE2087E for ; Thu, 27 Aug 2020 17:45:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PyV5/yjE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726924AbgH0RpQ (ORCPT ); Thu, 27 Aug 2020 13:45:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726153AbgH0RpO (ORCPT ); Thu, 27 Aug 2020 13:45:14 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D2A6C061264 for ; Thu, 27 Aug 2020 10:45:14 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id m8so4080208pfh.3 for ; Thu, 27 Aug 2020 10:45:14 -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=bMV5QKFhnPr4rnfdTmWVCktqKgOz003QeE55g4bMuiI=; b=PyV5/yjEZGD14XCevc/7KQJACoatwoWNux8bC1xEe1kj/oRzYs+0p24POGq93MMdLW +Gz3HKISvz/0f/Os387ZDyXTJGP9q72jZfTv/6DyZ7cYdTy6Y9pasyE8T1yGfgrOlTBJ 4sVK3Ompzg35TfXgmh8iTUnbZ+vwNyVjAQqXVdu3B3tmgUmrBNVDepsURXvm4nw6NR9X sGZxlYK/wlf77ailauG4JU+5MjAk69I+gs8SOkBRYT3tTyzhli3vfAStbTEi8tQ8Hlyl hrvRZhCGRonl3e5AFqYWHWy9HTElQoY3jupQCdCIxPeeDg9A42A4D3oogrt2+0pAGkWB czdA== 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=bMV5QKFhnPr4rnfdTmWVCktqKgOz003QeE55g4bMuiI=; b=ctTRdhBykt1e4Z47CZ3xdVKRF6XquA5R2MOsLUOLLWBYwnOs4tx9xHstKbEZUtpLPU QXuTpLSy0Rn1wcsXzxmdHykb9eF2KdV3a20GMWjsjC901sT+qQcvGVKQwG+LftzC+JX2 glj1qgJlxp85SyZTD1GuV5Yfehz+cqte0QcELnhopj7NeNkz8YltvQyLDC8rO5/q52zj DOGxYSzsFg/Iz8NmbyYKnQ1wjTxEvUAygDBNV5n/Qtdx8p/mVfACKfC5ebYoUEi5RUwp e9wb7uUf27puli9o6vnte1diAUFRNyl6MQgkiMxPuwje+7o7Eddp2cXqZUKUne5ro9pV 1Lvg== X-Gm-Message-State: AOAM533c+d+MA8ge71UmIVcFbImpHK1WJD+hpXXMzpb91Ca/jPc/VqSo KyJ9cF6m7wlu+f15Hu56O47rq7+BO7QzJg== X-Google-Smtp-Source: ABdhPJwwlinIZujTtdgUPTrLbVBrKjhVd4XUXdFp4CvR5T0+inXEVMXVMXtp3cCSTjr0fBNaPA3k/Q== X-Received: by 2002:a62:63c6:: with SMTP id x189mr16878632pfb.216.1598550313164; Thu, 27 Aug 2020 10:45:13 -0700 (PDT) Received: from konoha.iballbatonwifi.com ([103.84.62.195]) by smtp.gmail.com with ESMTPSA id i20sm940847pfq.204.2020.08.27.10.45.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Aug 2020 10:45:12 -0700 (PDT) From: Shourya Shukla To: git@vger.kernel.org Cc: kaartic.sivaraam@gmail.com, christian.couder@gmail.com, gitster@pobox.com, Johannes.Schindelin@gmx.de, liu.denton@gmail.com, peff@peff.net, Shourya Shukla , Christian Couder Subject: [PATCH v2 1/3] submodule: eliminate unused parameters from print_submodule_summary() Date: Thu, 27 Aug 2020 23:14:59 +0530 Message-Id: <20200827174501.7103-2-shouryashukla.oo@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200827174501.7103-1-shouryashukla.oo@gmail.com> References: <20200827174501.7103-1-shouryashukla.oo@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Eliminate the parameters 'missing_{src,dst}' from the 'print_submodule_summary()' function call since they are not used anywhere in the function. Reported-by: Jeff King Mentored-by: Christian Couder Mentored-by: Kaartic Sivaraam Signed-off-by: Shourya Shukla --- builtin/submodule--helper.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index 63ea39025d..b83f840251 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -982,7 +982,6 @@ static char* verify_submodule_committish(const char *sm_path, static void print_submodule_summary(struct summary_cb *info, char* errmsg, int total_commits, const char *displaypath, const char *src_abbrev, const char *dst_abbrev, - int missing_src, int missing_dst, struct module_cb *p) { if (p->status == 'T') { @@ -1154,8 +1153,7 @@ static void generate_submodule_summary(struct summary_cb *info, print_submodule_summary(info, errmsg, total_commits, displaypath, src_abbrev, - dst_abbrev, missing_src, - missing_dst, p); + dst_abbrev, p); free(displaypath); free(src_abbrev); From patchwork Thu Aug 27 17:45:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shourya Shukla X-Patchwork-Id: 11741215 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 0A368739 for ; Thu, 27 Aug 2020 17:45:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DF1922087E for ; Thu, 27 Aug 2020 17:45:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="m9rEPrR6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726939AbgH0RpT (ORCPT ); Thu, 27 Aug 2020 13:45:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726153AbgH0RpS (ORCPT ); Thu, 27 Aug 2020 13:45:18 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9942C061264 for ; Thu, 27 Aug 2020 10:45:18 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id k18so4067871pfp.7 for ; Thu, 27 Aug 2020 10:45:18 -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=UFl0zxz/R/Z1d53jhb7yMVOit1YZcax8f1UC7bCCpmo=; b=m9rEPrR6P2guEbJcEXKGyrsk6vtD1AJghemDtDO/188gT9vJETMVDsfcyBYNPAjtPJ g6R6FMsuIqiwgfHjqGPqFC4a+5ZYUvBjIn28bfWVxUUCrbkR7MoaLVwkdt5ugeMTq0IC waDcoANqdfCxHdgHdflP1HgJeEvwqJy5pV6z5B5di/sF73oA/jKeSzOvh2NGnllLIQFQ qy/cbumLbV8T2QShbfzx63TZTTCKfiWEQcCWUna95NmuSeryjViBFUtxue245XzzsoNH TxlpFWsSxNdHLRWdFOgO33IUSspgaKj5O6akYEn52qHNU7FN5zpeAU/ezCfYT1gSwz3f VfIg== 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=UFl0zxz/R/Z1d53jhb7yMVOit1YZcax8f1UC7bCCpmo=; b=bhQEAehMvaDchqSzFR1dnfwHS4fC4svpELP7Eh0+IPGeZbVeFxytaNGkpCEC7ftIM1 lFP3WU21zZsxBMDtc/gfhkjfhqJBt5CHdY8Ad8JRYn76mFetma8BXRtTkddi/fWo8/l2 TvoW5gjCyRNCrSC/5i0g6TX7s4P0uRm34iF71oWv2AEfTwpGbtXCOj0HaBg7Wp5V0Iz5 Wd14Rbp6UO7QFSk58WTEwUBz6+OQmoTqE5y72bTAnWLvdN6BCqB7nOXL9acI9aLrbEzh wkcfBvq77I7eho8u0F7uyWqZldL/df7+AoxtUQKE5/wLdncByvn6c+nyqW/fDzvofJE6 HGlw== X-Gm-Message-State: AOAM531Dh5iQep8g2AJZwzBoi3Q6QZcSAMrcNMSvJsvgzFReATPuhFv5 LCjYI0DSQ2Pm1DE8qmjj7F7T5jWCAo5RtA== X-Google-Smtp-Source: ABdhPJz5KdMcKs86M6xy23JbTCrM2qfe50BzFnIBI6Q9AebktvyRpS3GZXPTYrE2q3dBzHz2vVw07w== X-Received: by 2002:aa7:8699:: with SMTP id d25mr9123588pfo.191.1598550317764; Thu, 27 Aug 2020 10:45:17 -0700 (PDT) Received: from konoha.iballbatonwifi.com ([103.84.62.195]) by smtp.gmail.com with ESMTPSA id i20sm940847pfq.204.2020.08.27.10.45.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Aug 2020 10:45:17 -0700 (PDT) From: Shourya Shukla To: git@vger.kernel.org Cc: kaartic.sivaraam@gmail.com, christian.couder@gmail.com, gitster@pobox.com, Johannes.Schindelin@gmx.de, liu.denton@gmail.com, peff@peff.net, Shourya Shukla , Christian Couder Subject: [PATCH v2 2/3] submodule: fix style in function definition Date: Thu, 27 Aug 2020 23:15:00 +0530 Message-Id: <20200827174501.7103-3-shouryashukla.oo@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200827174501.7103-1-shouryashukla.oo@gmail.com> References: <20200827174501.7103-1-shouryashukla.oo@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The definitions of 'verify_submodule_committish()' and 'print_submodule_summary()' had wrong styling in terms of the asterisk placement. Amend them. Also, the warning printed in case of an unexpected file mode printed the mode in decimal. Print it in octal for enhanced readability. Reported-by: Kaartic Sivaraam Mentored-by: Christian Couder Mentored-by: Kaartic Sivaraam Helped-by: Junio C Hamano Signed-off-by: Shourya Shukla --- builtin/submodule--helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index b83f840251..93d0700891 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -959,7 +959,7 @@ enum diff_cmd { DIFF_FILES }; -static char* verify_submodule_committish(const char *sm_path, +static char *verify_submodule_committish(const char *sm_path, const char *committish) { struct child_process cp_rev_parse = CHILD_PROCESS_INIT; @@ -979,7 +979,7 @@ static char* verify_submodule_committish(const char *sm_path, return strbuf_detach(&result, NULL); } -static void print_submodule_summary(struct summary_cb *info, char* errmsg, +static void print_submodule_summary(struct summary_cb *info, char *errmsg, int total_commits, const char *displaypath, const char *src_abbrev, const char *dst_abbrev, struct module_cb *p) @@ -1056,7 +1056,7 @@ static void generate_submodule_summary(struct summary_cb *info, } else { /* for a submodule removal (mode:0000000), don't warn */ if (p->mod_dst) - warning(_("unexpected mode %d\n"), p->mod_dst); + warning(_("unexpected mode %o\n"), p->mod_dst); } } From patchwork Thu Aug 27 17:45:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shourya Shukla X-Patchwork-Id: 11741217 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 50AB1739 for ; Thu, 27 Aug 2020 17:45:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 319932177B for ; Thu, 27 Aug 2020 17:45:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="j9Dup9hO" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726953AbgH0RpY (ORCPT ); Thu, 27 Aug 2020 13:45:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726153AbgH0RpX (ORCPT ); Thu, 27 Aug 2020 13:45:23 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91A43C061264 for ; Thu, 27 Aug 2020 10:45:23 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id g33so3880161pgb.4 for ; Thu, 27 Aug 2020 10:45:23 -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=vVvt+hb/ujMi3F93xkL3sQXrzYJs58NBbCJsnrtA2WM=; b=j9Dup9hOSz34bz/YTW/3T+gX/QikGNKDFiYZdSH75rWqISr9FR/BO+3NJPMxp6VkE2 COvd9dYqs042FqMZ+PynZtO7rwqAqC4Z6597tmBqdmUwRVafbTUBs7MKJkjwVQN7rCwz WjtXSpf5ci1WdbkEY7p01iPQhZn++ETnpG1NDsiTMZI+fVbCqlif4iLwVV2Bg6Ca5KfQ QJK3IcayMTvWOS8rU+5VzMMPOkuaUHJbxiKcfYe+BZGxy2U8hhpQ+pRArRuKGxPD99WK JKcejl7EIeQH5obyvJI+hN3mJk51iY91bo7mjC4g+VeG6sSfsdOMOiguDe2QdeUW0n5y FE5Q== 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=vVvt+hb/ujMi3F93xkL3sQXrzYJs58NBbCJsnrtA2WM=; b=gU4h4WeiVTa8Z3qHe7VZplxL92NcTEG1YlX5MHXgwHpQid9j+WXdbdJVKFPHsiJAvJ a4j58g+s7vRH/SgakLGYqLjS7ZVo/CC8B8vGdv5TSZGVO88Q/ZdA2Mg/TtBE25GvFoT/ sFlUm7YAp2kHnOqrEfxtUt6+7DboYLYphpmR1Qn4CS1M17rp1L7hyHJntvVCNgIBg5h2 d9hOyenc+t79LIhBqPhBcN05cjODsDAyv16LtnI5SUUvOdNNT1i68dX3Iobh2IqGxT4h v2BCPDwnXBBssTRp200PEiDHEEsuaWQtYFS51Nitrfl4pHdLgffT21J/LLi1KGwDUcDk 50YQ== X-Gm-Message-State: AOAM530Q5gTFvC9MNQ+WnVhkdcBAyVCA0In4haMtSB236yQ4yE6as9qS TjuwNk2Se+u1Cdpm1yHcDvV4i3Hx0CIvTg== X-Google-Smtp-Source: ABdhPJwB++b6Px7Ztb+Sv2ggHb8XG0by8uWBn25BZQERloQuzWihRwpHna01vaxUHI7zkLpH1y+s8Q== X-Received: by 2002:a17:902:b193:: with SMTP id s19mr17619319plr.194.1598550322398; Thu, 27 Aug 2020 10:45:22 -0700 (PDT) Received: from konoha.iballbatonwifi.com ([103.84.62.195]) by smtp.gmail.com with ESMTPSA id i20sm940847pfq.204.2020.08.27.10.45.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Aug 2020 10:45:21 -0700 (PDT) From: Shourya Shukla To: git@vger.kernel.org Cc: kaartic.sivaraam@gmail.com, christian.couder@gmail.com, gitster@pobox.com, Johannes.Schindelin@gmx.de, liu.denton@gmail.com, peff@peff.net, Shourya Shukla , Christian Couder Subject: [PATCH v2 3/3] t7421: eliminate 'grep' check in t7421.4 for mingw compatibility Date: Thu, 27 Aug 2020 23:15:01 +0530 Message-Id: <20200827174501.7103-4-shouryashukla.oo@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200827174501.7103-1-shouryashukla.oo@gmail.com> References: <20200827174501.7103-1-shouryashukla.oo@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The 'grep' check in test 4 of t7421 resulted in the failure of t7421 on Windows due to a different error message error: cannot spawn git: No such file or directory instead of fatal: exec 'rev-parse': cd to 'my-subm' failed: No such file or directory Tighten up the check to compute 'src_abbrev' by guarding the 'verify_submodule_committish()' call using `p->status !='D'`, so that the former isn't called in case of non-existent submodule directory, consequently, there is no such error message on any execution environment. The same need not be implemented for 'dst_abbrev' and is rather redundant since the conditional 'if (S_ISGITLINK(p->mod_dst))' already guards the 'verify_submodule_committish()' when we have a status of 'D'. Therefore, eliminate the 'grep' check in t7421. Instead, verify the absence of an error message by doing a 'test_must_be_empty' on the file containing the error. Reported-by: Johannes Schindelin Helped-by: Kaartic Sivaraam Mentored-by: Christian Couder Mentored-by: Kaartic Sivaraam Signed-off-by: Shourya Shukla --- builtin/submodule--helper.c | 7 ++++--- t/t7421-submodule-summary-add.sh | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index 93d0700891..1db1176e48 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -1035,7 +1035,7 @@ static void print_submodule_summary(struct summary_cb *info, char *errmsg, static void generate_submodule_summary(struct summary_cb *info, struct module_cb *p) { - char *displaypath, *src_abbrev, *dst_abbrev; + char *displaypath, *src_abbrev = NULL, *dst_abbrev; int missing_src = 0, missing_dst = 0; char *errmsg = NULL; int total_commits = -1; @@ -1061,8 +1061,9 @@ static void generate_submodule_summary(struct summary_cb *info, } if (S_ISGITLINK(p->mod_src)) { - src_abbrev = verify_submodule_committish(p->sm_path, - oid_to_hex(&p->oid_src)); + if (p->status != 'D') + src_abbrev = verify_submodule_committish(p->sm_path, + oid_to_hex(&p->oid_src)); if (!src_abbrev) { missing_src = 1; /* diff --git a/t/t7421-submodule-summary-add.sh b/t/t7421-submodule-summary-add.sh index 59a9b00467..b070f13714 100755 --- a/t/t7421-submodule-summary-add.sh +++ b/t/t7421-submodule-summary-add.sh @@ -58,7 +58,7 @@ test_expect_success 'submodule summary output for submodules with changed paths' git commit -m "change submodule path" && rev=$(git -C sm rev-parse --short HEAD^) && git submodule summary HEAD^^ -- my-subm >actual 2>err && - grep "fatal:.*my-subm" err && + test_must_be_empty err && cat >expected <<-EOF && * my-subm ${rev}...0000000: