From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 353411FA12 for ; Sat, 8 May 2021 00:13:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230252AbhEHAJ2 (ORCPT ); Fri, 7 May 2021 20:09:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230213AbhEHAJ0 (ORCPT ); Fri, 7 May 2021 20:09:26 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59D3AC061761 for ; Fri, 7 May 2021 17:08:24 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id b11-20020a7bc24b0000b0290148da0694ffso8020983wmj.2 for ; Fri, 07 May 2021 17:08:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=/8i2rA0Y8K4hQ70lLLGfR6UfKhpltRjIYWd7MBEBp4s=; b=L7gHS39+PKt6gtqfuReVNx5w76hv986Ui+QnrLAuxCJGQBPb70jaYr2bshKnSGjX82 4hXQv/qbl2wbrfCvzVOKRJc2lN3QQirONWYI8d5YrIEDMMsRwLDVBib/HV1iT6VGi+Lq rb0GL2jTgzVXkbof+VcVadH8OQiMTMYL4wDpaTDH7t/mayFDzo7cocBhRKI47QmQiIle CHzPZ2Lgd1v8FJSg9jGreUxMiy8vbz5wVTdB4m7PkjhEa1e54GnH+oq2nuj0UFZ7yNg1 eVaoRvGtqpa4hKLXcrWj2/7KDI4RneMprWYmUIlaUh5PU6pMWhLGzdjRv2qPXleBVzji vQ/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=/8i2rA0Y8K4hQ70lLLGfR6UfKhpltRjIYWd7MBEBp4s=; b=B7751tGeUljFkgjwkd4o8UrbiIJJYJxbaobFnStqgN49EnYkO3vqFZvLS63wUof395 7icpjBQ9ZLfDnAi2yaSCu+DMiMN30HCbZ9EuMm8KT5bB5PUll1Vsq1agyT/q7RqY7RD6 IYiu9S3N869FOsUYwIa0HUK3xrOPVpidIjEZnn+pU57wAVS1xIEjTmLM6MqvZw4CVcub /DMC6McN7IZliPd89OocX6bzcFZaSpH1BLPHInXpNhxOaegt6ueOa+GDA++Z/aMcEHEh HKHS2NYX7G3Tnnp6OHYzrre7YQT1VlJydJdhU9+SqrzW2CP3UsgfgZmXR7ARtwMrpVao yJCQ== X-Gm-Message-State: AOAM530y9aGndInYnIURwDdb0K7ztxVCTOmZaaNOQcRB/hNWXQvXKn+f ijCHkdQTnQd4TuaJAKik5KqcOU90fgE= X-Google-Smtp-Source: ABdhPJwzWYI4QK2pJByx03UzgT/5jbsNl5HM0tfjte2Ld83a+/ZSzQVUZOIE7YULK7z78PZt1AZQzw== X-Received: by 2002:a05:600c:4f93:: with SMTP id n19mr9219656wmq.100.1620432503133; Fri, 07 May 2021 17:08:23 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id v20sm8666679wmj.15.2021.05.07.17.08.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 May 2021 17:08:22 -0700 (PDT) Message-Id: In-Reply-To: References: From: "Elijah Newren via GitGitGadget" Date: Sat, 08 May 2021 00:08:14 +0000 Subject: [PATCH v2 2/8] t3001, t7300: add testcase showcasing missed directory traversal Fcc: Sent Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MIME-Version: 1.0 To: git@vger.kernel.org Cc: Eric Sunshine , Elijah Newren , Derrick Stolee , Jeff King , Elijah Newren , Elijah Newren Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Elijah Newren In the last commit, we added a testcase showing that the directory traversal machinery sometimes traverses into directories unnecessarily. Here we show that there are cases where it does the opposite: it does not traverse into directories, despite those directories having important files that need to be flagged. Add a testcase showing that `git ls-files -o -i --directory` can omit some of the files it should be listing, and another showing that `git clean -fX` can fail to clean out some of the expected files. Signed-off-by: Elijah Newren --- t/t3001-ls-files-others-exclude.sh | 5 +++++ t/t7300-clean.sh | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/t/t3001-ls-files-others-exclude.sh b/t/t3001-ls-files-others-exclude.sh index 1ec7cb57c7a8..ac05d1a17931 100755 --- a/t/t3001-ls-files-others-exclude.sh +++ b/t/t3001-ls-files-others-exclude.sh @@ -292,6 +292,11 @@ EOF test_cmp expect actual ' +test_expect_failure 'ls-files with "**" patterns and --directory' ' + # Expectation same as previous test + git ls-files --directory -o -i --exclude "**/a.1" >actual && + test_cmp expect actual +' test_expect_success 'ls-files with "**" patterns and no slashes' ' git ls-files -o -i --exclude "one**a.1" >actual && diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh index 5f1dc397c11e..337f9af1d74b 100755 --- a/t/t7300-clean.sh +++ b/t/t7300-clean.sh @@ -786,4 +786,23 @@ test_expect_failure 'avoid traversing into ignored directories' ' ) ' +test_expect_failure 'traverse into directories that may have ignored entries' ' + test_when_finished rm -f output && + test_create_repo need-to-traverse-into-hierarchy && + ( + cd need-to-traverse-into-hierarchy && + mkdir -p modules/foobar/src/generated && + > modules/foobar/src/generated/code.c && + > modules/foobar/Makefile && + echo "/modules/**/src/generated/" >.gitignore && + + git clean -fX modules/foobar >../output && + + grep Removing ../output && + + test_path_is_missing modules/foobar/src/generated/code.c && + test_path_is_file modules/foobar/Makefile + ) +' + test_done -- gitgitgadget