From patchwork Tue Aug 25 11:30:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shourya Shukla X-Patchwork-Id: 11735577 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 DF8E8138A for ; Tue, 25 Aug 2020 11:31:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C3C7B2075B for ; Tue, 25 Aug 2020 11:31:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NTGJh7vH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730035AbgHYLbN (ORCPT ); Tue, 25 Aug 2020 07:31:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730018AbgHYLax (ORCPT ); Tue, 25 Aug 2020 07:30:53 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2E45C061755 for ; Tue, 25 Aug 2020 04:30:46 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id o13so6640185pgf.0 for ; Tue, 25 Aug 2020 04:30:46 -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=NTGJh7vHKCOTGRnBR0diZzMk5vKyDvQTWuOiMvkdH7Zc/oSqd/H30i7LpPfhs9BfUI 88Tg4ONtJ0I9KvLocAX48xZStjtmLVoC30alYAL3Lx1Tes1FY/xBt0gLZkMr8i5+Bskv jJMrw92QWIWWxiO21QWGZbYETY3+shQJ98nc1qIVm9MUKoLXXyO/v1qabQ9FViwGRg9N /Nn/uCK8/SjbcPEhd0ycXTlQ0zALpysAtL+32WK+rbByvPwtTwpmyQpr1aGWR3FaXGmK T9C7vqP7dkwOpXAlwcACT4BBBJHdUvZPs5ZgqW++PfACe9WsDOdlnS1cLg7/WLmzvOQZ 0Edg== 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=ERGOQZdToItpz69FeW5wTpQg5kimoFGbstRTopPa+Ait6sFD3wxecFqWTmVq2McEFs cevMZ2YDdf6hHyYmK3yVP9HWx//6hLYxyBnOTcRxpXUG/qbF7sTvspIc+mGeJwv4vMGH Y/5fCN7zhnQpRW2s97KuenQ4ZSvk722FQ93fYuTQD3jY+0+CkvYIFKLmn1OpSG6Y/ADo N1VaUoNoj3Nt0qaIwOM1yliMTWuhbqFhCQunc0O5QgBzEwFkZPh3pq7UOwTKN+FinfEb 0oQ6HKA3BbONCdYFqAoMBIzztfwZcJAs7fCwlk2zBzCmptWzPyAmJCVTq7pPu5xL3WPw N56A== X-Gm-Message-State: AOAM531wlRtJfj+lSgjlyAMD3sgj2sS4pBPmSa/WADDPamKDX3G/zlrm IZjONPg65ENhEPCK0Lo6m2w4RMM2ry0XZQ== X-Google-Smtp-Source: ABdhPJw454k2A+jAYCw6nzazoRTjT2+qwg8d9+IJ5H1nBfzG9b0uSvXv2rkztdXhHefoXJi0xv8HoA== X-Received: by 2002:a62:1616:: with SMTP id 22mr7607331pfw.207.1598355045932; Tue, 25 Aug 2020 04:30:45 -0700 (PDT) Received: from localhost.localdomain ([115.97.133.243]) by smtp.gmail.com with ESMTPSA id y3sm2821518pjg.8.2020.08.25.04.30.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Aug 2020 04:30:45 -0700 (PDT) From: Shourya Shukla To: git@vger.kernel.org Cc: gitster@pobox.com, christian.couder@gmail.com, kaartic.sivaraam@gmail.com, Johannes.Schindelin@gmx.de, peff@peff.net, liu.denton@gmail.com, Shourya Shukla , Christian Couder Subject: [PATCH 1/3] submodule: eliminate unused parameters from print_submodule_summary() Date: Tue, 25 Aug 2020 17:00:18 +0530 Message-Id: <20200825113020.71801-2-shouryashukla.oo@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200825113020.71801-1-shouryashukla.oo@gmail.com> References: <20200825113020.71801-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 Tue Aug 25 11:30:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shourya Shukla X-Patchwork-Id: 11735573 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 92FCF109B for ; Tue, 25 Aug 2020 11:31:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 779092075B for ; Tue, 25 Aug 2020 11:31:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GEV2CmKM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730034AbgHYLbJ (ORCPT ); Tue, 25 Aug 2020 07:31:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729914AbgHYLax (ORCPT ); Tue, 25 Aug 2020 07:30:53 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35CF9C061574 for ; Tue, 25 Aug 2020 04:30:51 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id v15so6623313pgh.6 for ; Tue, 25 Aug 2020 04:30:51 -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=GEV2CmKMt0VTeZTp5NX4yxLvPW5QrJ9284mxn3kSX9GNUHOARW775rdyJ6t/ZBQjMA JW+DITog3lf2QnslO8XUZGxil5sAC0iondRo8hR4AkoSXtyYPorQ4rYG8FX47vLs5wPp xWV2BxwESHaUqa4nU70zk1Z5q54ApVjnxmLb8yWY7Fyn87UVUq5tPILpjkaf0sWrqz6N I5h6KvAF5lffPIeDMg33Wj4Vx/+Mgx3FeLU9y25kYsWZMJqMzOJYBf20RBYuHmeA7V7W ntuX7D2bpSgTgsbCDMgoBnOqOSxlsydjtKmN+OxPkt9j7kholC5zv0eZFhmJ8x/MHo9s Iz6w== 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=KRNri6anUy9TNJJUyjgUoxQRTknA18Va13uMjj9KN/6Z+PRc3jw7HDpbt0M+CxA2jk tb5dzV+umaebDubzQQdSaoJ0ukbX9Sqzz5In8loYEBjTjVg98NK3n2r8SFDos6cnP9d4 dbtX0Cd7Ur49U+dM8oDbFNh6U+MV1YhCBiY3UwLArA9NLjqo43O3XGplIREkKtHEWN79 3Sib/snJCKuVCDe3uGG9udMf7a8J8lXpuox5CxN3BczXrJ28D4p8J9UyyTCt1R3YYOPy kKqrfjNLy678MqCXtkjlQivIhC/jjTA2sb6WKbIV0csxC2OJOn0qqg4wI3rCm1E+4W3f TdcQ== X-Gm-Message-State: AOAM530bwk/SQuOK3zdnwqBxelrMrBsKMiId0fMCHIA5bfyshm1m4/vl zvpKJaCa3keryIvA8SvlUNN5x7cimuDZ9Q== X-Google-Smtp-Source: ABdhPJwSDEZ2ofMSdBkdNbhHWJ7EqV1hjObOMphQ7RuvNB0gU8aoG7Fy7oQ2cg+vHUGPKRJc665V5Q== X-Received: by 2002:a17:902:c3d3:: with SMTP id j19mr7220429plj.15.1598355050266; Tue, 25 Aug 2020 04:30:50 -0700 (PDT) Received: from localhost.localdomain ([115.97.133.243]) by smtp.gmail.com with ESMTPSA id y3sm2821518pjg.8.2020.08.25.04.30.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Aug 2020 04:30:49 -0700 (PDT) From: Shourya Shukla To: git@vger.kernel.org Cc: gitster@pobox.com, christian.couder@gmail.com, kaartic.sivaraam@gmail.com, Johannes.Schindelin@gmx.de, peff@peff.net, liu.denton@gmail.com, Shourya Shukla , Christian Couder Subject: [PATCH 2/3] submodule: fix style in function definition Date: Tue, 25 Aug 2020 17:00:19 +0530 Message-Id: <20200825113020.71801-3-shouryashukla.oo@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200825113020.71801-1-shouryashukla.oo@gmail.com> References: <20200825113020.71801-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 Tue Aug 25 11:30:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shourya Shukla X-Patchwork-Id: 11735579 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 4825B109B for ; Tue, 25 Aug 2020 11:31:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2C7D72068E for ; Tue, 25 Aug 2020 11:31:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JomRkJw/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730013AbgHYLbd (ORCPT ); Tue, 25 Aug 2020 07:31:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730028AbgHYLaz (ORCPT ); Tue, 25 Aug 2020 07:30:55 -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 74371C061756 for ; Tue, 25 Aug 2020 04:30:55 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id x25so7114743pff.4 for ; Tue, 25 Aug 2020 04:30:55 -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=sgunsanhPjvfQJDw4981MBRNATbWvlj8DjXzfTzsxmU=; b=JomRkJw/YiCOufFpjmEglTZZwO/aPJD6whyqtI8hKNOjJ2oOytGxzpYfcxfsWPYtY9 b5+20HfuGEC03puXdemLuIaKOS0k3FqZpyykl2RBbKi/KMLygxN4Uy7vTpK6mnKr2XZB dymbBFnZ4oiSBVfIY/BGny4+5xe4sD5NDeZFygHuS0ECyhrWN8aInrDRL6ErgIE2y6nO 3yaFyngXnSauaYb3Rx4bfJkmT/W0lvtdxzCIHuEp63hEN3y/7WWU1xUef5vMOQhoZq6E BcaQjglOJfxp4IsaxHSnQLCeM94dlaYusYQqIHDgHCMW77ivDwA1z0wGi7IMDSbwRxY9 CusA== 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=sgunsanhPjvfQJDw4981MBRNATbWvlj8DjXzfTzsxmU=; b=lUPajlmC60DY/l2dIYOEeYNp6X3k27uexSAwOfktAmrn2CdZlA6K/6FNLknZAmExBR LTLLK+eKyhpJ5FR/bXat1wADF6FWMyGo8nlip09audLSyAQz/wWu0hJDpxvq4GhGKkz1 5ijEmqfvZsYr9gC5c0VHcGYf1HfcCQkOoXT7PVP9dkv3RhkvY2bsjRKK4bpbufZOKDmT Suh1vNxf4Eom0TK/bI0fs4vgOMdW+oHOTpS8UT74dEpVrJvAfrx8miPl8whF7GG+60Wb 5JHpwe1pRFQxkgoAiaqLTnr5owSMNTRBLcGv9VgQKPnlX50UJZfhODOCiQnIicOPaFAu N2gw== X-Gm-Message-State: AOAM5337fnAQeiaQLBDlb0rAcuglLpRuY/DOPU8AGVQ82SAFXXzvDc36 AQjl5oFMG+kfwn09oiryQYznW6sq2ph/Lg== X-Google-Smtp-Source: ABdhPJwD0Wd8XVf+aYeJL90G14nGnm5h7R+V/jY2N4SIMTdfPUX5ZEV6R7ajo5HSQ5Ic1EvoWWQAGg== X-Received: by 2002:aa7:982e:: with SMTP id q14mr7649021pfl.299.1598355054483; Tue, 25 Aug 2020 04:30:54 -0700 (PDT) Received: from localhost.localdomain ([115.97.133.243]) by smtp.gmail.com with ESMTPSA id y3sm2821518pjg.8.2020.08.25.04.30.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Aug 2020 04:30:53 -0700 (PDT) From: Shourya Shukla To: git@vger.kernel.org Cc: gitster@pobox.com, christian.couder@gmail.com, kaartic.sivaraam@gmail.com, Johannes.Schindelin@gmx.de, peff@peff.net, liu.denton@gmail.com, Shourya Shukla , Christian Couder Subject: [PATCH 3/3] t7421: eliminate 'grep' check in t7421.4 for mingw compatibility Date: Tue, 25 Aug 2020 17:00:20 +0530 Message-Id: <20200825113020.71801-4-shouryashukla.oo@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200825113020.71801-1-shouryashukla.oo@gmail.com> References: <20200825113020.71801-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,dst}_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. 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..f1951680f7 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 = NULL; 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: