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,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 3212F1F852 for ; Fri, 28 Jan 2022 00:08:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344381AbiA1AIg (ORCPT ); Thu, 27 Jan 2022 19:08:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238679AbiA1AIe (ORCPT ); Thu, 27 Jan 2022 19:08:34 -0500 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F5EDC061714 for ; Thu, 27 Jan 2022 16:08:34 -0800 (PST) Received: by mail-ej1-x62e.google.com with SMTP id ka4so9990481ejc.11 for ; Thu, 27 Jan 2022 16:08:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=i4T770/dXiUSNHRGQtgIiYXmrlsc+1bjNsXL5349AIw=; b=cTX7Sj7JDYYHYjf4VkSZM47GEvYpU3DfYPHR0pgq191rZL4L+3kmJMuAo2ZdiffWlP IJIxdlZ5L5OAxDfKvoDrcEeiKhpfG2Fi9HHo2Cvc3x4GwLZJTreyO6GReOOnKUaFh6pk PPZz/9qE8/b7W88n40Y9OHAL07BpH2c92hF/5Jv4Y+FQdw/8zQTH0pX8W+iJ70EQ6Bae kBd+ohzjEW/vaEZzEb3Fon+ngKFVQBo6xrA+fRn2hjhoV9yCvXx+ikRO6P5LwWbPRgg3 BsqQpFtCrlfiEf43QoOAwCuIyoKbo2wBPn6WIg+2pKzayNciIP8Ltz1rDprZSfgHMBNt 0ZRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=i4T770/dXiUSNHRGQtgIiYXmrlsc+1bjNsXL5349AIw=; b=kDU76MGOXAV1rmgmz0cQJgDwGmJZPXC2XyWoAgEo6lTtLrSFvu+tXXTKxEqhlWv4us g32rZpbv7Xuhxi36mv5q83heKqOMM6MxXGqFxm0PoLM59s79/pLlQhgv9LvnAcXwU1/h QC8EC8+StTPuNwALVJ2xmJL+HPZgH8e7imQU4bpNwtmS8KqaTkFlvsFYWi+czQ5wtcJd UB+U5/T6duBcSYUFGVKlV9QlLLsZno3wMKivmMSz2bfe5+axr1So+PeC7qEhOG5O+GZk UvsWDktqGT+cQysZg2PvQKnICjeATPymO63yRGr/dzqXBLpkr9b+n5Iaod+ZnGotrMdh 89vw== X-Gm-Message-State: AOAM531PEOEIA5/3oh8gwE5/Vxf9ucEtLjyXVceqHpO8l15FX/Rah7mE 9vLwN0XjuJ1fy56031CJ4M+nbWwgtJJ4vzUKI44pTBuF X-Google-Smtp-Source: ABdhPJxtqM6ce+3tWAzHZ+UQbqb0imQrWWVhqN8r24yU6PwFSZugzWrj6960Vp4MaAEi/1kmM5gC4fJk2ZG7Mt2LGL8= X-Received: by 2002:a17:907:7d88:: with SMTP id oz8mr4953465ejc.328.1643328512635; Thu, 27 Jan 2022 16:08:32 -0800 (PST) MIME-Version: 1.0 References: <5bb598a055dd8121ad5c7228b11618b037029478.1643318514.git.gitgitgadget@gmail.com> In-Reply-To: <5bb598a055dd8121ad5c7228b11618b037029478.1643318514.git.gitgitgadget@gmail.com> From: Elijah Newren Date: Thu, 27 Jan 2022 16:08:20 -0800 Message-ID: Subject: Re: [PATCH v4 1/3] completion: add sparse-checkout tests To: Lessley Dennington via GitGitGadget Cc: Git Mailing List , Derrick Stolee , Junio C Hamano , johannes.schindelin@gmail.com, Taylor Blau , =?UTF-8?Q?SZEDER_G=C3=A1bor?= , Lessley Dennington Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Thu, Jan 27, 2022 at 1:21 PM Lessley Dennington via GitGitGadget wrote: > > From: Lessley Dennington > > Add tests for missing/incorrect components of custom tab completion for > the sparse-checkout command. These tests specifically highlight the > following: > > 1. git sparse-checkout results in an incomplete list of subcommands > (it is missing reapply and add). > 2. git sparse-checkout set and git sparse-checkout add show > both file names and directory names. While this is the correct behavior s/is/may be/ (Yes, Junio declared it to be the behavior he wanted to see, but there's a difference between "this is clearly desired behavior" and "here's the official edict declaring which bad option is the lesser evil" situation. As Junio pointed out, completing on files and directories avoids one type of surprise for users -- but as I've pointed out elsewhere, it introduces multiple other types of negative surprises.) > for non-cone mode, cone mode sparse checkouts should complete only > directory names. > > Although the first two of these tests currently fail, they will succeed > with the sparse-checkout modifications in git-completion.bash in the next > commit in this series. > > Signed-off-by: Lessley Dennington > --- > t/t9902-completion.sh | 75 +++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 75 insertions(+) > > diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh > index 518203fbe07..6004d854102 100755 > --- a/t/t9902-completion.sh > +++ b/t/t9902-completion.sh > @@ -1447,6 +1447,81 @@ test_expect_success 'git checkout - with --detach, complete only references' ' > EOF > ' > > +test_expect_failure 'sparse-checkout completes subcommands' ' > + test_completion "git sparse-checkout " <<-\EOF > + list Z > + init Z > + set Z > + add Z > + reapply Z > + disable Z > + EOF > +' > + > +test_expect_failure 'cone mode sparse-checkout completes directory names' ' > + # set up sparse-checkout repo > + git init sparse-checkout && > + ( > + cd sparse-checkout && > + mkdir -p folder1/0/1 folder2/0 folder3 && > + touch folder1/0/1/t.txt && > + touch folder2/0/t.txt && > + touch folder3/t.txt && > + git add . && > + git commit -am "Initial commit" > + ) && > + > + # initialize sparse-checkout definitions > + git -C sparse-checkout sparse-checkout set --cone folder1/0 folder3 && > + > + # test tab completion > + ( > + cd sparse-checkout && > + test_completion "git sparse-checkout set f" <<-\EOF > + folder1 > + folder2 > + folder3 > + EOF > + ) && > + > + ( > + cd sparse-checkout && > + test_completion "git sparse-checkout set folder1/" <<-\EOF > + folder1/0 > + EOF > + ) && > + > + ( > + cd sparse-checkout && > + test_completion "git sparse-checkout set folder1/0/" <<-\EOF > + folder1/0/1 > + EOF > + ) && > + > + ( > + cd sparse-checkout/folder1 && > + test_completion "git sparse-checkout add 0" <<-\EOF > + 0 > + EOF > + ) > +' > + > +test_expect_success 'non-cone mode sparse-checkout uses bash completion' ' > + # reset sparse-checkout repo to non-cone mode > + git -C sparse-checkout sparse-checkout disable && > + git -C sparse-checkout sparse-checkout set && Can we add a --no-cone here in preparation for the default to switch? > + > + # test tab completion > + ( > + cd sparse-checkout && > + # expected to be empty since we have not configured > + # custom completion for non-cone mode > + test_completion "git sparse-checkout set f" <<-\EOF > + > + EOF > + ) > +' > + > test_expect_success 'git switch - with -d, complete all references' ' > test_completion "git switch -d " <<-\EOF > HEAD Z > -- > gitgitgadget >