git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3] checkout: optimize "git checkout -b <new_branch>"

From
Duy Nguyen <pclouds@gmail.com>
Date
Sep 4, 2018, 16:46 UTC
Message-ID
<CACsJy8CrRQ1sxh2rWowGCT5+mBDFJORbrsA6aYi6YxVwvYNV6g@mail.gmail.com>
In-Reply-To
<CABPp-BGE-m_UFfUt_moXG-YR=ZW8hMzMwraD7fkFV-+sEHw36w@mail.gmail.com>
On Thu, Aug 30, 2018 at 7:22 PM Elijah Newren <newren@gmail.com> wrote:
Show 29 quoted lines
>
> Hi Duy,
>
> On Tue, Aug 21, 2018 at 7:52 AM Duy Nguyen <pclouds@gmail.com> wrote:
> >
> > On Mon, Aug 20, 2018 at 8:16 PM Elijah Newren <newren@gmail.com> wrote:
> > > Playing with sparse-checkout, it feels to me like a half-baked
> > > feature.  It seems like it required too much manual work, and it was
> > > sometimes hard to tell if I was misunderstanding configuration rules
> > > or I was just running into bugs in the code.  I think I hit both but I
> > > didn't really want to get side-tracked further, yet.  (I do want to
> > > eventually come back to it.)  The only reason someone would go through
> > > that pain is if it provided massive performance benefits.
> >
> > In my defense it was one of my first contribution when I was naiver
> > and basically an evolution of "git update-index --assume-unchanged". I
> > have something in the queue to improve/complement sparse-checkout but
> > my last update on that branch was 2.5 years ago, so it's not coming
> > soon.
> >
> > I'd love to year how sparse checkout could be improved, or even
> > replaced. I think we still have to have some configuration rules, and
> > yes the flexibility of sparse checkout (or gitignore to be precise)
> > rules is a double-edged sword.
>
> Sorry for taking a while to respond, and if what I said came across
> harshly.  I agree that the flexibility of the rules makes it more
> complicated, though I think a bigger issue may be that the feature is
> hard to make smooth unless coupled to something like partial clones.

For something like partial clones, we would need something like partial indexes. That is, the index does not record all paths in worktree. The problem is at write-tree time, how to create trees with such a partial index. So far the only option I see is record directories in the index (in the same way we record submodule's commit), which reduces the index and we are still able to create trees from it.

> Work on that is ongoing.  Anyway, in an attempt to be helpful, here
> were some of the pain points I ran across:
>
> ..

Thanks. I think this basically boils down to no good UI (and user facing command also gives us a man page to describe stuff instead of hiding everything behind git-read-tree.txt). This is something I've been meaning to do but never got around to (also a couple of sparse checkout optimizations). There's also "git sparse-checkout" [1] that would be a good starting point for this, but I don't think the author got to the point to submit it to git.

[1] https://github.com/kjp/git-tools/blob/master/git-sparse-checkout
-- 
Duy
Previous: Elijah NewrenNext: Junio C Hamano
Message 25 of 32 in “checkout: optionally speed up "git checkout -b foo"”
  1. checkout: optionally speed up "git checkout -b foo"Ben Peart, Jul 24, 2018
  2. Eric SunshineJul 24, 2018
  3. Ben PeartJul 24, 2018
  4. Junio C HamanoJul 26, 2018
  5. Eric SunshineJul 26, 2018
  6. Eric SunshineJul 26, 2018
  7. Junio C HamanoJul 24, 2018
  8. Ben PeartJul 24, 2018
  9. checkout: optimize "git checkout -b <new_branch>"Ben Peart, Jul 31, 2018
  10. Junio C HamanoJul 31, 2018
  11. Duy NguyenAug 1, 2018
  12. Ben PeartAug 2, 2018
  13. Duy NguyenAug 3, 2018
  14. Ben PeartAug 6, 2018
  15. Ben PeartAug 15, 2018
  16. Duy NguyenAug 5, 2018
  17. checkout: optimize "git checkout -b <new_branch>"Ben Peart, Aug 16, 2018
  18. Duy NguyenAug 16, 2018
  19. Ben PeartAug 17, 2018
  20. Elijah NewrenAug 19, 2018
  21. Ben PeartAug 20, 2018
  22. Elijah NewrenAug 20, 2018
  23. Duy NguyenAug 21, 2018
  24. Elijah NewrenAug 30, 2018
  25. Duy NguyenSep 4, 2018
  26. Junio C HamanoAug 20, 2018
  27. config doc: add missing list separator for checkout.optimizeNewBranchÆvar Arnfjörð Bjarmason, Sep 18, 2018
  28. Taylor BlauSep 18, 2018
  29. Jeff KingSep 18, 2018
  30. Taylor BlauSep 18, 2018
  31. Jeff KingSep 18, 2018
  32. Ævar Arnfjörð BjarmasonSep 19, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.