From patchwork Thu Jun 16 13:13:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derrick Stolee X-Patchwork-Id: 12883844 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39221C43334 for ; Thu, 16 Jun 2022 13:13:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243496AbiFPNN6 (ORCPT ); Thu, 16 Jun 2022 09:13:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376939AbiFPNN4 (ORCPT ); Thu, 16 Jun 2022 09:13:56 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9240F39823 for ; Thu, 16 Jun 2022 06:13:54 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id m24so1824529wrb.10 for ; Thu, 16 Jun 2022 06:13:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=p5sZ8hT8FGCpW/GaA1xtofbxjAqwFVL/fvpzcF8QyJw=; b=FERzoFfz/dqO9h00gFP6+ElvliY/Q5AtGUk4PM4MpiXHjbd/zxfuIXvr3+lLHnmNzr 2Ar2ZSjDm2H453SLym7nhNGepDSLlRgsFoLDN21J44EybMwNnfwKT5j9ZeLTq8zoRMP2 DbPBxnQ3/OFPjH3SD2BwwxRMuggkww8mJAyQ4X7v2hD3zeUmSU6m87UcIosAAhjAcnpP dGxLTNFMg5yiXMlBva3y9jrAHNq1CYFOgD2vUVXBHJd6Mhq3jc0DRps0slmB/dMfQS/X a1Vsgy+qMDpw/cQ2JxSXOVd9zS//I7y7Twn0Phl4jvbEQLC+xfQNLUXLI7qtEBktvrZB L2Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=p5sZ8hT8FGCpW/GaA1xtofbxjAqwFVL/fvpzcF8QyJw=; b=4W4CSWDipbxIvjgHwTOkLZR85IENdmEGfGm57H1Cq7WrdCDXG/EQWN0QBq/VWQcu5b ayLM9Zbvz0Ih0c/hInwYSv/uwiWRedOx50MrcvCsmn5XF5gEQTbBIkQhwXnN0yLcs7ey C9SNGOdRKY9RazGhGU6IXlG2aGSWaJBNKQLHQWEDPehrFphIifA1EYEROvOWg7LynQOO E+JwtdOcZwBRJy1rqQ+VcSa03gFNshwIJwO6lSkZP7VcOHbCL0OSjhZDYk5rzVEtDl9W gx1A5cCJjms6Ux2OeHA4S20ODGQxXt2Z/7I/Qy3LqSN0uB9ixB/0FD9fbmz60k6vbhvV l//Q== X-Gm-Message-State: AJIora+qAadRJCcW5LAzH5QzA/Ufing8uxg1a9Jc06odVM+ExW0e58Vu PUe/Kmkny0o5j4OJBtEQT4r5mH/IjBLL5A== X-Google-Smtp-Source: AGRyM1vPY5TTloLR33jogtKMiJAsfnTLTdXGliIvVJfrIamrBLWBY1CwmFIvft0vToX9ZySxhk1UKA== X-Received: by 2002:a5d:6c66:0:b0:218:4ccd:16f2 with SMTP id r6-20020a5d6c66000000b002184ccd16f2mr4652117wrz.588.1655385232710; Thu, 16 Jun 2022 06:13:52 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id h20-20020a05600c351400b00397342bcfb7sm2471670wmq.46.2022.06.16.06.13.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jun 2022 06:13:51 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Thu, 16 Jun 2022 13:13:47 +0000 Subject: [PATCH v2 1/4] t2107: test 'git update-index --verbose' Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: gitster@pobox.com, me@ttaylorr.com, Eric Sunshine , Derrick Stolee , Derrick Stolee Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Derrick Stolee From: Derrick Stolee The '--verbose' option reports what is being added and removed from the index, but has not been tested up to this point. Augment the tests in t2107 to check the '--verbose' option in some scenarios. Signed-off-by: Derrick Stolee --- t/t2107-update-index-basic.sh | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/t/t2107-update-index-basic.sh b/t/t2107-update-index-basic.sh index a30b7ca6bc9..07e6de84e6d 100755 --- a/t/t2107-update-index-basic.sh +++ b/t/t2107-update-index-basic.sh @@ -36,9 +36,14 @@ test_expect_success '--cacheinfo does not accept blob null sha1' ' echo content >file && git add file && git rev-parse :file >expect && - test_must_fail git update-index --cacheinfo 100644 $ZERO_OID file && + test_must_fail git update-index --verbose --cacheinfo 100644 $ZERO_OID file >out && git rev-parse :file >actual && - test_cmp expect actual + test_cmp expect actual && + + cat >expect <<-\EOF && + add '\''file'\'' + EOF + test_cmp expect out ' test_expect_success '--cacheinfo does not accept gitlink null sha1' ' @@ -59,9 +64,14 @@ test_expect_success '--cacheinfo mode,sha1,path (new syntax)' ' git rev-parse :file >actual && test_cmp expect actual && - git update-index --add --cacheinfo "100644,$(cat expect),elif" && + git update-index --add --verbose --cacheinfo "100644,$(cat expect),elif" >out && git rev-parse :elif >actual && - test_cmp expect actual + test_cmp expect actual && + + cat >expect <<-\EOF && + add '\''elif'\'' + EOF + test_cmp expect out ' test_expect_success '.lock files cleaned up' ' @@ -74,7 +84,8 @@ test_expect_success '.lock files cleaned up' ' git config core.worktree ../../worktree && # --refresh triggers late setup_work_tree, # active_cache_changed is zero, rollback_lock_file fails - git update-index --refresh && + git update-index --refresh --verbose >out && + test_must_be_empty out && ! test -f .git/index.lock ) ' @@ -83,7 +94,15 @@ test_expect_success '--chmod=+x and chmod=-x in the same argument list' ' >A && >B && git add A B && - git update-index --chmod=+x A --chmod=-x B && + git update-index --verbose --chmod=+x A --chmod=-x B >out && + cat >expect <<-\EOF && + add '\''A'\'' + chmod +x '\''A'\'' + add '\''B'\'' + chmod -x '\''B'\'' + EOF + test_cmp expect out && + cat >expect <<-EOF && 100755 $EMPTY_BLOB 0 A 100644 $EMPTY_BLOB 0 B From patchwork Thu Jun 16 13:13:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derrick Stolee X-Patchwork-Id: 12883846 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6AFA1C43334 for ; Thu, 16 Jun 2022 13:14:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376960AbiFPNOB (ORCPT ); Thu, 16 Jun 2022 09:14:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376906AbiFPNN6 (ORCPT ); Thu, 16 Jun 2022 09:13:58 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CDC33584D for ; Thu, 16 Jun 2022 06:13:55 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id o8so1849999wro.3 for ; Thu, 16 Jun 2022 06:13:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=CroZ7wVEHD5BnTdKaPi1CT8nA1TvimJ9eubRklrt+3Y=; b=OAcRHrzGk0DJZryYw6PCpzNqq9YmdF1YgHU/Fd7X2foVtNcrPiuWAyd7oAMEgPU/Im D+kwLBlesMOJSlb6Ck40fhW1QLTzAmwVUdMfD3RYJymenrBDc0Y9+iYVKtguR7Q82ZFc Q536WLlgfVYWXsH/7heEMG3Ag8uoyuvry9TMQhMTFwvM0usTq52BVAgb5usIYOPz+HNV DQC3kFBz0MRK4+8yTTVSwN7Dkvc6XN95ahrtkZLCNkuHxMtlyq8acbcaXIUb7Ff13jNp JTwF94vbsw4OR5z5s4RjYEQrdx4JM/6vO9v2FtTOwOtRcpeT3PAwqFqFzPs3q16NT236 v1Ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=CroZ7wVEHD5BnTdKaPi1CT8nA1TvimJ9eubRklrt+3Y=; b=XT6KBLfDWvdTvxC3o0uu9DW9OIe4z3dutC39KfWqeXse8UEvUpE1lVu0/4qRAAmYFI l4JQDYaacA2/56NibUiI2OpFTYrs5swsnd+Bz93GQJGAD4PrloamDYrZ/7I8qn7pJZOX ndaq7xcKh1zPUyAC/yfIuBnDFkSZA9K+0OUCaZ87b3P+pTMfPFDIi0wLTuEm9lCMqNaA v3/9YPtOl+UoYo6UclYjWsfoYUuO+e1RefXcEjCcMLW19sZgrWPDTkB0qVlF7Hi83dgN NNSzNJmApn3j0Bn5DtgAs7hg7lpLLOoIeLK+vqwuTLIPzE5jLfTFuTarZQjSJ0/Zb/+u LIpA== X-Gm-Message-State: AJIora89Td4wpKcUHc8GZsc6kHIKPxFG0aDAok53xLzcEqphv/NMAsJO 6pVuB89Sb++3lVrZjwPhww4gTG9PfzLj9w== X-Google-Smtp-Source: AGRyM1vFWS18gJd73WOk9yW1Y0OANlE5NpWsoq+RgE8A4d6BMUKHv79Yzpy0zNx1cZ7cG57REi8ueg== X-Received: by 2002:a05:6000:230:b0:210:31ca:28b8 with SMTP id l16-20020a056000023000b0021031ca28b8mr4682436wrz.538.1655385234008; Thu, 16 Jun 2022 06:13:54 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id j7-20020adfea47000000b0021863a560f6sm1854555wrn.3.2022.06.16.06.13.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jun 2022 06:13:53 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Thu, 16 Jun 2022 13:13:48 +0000 Subject: [PATCH v2 2/4] t5329: test 'git gc --cruft' without '--prune=now' Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: gitster@pobox.com, me@ttaylorr.com, Eric Sunshine , Derrick Stolee , Derrick Stolee Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Derrick Stolee From: Derrick Stolee Replace a 'git repack --cruft -d' with the wrapper 'git gc --cruft' to exercise some logic in builtin/gc.c that adds the '--cruft' option to the underlying 'git repack' command. Signed-off-by: Derrick Stolee --- t/t5329-pack-objects-cruft.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/t/t5329-pack-objects-cruft.sh b/t/t5329-pack-objects-cruft.sh index b481224b93d..8968f7a08d8 100755 --- a/t/t5329-pack-objects-cruft.sh +++ b/t/t5329-pack-objects-cruft.sh @@ -451,11 +451,13 @@ test_expect_success 'expiring cruft objects with git gc' ' sort reachable && comm -13 reachable objects >unreachable && - git repack --cruft -d && + # Write a cruft pack containing all unreachable objects. + git gc --cruft --prune="01-01-1980" && mtimes=$(ls .git/objects/pack/pack-*.mtimes) && test_path_is_file $mtimes && + # Prune all unreachable objects from the cruft pack. git gc --cruft --prune=now && git cat-file --batch-all-objects --batch-check="%(objectname)" >objects && From patchwork Thu Jun 16 13:13:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derrick Stolee X-Patchwork-Id: 12883847 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2EBBC433EF for ; Thu, 16 Jun 2022 13:14:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376971AbiFPNOE (ORCPT ); Thu, 16 Jun 2022 09:14:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376938AbiFPNN7 (ORCPT ); Thu, 16 Jun 2022 09:13:59 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66FD9369EE for ; Thu, 16 Jun 2022 06:13:57 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id m39-20020a05600c3b2700b0039c511ebbacso2807677wms.3 for ; Thu, 16 Jun 2022 06:13:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=ZPl6Zq2JI8wNCS5ZExHetDtnJijrCm3i3KuNoQFRYMM=; b=UJE/+dSx6veaIQoOpSA5Oq0m002Kav7oujFMJVZwu5Kq17qIjE0RgKl5xpMl7sZ1l0 geWorQn6Azp1cTe5m2O700P66CRGuuK+L29bkkceag0yvl4o26vCRc9ujlSjPxrPn9Xw oCkKmmGIu1rkPtq+zj9avw234qDINUUVsB5uVdvhrPuRrZvm1cKgIb3Fi6Rq127AfYLd PE5wYRHLImZem0HLRoQs8MxwCg0alagyJJKwbnVmYoysgpnVa07O850rSsQRVti8OtjF IuaQ5JkHTYf3IegF5/TKUCNnzOcg8Gftulz4TTkV6rXH1GsYZrXqIezeAJHVpMkB3lWT Gkfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=ZPl6Zq2JI8wNCS5ZExHetDtnJijrCm3i3KuNoQFRYMM=; b=Wc3MivBJkoK9mUPYOY6KU/uxRP4zM+Z4j/JLSXN6804ApB+zhN9YTSwB5ML8u8m47b Z8vgYbwxyNzyuKoGl+LSIl/yxtHkxUOU7yS1pb72r8zb3RK3eUYZFS/pOh81zWCm/Nat FnG10qRvhJGNoopw2EH1opbdnlqYWfLG5L0tolzes4Q2rCds99ZMy6Lwz5KR7x2lZuDa fDYH/bmyQzgKgM3n0xIQDkcyNi+7pUat3ays2jN0T9iukhtDPIQ43Xj1KxuT4kuIUl4o cr40PRjnsAlz6NA5uU9FbXilDhs+ci+WLpE8xBmW6balpfncHw2SwO2qwnyO8I3Ws3v9 zVXQ== X-Gm-Message-State: AOAM530gxbpnSOBT5+SR1BkYDrY7iLPWHmgLPbIplh8cG76M+B2laiJ7 AxlSk7eZrl8fyEf6uSkw7oBeVXIvUBHqOA== X-Google-Smtp-Source: ABdhPJx/e/xVLDF5wv/LeJ9tlGumVW8yVQCNoHkKCdb25kTEpbkQVDDj3+cZcesIbzhyD7kNjD+Gjw== X-Received: by 2002:a05:600c:1e1c:b0:39c:65a1:7c3a with SMTP id ay28-20020a05600c1e1c00b0039c65a17c3amr15762921wmb.6.1655385235120; Thu, 16 Jun 2022 06:13:55 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id r66-20020a1c2b45000000b0039c97cc82fbsm5912829wmr.15.2022.06.16.06.13.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jun 2022 06:13:54 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Thu, 16 Jun 2022 13:13:49 +0000 Subject: [PATCH v2 3/4] pack-write: drop always-NULL parameter Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: gitster@pobox.com, me@ttaylorr.com, Eric Sunshine , Derrick Stolee , Derrick Stolee Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Derrick Stolee From: Derrick Stolee write_mtimes_file() takes an mtimes parameter as its first option, but the only caller passes a NULL constant. Drop this parameter to simplify logic. This can be reverted if that parameter is needed in the future. Signed-off-by: Derrick Stolee --- pack-write.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/pack-write.c b/pack-write.c index 23c0342018f..00787e306db 100644 --- a/pack-write.c +++ b/pack-write.c @@ -310,26 +310,21 @@ static void write_mtimes_trailer(struct hashfile *f, const unsigned char *hash) hashwrite(f, hash, the_hash_algo->rawsz); } -static const char *write_mtimes_file(const char *mtimes_name, - struct packing_data *to_pack, +static const char *write_mtimes_file(struct packing_data *to_pack, struct pack_idx_entry **objects, uint32_t nr_objects, const unsigned char *hash) { + struct strbuf tmp_file = STRBUF_INIT; + const char *mtimes_name; struct hashfile *f; int fd; if (!to_pack) BUG("cannot call write_mtimes_file with NULL packing_data"); - if (!mtimes_name) { - struct strbuf tmp_file = STRBUF_INIT; - fd = odb_mkstemp(&tmp_file, "pack/tmp_mtimes_XXXXXX"); - mtimes_name = strbuf_detach(&tmp_file, NULL); - } else { - unlink(mtimes_name); - fd = xopen(mtimes_name, O_CREAT|O_EXCL|O_WRONLY, 0600); - } + fd = odb_mkstemp(&tmp_file, "pack/tmp_mtimes_XXXXXX"); + mtimes_name = strbuf_detach(&tmp_file, NULL); f = hashfd(fd, mtimes_name); write_mtimes_header(f); @@ -561,7 +556,7 @@ void stage_tmp_packfiles(struct strbuf *name_buffer, pack_idx_opts->flags); if (pack_idx_opts->flags & WRITE_MTIMES) { - mtimes_tmp_name = write_mtimes_file(NULL, to_pack, written_list, + mtimes_tmp_name = write_mtimes_file(to_pack, written_list, nr_written, hash); } From patchwork Thu Jun 16 13:13:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derrick Stolee X-Patchwork-Id: 12883848 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8917EC433EF for ; Thu, 16 Jun 2022 13:14:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376997AbiFPNOJ (ORCPT ); Thu, 16 Jun 2022 09:14:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376926AbiFPNN7 (ORCPT ); Thu, 16 Jun 2022 09:13:59 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6DEB33A0F for ; Thu, 16 Jun 2022 06:13:58 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id n185so750295wmn.4 for ; Thu, 16 Jun 2022 06:13:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=alRx2CpD6UCtMqSiYdRE3shPSPHBMdmw/AvBwMyz424=; b=J8sKlu2CyzqrE/Ntc37kw9ADw95RxfLhokM2jZ0V50T/YiBGhJ2l9jsnDtJlbwSM6A rl5Z+83ng4I73dnRaLezXs+qhukj9GWIQUIKxGVAVyxzjzlGsKH9j/sTzDIwwM4QIntK v+GDLyshzmUMzbF2nPKOKuwwvAntc1RpwPTGrL7S4Uaik7WAUh9+Ihour0yxaN3T6Vu3 6Ku3hUmeqVazup2OT98S600nmI4F+QbouLEoV81ZBora0vJN+JN0qaJ7elY1zAlqPcWF Fbtly+KP0gavmD1FBlLaOiQhGrjLuuIi4rAGRyBSIoRFPQcRagHEzpN7dRwCE/YhC+ve fnig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=alRx2CpD6UCtMqSiYdRE3shPSPHBMdmw/AvBwMyz424=; b=tSQX+wDioXIt7vS9zX0YDhjWeKBnhwQ6M8CAREVufSepMw4bIeVMr7I4hYNev81e/e qGBXUOjvN0HWsaB2b5A/xMhWFtf4gjgfZ1rVq45bCqLUn1+CDIESgAtGyCsKq+OqHqU4 KfB9Jap+uLlSGxvtnabXCnU60T/Orvn24jLDigKZxSD4arjG8YlYWpHPw5Hbu+ggvlTK Myb47+hZJYpJ54SWr6P3As13g6vz0IXusBKpP7KVsZfxSE8DaNdGvJkk98rhx44Fc82J 2kyxTAvkU1OdO1UZLiq8abRSbx/JN5MNkOjNSqNB1pHhwBZb4ECtjGZpE6+U+gBUgBB/ Pcrw== X-Gm-Message-State: AJIora8m1cNGZHZbgutlfWa0fPmKCZDVLIeULzKqrbLkowRmPtfRAbZM WxFJYE5VCuiNWF6h3EYPJRM5dzo1YkKPag== X-Google-Smtp-Source: AGRyM1v/ia8KVhCYh1k0r2nYLDwuEO4oFyD75F7Ilz363WDBsF1Lz4YHmgJxGtQ2GYVPH0qCnu8YZw== X-Received: by 2002:a05:600c:4e0e:b0:39c:8d11:58eb with SMTP id b14-20020a05600c4e0e00b0039c8d1158ebmr5056834wmq.190.1655385236908; Thu, 16 Jun 2022 06:13:56 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id d8-20020adfc088000000b00213ba0cab3asm1903143wrf.44.2022.06.16.06.13.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jun 2022 06:13:56 -0700 (PDT) Message-Id: <8486a1d6eca66e2d71b4317ce03318aed6346bc0.1655385230.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Thu, 16 Jun 2022 13:13:50 +0000 Subject: [PATCH v2 4/4] cache-tree: remove cache_tree_find_path() Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: gitster@pobox.com, me@ttaylorr.com, Eric Sunshine , Derrick Stolee , Derrick Stolee Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Derrick Stolee From: Derrick Stolee This reverts 080ab56a46 (cache-tree: implement cache_tree_find_path(), 2022-05-23). The cache_tree_find_path() method was never actually called in the topic that added it. I cannot find any reference to it in any of my forks, so this appears to not be needed at the moment. Signed-off-by: Derrick Stolee --- cache-tree.c | 27 --------------------------- cache-tree.h | 2 -- 2 files changed, 29 deletions(-) diff --git a/cache-tree.c b/cache-tree.c index ff794d940fa..56db0b5026b 100644 --- a/cache-tree.c +++ b/cache-tree.c @@ -101,33 +101,6 @@ struct cache_tree_sub *cache_tree_sub(struct cache_tree *it, const char *path) return find_subtree(it, path, pathlen, 1); } -struct cache_tree *cache_tree_find_path(struct cache_tree *it, const char *path) -{ - const char *slash; - int namelen; - struct cache_tree_sub it_sub = { - .cache_tree = it, - }; - struct cache_tree_sub *down = &it_sub; - - while (down) { - slash = strchrnul(path, '/'); - namelen = slash - path; - down->cache_tree->entry_count = -1; - if (!*slash) { - int pos; - pos = cache_tree_subtree_pos(down->cache_tree, path, namelen); - if (0 <= pos) - return down->cache_tree->down[pos]->cache_tree; - return NULL; - } - down = find_subtree(it, path, namelen, 0); - path = slash + 1; - } - - return NULL; -} - static int do_invalidate_path(struct cache_tree *it, const char *path) { /* a/b/c diff --git a/cache-tree.h b/cache-tree.h index f75f8e74dcd..8efeccebfc9 100644 --- a/cache-tree.h +++ b/cache-tree.h @@ -29,8 +29,6 @@ struct cache_tree_sub *cache_tree_sub(struct cache_tree *, const char *); int cache_tree_subtree_pos(struct cache_tree *it, const char *path, int pathlen); -struct cache_tree *cache_tree_find_path(struct cache_tree *it, const char *path); - void cache_tree_write(struct strbuf *, struct cache_tree *root); struct cache_tree *cache_tree_read(const char *buffer, unsigned long size);