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.7 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,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 630C31F934 for ; Tue, 13 Apr 2021 14:03:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237908AbhDMOCb (ORCPT ); Tue, 13 Apr 2021 10:02:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237548AbhDMOCH (ORCPT ); Tue, 13 Apr 2021 10:02:07 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 196B6C06138F for ; Tue, 13 Apr 2021 07:01:47 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id y20-20020a1c4b140000b029011f294095d3so10740223wma.3 for ; Tue, 13 Apr 2021 07:01:46 -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=KGRjbi4uVmoUD8RSU3rrrD/0eMwup9huQ9SZfnCO0NI=; b=lVlbP1rYJUmsvuM/pruoyICbrCbc1W385IgvmRScyjArDnAToiYOhuAUqBNuiZIqqT uuixrLgVDmCkHmAzAG+gIiI+mJoyeYMW0tZ6FD2NTu6/rEebVQInrGXU3zrV/BWpZ3ju vcuZQ4+ZOBaFQWXI6j8WdF/ugIf0EbtcsYsBM1jetb7p57eQJCSZ7ELc8S1wSZTFLGHQ iPA2DB0NtmkosHFZMIItPsSP/5B5c7ZgXVUptYzNeBvJ+8rgApxdWhj96k3Ys38ilt7G DcAWVPQdcrtSHmZox+nFwxwDzafAU4WIAMKEj5INLkr7M9nja4StvBcSBv+3Oq22XpKe QwNA== 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=KGRjbi4uVmoUD8RSU3rrrD/0eMwup9huQ9SZfnCO0NI=; b=O4fkTgrIjA9me8MKVMgBue9NmXvKHMDVF0AwMYLnqy4RLtI/AI2YN+DFqfWKc0v6jC rqG4Iro3AcDIs82BqioNsTycttRU1PRl609ZQQsnAekCtOxs8UfHQ1mXB+FVcjRl0Dpq TYrM84OulzalyOtb/jx7f7ftPDFBa5A+7qPRW4e/nR1tp/Ahm1+1x7uk6JGbb8PDIdvh XbhhSZLfOJjKg8M3iXrdVi1VZssMh3v/b1/t4WjgL1e9E3tNjd90KBo/NzrinUrLVif4 3gQ/lmhMSopcKycf90M8U0sOzKk2YxFv68BER6M9ZMnS12VUtBU8EEKdNWsi5K7M8g63 0UVQ== X-Gm-Message-State: AOAM531D9WwPvYKIPPXX6R8rrUX3EihYGcMTm/5RtNl+Mt/tA9GrTtse YbeB4CPjwQvHois3+maJRra3ezPfKrQ= X-Google-Smtp-Source: ABdhPJzw6pp2RiTtoI2Ojzc9k4zIPoELpMIsy7nZJZeExAZuHcWenOTZrUOXcCD/NOhzlMnE1ospUA== X-Received: by 2002:a7b:c303:: with SMTP id k3mr173288wmj.100.1618322505816; Tue, 13 Apr 2021 07:01:45 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id a15sm20190174wrr.53.2021.04.13.07.01.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Apr 2021 07:01:45 -0700 (PDT) Message-Id: <9d1183ddd280b1e9a580dcbfe9761ceec8d0bc80.1618322498.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Derrick Stolee via GitGitGadget" Date: Tue, 13 Apr 2021 14:01:37 +0000 Subject: [PATCH 10/10] fsmonitor: test with sparse index Fcc: Sent Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MIME-Version: 1.0 To: git@vger.kernel.org Cc: gitster@pobox.com, newren@gmail.com, Derrick Stolee , Derrick Stolee Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Derrick Stolee During the effort to protect uses of the index to operate on a full index, we did not modify fsmonitor.c. This is because it already works effectively with only the change to index_name_stage_pos(). The only thing left to do is to test that it works correctly. These tests are added to demonstrate that the behavior is the same across a full index and a sparse index, but also that file modifications to a tracked directory outside of the sparse cone will trigger ensure_full_index(). Signed-off-by: Derrick Stolee --- t/t7519-status-fsmonitor.sh | 48 +++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/t/t7519-status-fsmonitor.sh b/t/t7519-status-fsmonitor.sh index 23879d967297..306157d48abf 100755 --- a/t/t7519-status-fsmonitor.sh +++ b/t/t7519-status-fsmonitor.sh @@ -78,6 +78,7 @@ test_expect_success 'setup' ' expect* actual* marker* + trace2* EOF ' @@ -400,4 +401,51 @@ test_expect_success 'status succeeds after staging/unstaging' ' ) ' +test_expect_success 'status succeeds with sparse index' ' + test_config core.fsmonitor "$TEST_DIRECTORY/t7519/fsmonitor-all" && + git status --porcelain=v2 >expect && + git sparse-checkout init --cone --sparse-index && + GIT_TRACE2_EVENT="$(pwd)/trace2.txt" GIT_TRACE2_EVENT_NESTING=10 \ + git status --porcelain=v2 >actual && + test_region ! index ensure_full_index trace2.txt && + test_cmp expect actual && + rm trace2.txt && + + write_script .git/hooks/fsmonitor-test<<-\EOF && + printf "last_update_token\0" + EOF + git config core.fsmonitor .git/hooks/fsmonitor-test && + git status --porcelain=v2 >expect && + git sparse-checkout init --cone --sparse-index && + GIT_TRACE2_EVENT="$(pwd)/trace2.txt" GIT_TRACE2_EVENT_NESTING=10 \ + git status --porcelain=v2 >actual && + test_region ! index ensure_full_index trace2.txt && + test_cmp expect actual && + rm trace2.txt && + + write_script .git/hooks/fsmonitor-test<<-\EOF && + printf "last_update_token\0" + printf "dir1/modified\0" + EOF + git config core.fsmonitor .git/hooks/fsmonitor-test && + git status --porcelain=v2 >expect && + git sparse-checkout init --cone --sparse-index && + GIT_TRACE2_EVENT="$(pwd)/trace2.txt" GIT_TRACE2_EVENT_NESTING=10 \ + git status --porcelain=v2 >actual && + test_region ! index ensure_full_index trace2.txt && + test_cmp expect actual && + + write_script .git/hooks/fsmonitor-test<<-\EOF && + printf "last_update_token\0" + printf "dir1a/modified\0" + EOF + git config core.fsmonitor .git/hooks/fsmonitor-test && + git status --porcelain=v2 >expect && + git sparse-checkout init --cone --sparse-index && + GIT_TRACE2_EVENT="$(pwd)/trace2.txt" GIT_TRACE2_EVENT_NESTING=10 \ + git status --porcelain=v2 >actual && + test_region index ensure_full_index trace2.txt && + test_cmp expect actual +' + test_done -- gitgitgadget