From patchwork Sun Feb 17 16:34:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Randall S. Becker" X-Patchwork-Id: 10817167 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9A80E13A4 for ; Sun, 17 Feb 2019 16:35:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7BDF92A173 for ; Sun, 17 Feb 2019 16:35:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D1762A21A; Sun, 17 Feb 2019 16:35:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 36BC02A173 for ; Sun, 17 Feb 2019 16:35:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726523AbfBQQfS (ORCPT ); Sun, 17 Feb 2019 11:35:18 -0500 Received: from sonic314-22.consmr.mail.gq1.yahoo.com ([98.137.69.85]:45670 "EHLO sonic314-22.consmr.mail.gq1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725810AbfBQQfS (ORCPT ); Sun, 17 Feb 2019 11:35:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rogers.com; s=s2048; t=1550421317; bh=6YJsMn8fFRg2CpbhG2LvSj2wEnyFMStq0MjWxtlauZE=; h=From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ZmGuKKsUqW8qgMAWJHSKqOzes92NQGWkA5kbnpQ34TKNKLZmIcfSAfpTThctKFi TC2xgWu4tVDFqSa9ueLHLEs.XttXiZ8vb2KEoyUFwYQMfSbpZHjuQJgPUgrRS5LGNu4AJyYulh44 Wun_6Y3Mzkr7xO36snezjz1IAg2z7sT_42qH1PfAJSqYsI6DHatP40xhsmtVL34PgQZbHOOZ9CUw EEI9oyCEaxjAC7tl4xGjT4JausGhsaN3plBQTZ44JIfijSvADTOvHv0b_gLuLLtWiyflMJ4j0ToJ jhpAvHWCJcMOroKGxj2gdj9oRybefpXQcrOi5Gan_JmZ9DJsNeeiHF0t44DpgIpuYGapRzmFrpgO CHnA8W6_aVXAdVMqPnuRcQXmKdI6Igmb9c48p.w2EwSEzcBSj.sDmt7BfY_QWS77qUrocprb6YT0 Pu0fhM2K8 Received: from sonic.gate.mail.ne1.yahoo.com by sonic314.consmr.mail.gq1.yahoo.com with HTTP; Sun, 17 Feb 2019 16:35:17 +0000 Received: from CPE00fc8d49d843-CM00fc8d49d840.cpe.net.cable.rogers.com (EHLO localhost.localdomain) ([99.229.179.249]) by smtp420.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 7960f73deeeca8569531203623bec831; Sun, 17 Feb 2019 16:35:12 +0000 (UTC) From: randall.s.becker@rogers.com To: git@vger.kernel.org Cc: "Randall S. Becker" Subject: [Fix v1] builtin/ls-files.c: add error check on lstat for modified files Date: Sun, 17 Feb 2019 11:34:56 -0500 Message-Id: <20190217163456.17560-1-randall.s.becker@rogers.com> X-Mailer: git-send-email 2.12.3 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Randall S. Becker" The result from lstat, checking whether a file has been deleted, is now included priot to calling id_modified when showing modified files. Prior to this fix, it is possible that files that were deleted could show up as being modified because the lstat error was unchecked. Reported-by: Joe Ranieri Signed-off-by: Randall S. Becker --- builtin/ls-files.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/ls-files.c b/builtin/ls-files.c index 29a8762d4..fc21f4795 100644 --- a/builtin/ls-files.c +++ b/builtin/ls-files.c @@ -348,7 +348,7 @@ static void show_files(struct repository *repo, struct dir_struct *dir) err = lstat(fullname.buf, &st); if (show_deleted && err) show_ce(repo, dir, ce, fullname.buf, tag_removed); - if (show_modified && ie_modified(repo->index, ce, &st, 0)) + if (show_modified && !err && ie_modified(repo->index, ce, &st, 0)) show_ce(repo, dir, ce, fullname.buf, tag_modified); } }