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.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS,URIBL_CSS, URIBL_CSS_A 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 88AA11F953 for ; Wed, 3 Nov 2021 16:47:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232932AbhKCQuD (ORCPT ); Wed, 3 Nov 2021 12:50:03 -0400 Received: from pb-smtp1.pobox.com ([64.147.108.70]:55188 "EHLO pb-smtp1.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229894AbhKCQuC (ORCPT ); Wed, 3 Nov 2021 12:50:02 -0400 Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 99487E32BB; Wed, 3 Nov 2021 12:47:25 -0400 (EDT) (envelope-from junio@pobox.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=Opz2AEhluaLwA7lHGPdjDlafkqkqCDuhZnmFwC JBy88=; b=gqgbYG6bvRM6fE0XkpnRLwcabkWlpaW6/gSaNboS8/dXTr8F/NrSNt tsicQgu9nj5ghoD7GIISXMA7/XOtUTumbGbetiuV20dbbRCT1CaiBjTgyunQcxgz uiQ024sToNaLBIYVjonDonfcd9pS/dUB0WcsVpqA89UvrqW+dfCfo= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 8B574E32BA; Wed, 3 Nov 2021 12:47:25 -0400 (EDT) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [104.133.2.91]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id E315BE32B8; Wed, 3 Nov 2021 12:47:24 -0400 (EDT) (envelope-from junio@pobox.com) From: Junio C Hamano To: "Lessley Dennington via GitGitGadget" Cc: git@vger.kernel.org, stolee@gmail.com, newren@gmail.com, Taylor Blau , Lessley Dennington Subject: Re: [PATCH v3 2/2] blame: enable and test the sparse index References: Date: Wed, 03 Nov 2021 09:47:23 -0700 In-Reply-To: (Lessley Dennington via GitGitGadget's message of "Mon, 01 Nov 2021 21:27:49 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: B8DEEDC6-3CC5-11EC-AE8D-62A2C8D8090B-77302942!pb-smtp1.pobox.com Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org "Lessley Dennington via GitGitGadget" writes: > We do not include paths outside the sparse checkout cone because blame > currently does not support blaming files outside of the sparse definition. > Attempting to do so fails with the following error: > > fatal: no such path '' in HEAD Does this indicate that we need to update how the command line safety in verify_working_tree_path() works in a sparsely checked out working tree? If foo/bar is outside the sparse definition, git blame HEAD foo/bar may get such a message, but shouldn't git blame HEAD -- foo/bar make it work? > -# TODO: blame currently does not support blaming files outside of the > -# sparse definition. It complains that the file doesn't exist locally. > -test_expect_failure 'blame with pathspec outside sparse definition' ' > +# Blame does not support blaming files outside of the sparse > +# definition, so we verify this scenario. IOW, why is it a good idea to drop the "TODO" and "currently" and pretend as if the current behaviour is the desirable one? > +test_expect_success 'blame with pathspec outside sparse definition' ' > init_repos && > + test_sparse_match git sparse-checkout set && > > - test_all_match git blame folder1/a && > - test_all_match git blame folder2/a && > - test_all_match git blame deep/deeper2/a && > - test_all_match git blame deep/deeper2/deepest/a > + for file in a \ > + deep/a \ > + deep/deeper1/a \ > + deep/deeper1/deepest/a > + do > + test_sparse_match test_must_fail git blame $file && > + cat >expect <<-EOF && > + fatal: Cannot lstat '"'"'$file'"'"': No such file or directory > + EOF > + # We compare sparse-checkout-err and sparse-index-err in > + # `test_sparse_match`. Given we know they are the same, we > + # only check the content of sparse-index-err here. > + test_cmp expect sparse-index-err > + done > ' > > test_expect_success 'checkout and reset (mixed)' ' > @@ -878,6 +892,18 @@ test_expect_success 'sparse index is not expanded: diff' ' > ensure_not_expanded diff --staged > ' > > +test_expect_success 'sparse index is not expanded: blame' ' > + init_repos && > + > + for file in a \ > + deep/a \ > + deep/deeper1/a \ > + deep/deeper1/deepest/a > + do > + ensure_not_expanded blame $file > + done > +' > + > # NEEDSWORK: a sparse-checkout behaves differently from a full checkout > # in this scenario, but it shouldn't. > test_expect_success 'reset mixed and checkout orphan' '