git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Victoria Dye <vdye@github.com>
To: Shuqi Liang <cheskaqiqi@gmail.com>,
	git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v1] worktree: integrate with sparse-index
Date: Mon, 5 Jun 2023 21:22:33 -0700	[thread overview]
Message-ID: <523de20d-a816-5101-af82-5bfff26fbcac@github.com> (raw)
In-Reply-To: <CAMO4yUEQZz8DqPb7RyN8Owb=23p==6XS6G7Bza77p4-iydo6Qg@mail.gmail.com>

Shuqi Liang wrote:
>>> +test_expect_success 'worktree is not expanded' '
>>> +     init_repos &&
>>> +
>>> +     test_all_match git worktree add .worktrees/hotfix &&
>>
>> Shouldn't 'git worktree add' not expand the index? Why use 'test_all_match'
>> instead of 'ensure_not_expanded'?
> 
> Here's my perspective on why my use of "test_all_match" instead of
> "ensure_not_expanded" in "git worktree add":
> 
> The functions "validate_no_submodules" and "check_clean_worktree" are
> specifically related to the "git worktree remove" command, and "git
> worktree add" doesn't require index reading, so with or without the
> "ensure_full_index" wouldn't affect the "git worktree add" command.
> I look forward to hearing your thoughts regarding whether my
> understanding is correct or not.

I see, thanks for the explanation. I could understand it both ways: on one
hand, you don't want redundant/unnecessary tests; on the other hand, that
test design decision relies pretty heavily on knowing the internal
implementation details, which the tests conceptually shouldn't have
visibility to. 

I'd still lean towards using 'ensure_not_expanded' (it protects us from
future changes causing index expansion, although that seems fairly
unlikely). However, if you do choose to stick with not using
'ensure_not_expanded', I'd recommend using 'git -C sparse-index worktree add
.worktrees/hotfix' instead of 'test_all_match'. The 'worktree' test already
compares behavior across the three test repositories; to keep things focused
on index expansion, only the 'sparse-index' repo should be set up & tested.

> 
> Thanks for your valuable feedback!


  reply	other threads:[~2023-06-06  4:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-05 16:16 [PATCH v1] worktree: integrate with sparse-index Shuqi Liang
2023-06-05 19:16 ` Victoria Dye
2023-06-05 20:16   ` Shuqi Liang
2023-06-06  4:22     ` Victoria Dye [this message]
2023-06-06 17:26 ` [PATCH v2] " Shuqi Liang
2023-06-07 17:21   ` Victoria Dye

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=523de20d-a816-5101-af82-5bfff26fbcac@github.com \
    --to=vdye@github.com \
    --cc=cheskaqiqi@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).