git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Derrick Stolee <stolee@gmail.com>
To: Taylor Blau <me@ttaylorr.com>
Cc: Calbabreaker <calbabreaker@gmail.com>, git@vger.kernel.org
Subject: Re: Memory leak with sparse-checkout
Date: Mon, 20 Sep 2021 13:25:31 -0400	[thread overview]
Message-ID: <b082f98b-eb49-7cc4-9f75-fe1ec480bd61@gmail.com> (raw)
In-Reply-To: <YUi55/3L9nizTVyA@nand.local>

On 9/20/2021 12:42 PM, Taylor Blau wrote:
> On Mon, Sep 20, 2021 at 12:29:36PM -0400, Derrick Stolee wrote:
>>> So I think the problem really is that we need to drop existing patterns
>>> when re-initializing the sparse-checkout in cone mode. We could try to
>>> recognize that existing patterns may already constitute a cone (and/or
>>> create a cone that covers the existing patterns).
>>>
>>> But I think the easiest thing (if a little unfriendly) would be to just
>>> drop them and start afresh when re-initializing the sparse-checkout in
>>> cone mode.
>>
>> This isn't sufficient, as a user can modify their .git/info/sparse-checkout
>> file whenever they want, so we should fix this bug regardless. We could add
>> a "Your existing patterns are not in cone mode" error.
>>
>> It might still be a good idea to let "git sparse-checkout init --cone"
>> overwrite the sparse-checkout file _if the file is not already in cone
>> mode_.
> 
> I'm not sure how helpful such an error message might be to a user in
> this scenario without extra information. After seeing just "this isn't a
> cone", it's not clear what they should do other than drop their
> sparse-checkout configuration and start over.
> 
> It would be nice to have an intermediate step between seeing realizing
> that the existing patterns don't form a cone and dropping them.
> 
> Perhaps we could include an error message and say something like:
> 
>     warning: your sparse-checkout patterns do not from a cone
>        hint: to reinitialize your sparse-checkout configuration
>        hint: try running:
>        hint:
>        hint:   git sparse-checkout init --cone --reinitialize
> 
> Where `--reinitialize` means to drop existing patterns. I suppose it
> could be the default when transitioning from non-cone to cone mode, but
> that would defeat the purpose of the warning.

I've got an initial set of commits in a GGG pull request [1], and I'm
waiting build validation as a double-check before sending them to the
list.

[1] https://github.com/gitgitgadget/git/pull/1043

There, I think the best thing to do is have 'init --cone' overwrite the
old, non-cone-mode patterns. This essentially makes your --reinitialize
suggestion on permanently in that case. Note that it doesn't reinitialize
when the patterns are already in cone mode.

Note that 'git sparse-checkout set' (with no other arguments) initializes
the sparse-checkout file with the default set of cone mode patterns, so
we have a way to do that now.
 
> We would probably want to perform this check both during initialization,
> and when adding patterns in cone mode. It may also be worthwhile to
> check the validity of the cone before running 'list' or 'reapply', too.

'list' definitely seems like a good idea, since it is expecting different
output than the literal patterns when cone mode is enabled.

'reapply' should work in both cases, it will just use the old pattern
matching algorithm when in cone mode. It will present a warning when the
patterns don't match as expected.

One thing that is very interesting about the example here is that a
pattern "dir" is not recognized as a non-cone-mode pattern, but it
should be. The fix is to look for a '/' at the start of the pattern and
reject it otherwise. This is fixed in my series.

Thanks,
-Stolee

  reply	other threads:[~2021-09-20 21:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-20 12:15 Memory leak with sparse-checkout Calbabreaker
2021-09-20 15:52 ` Taylor Blau
2021-09-20 16:29   ` Derrick Stolee
2021-09-20 16:42     ` Taylor Blau
2021-09-20 17:25       ` Derrick Stolee [this message]
2021-09-20 17:27         ` Derrick Stolee
2021-09-20 19:08           ` Taylor Blau
2021-09-20 20:56             ` Derrick Stolee
2021-09-20 21:20               ` Taylor Blau
2021-09-21 12:55                 ` Derrick Stolee
2021-09-21 16:32                   ` Taylor Blau
2021-09-21 18:56                     ` Derrick Stolee
2021-09-21 20:45                       ` Taylor Blau
2021-09-22 19:16                         ` Derrick Stolee
2021-09-22 19:37                           ` Taylor Blau

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=b082f98b-eb49-7cc4-9f75-fe1ec480bd61@gmail.com \
    --to=stolee@gmail.com \
    --cc=calbabreaker@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=me@ttaylorr.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).