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

[PATCH 0/5] Sparse Index: Integrate with 'git add'

From
Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
Date
Jul 21, 2021, 21:06 UTC
Message-ID
<pull.999.git.1626901619.gitgitgadget@gmail.com>

This patch series re-submits the 'git add' integration with sparse-index. The performance gains are the same as before.

It is based on ds/commit-and-checkout-with-sparse-index.
This series was delayed from its initial submission for a couple reasons.

The first was because it was colliding with some changes in mt/add-rm-in-sparse-checkout, so now we are far enough along that that branch is in our history and we can work forwards.

The other concern was about how 'git add ' should respond when a path outside of the sparse-checkout cone exists. One recommendation (that I am failing to find a link to the message, sorry) was to disallow adding files that would become index entries with SKIP_WORKTREE on. However, as I worked towards that goal I found that change would cause problems for a realistic scenario: merge conflicts outside of the sparse-checkout cone.

The first patch of this series adds tests that create merge conflicts outside of the sparse cone and then presents different ways a user could resolve the situation. We want all of them to be feasible, and this includes:

 1. Reverting the file to a known version in history.
 2. Adding the file with its contents on disk.
 3. Moving the file to a new location in the sparse directory.

Without maintaining the behavior of adding files outside of the sparse-checkout cone, we risk confusing users who get into this state. The only workaround they would have is to modify their sparse-checkout definition which might lead to expanding much more data than they need to resolve the conflicts.

For that reason, I stopped trying to limit 'git add' to be within the cone. I'm open to suggestions here, but we need an approach that works for out-of-cone conflicts.

The one place I did continue to update is 'git add --refresh ' to match the behavior added by mt/add-rm-in-sparse-checkout which outputs an error message. This happens even when the file exists in the working directory, but that seems appropriate enough.

Thanks, -Stolee
Derrick Stolee (5):
  t1092: test merge conflicts outside cone
  add: allow operating on a sparse-only index
  pathspec: stop calling ensure_full_index
  t1092: 'git add --refresh' difference with sparse-index
  add: ignore outside the sparse-checkout in refresh()
 builtin/add.c                            | 13 ++++-
 pathspec.c                               |  2 -
 t/t1092-sparse-checkout-compatibility.sh | 71 ++++++++++++++++++++----
 3 files changed, 72 insertions(+), 14 deletions(-)
base-commit: 71e301501c88399711a1bf8515d1747e92cfbb9b
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-999%2Fderrickstolee%2Fsparse-index%2Fadd-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-999/derrickstolee/sparse-index/add-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/999
-- 
gitgitgadget
Next: Derrick Stolee via GitGitGadget
Message 1 of 38 in “Sparse Index: Integrate with 'git add'”
  1. 0/5 Sparse Index: Integrate with 'git add'Derrick Stolee via GitGitGadget, Jul 21, 2021
  2. 1/5 t1092: test merge conflicts outside coneDerrick Stolee via GitGitGadget, Jul 21, 2021
  3. Elijah NewrenJul 23, 2021
  4. Eric SunshineJul 23, 2021
  5. Elijah NewrenJul 23, 2021
  6. Derrick StoleeJul 26, 2021
  7. 2/5 add: allow operating on a sparse-only indexDerrick Stolee via GitGitGadget, Jul 21, 2021
  8. Junio C HamanoJul 21, 2021
  9. Derrick StoleeJul 21, 2021
  10. Elijah NewrenJul 23, 2021
  11. Derrick StoleeJul 26, 2021
  12. Derrick StoleeJul 26, 2021
  13. 3/5 pathspec: stop calling ensure_full_indexDerrick Stolee via GitGitGadget, Jul 21, 2021
  14. Elijah NewrenJul 23, 2021
  15. 4/5 t1092: 'git add --refresh' difference with sparse-indexDerrick Stolee via GitGitGadget, Jul 21, 2021
  16. 5/5 add: ignore outside the sparse-checkout in refresh()Derrick Stolee via GitGitGadget, Jul 21, 2021
  17. Elijah NewrenJul 23, 2021
  18. Elijah NewrenJul 23, 2021
  19. Elijah NewrenJul 23, 2021
  20. 0/5 Sparse Index: Integrate with 'git add'Derrick Stolee via GitGitGadget, Jul 26, 2021
  21. 1/5 t1092: test merge conflicts outside coneDerrick Stolee via GitGitGadget, Jul 26, 2021
  22. 2/5 add: allow operating on a sparse-only indexDerrick Stolee via GitGitGadget, Jul 26, 2021
  23. 4/5 add: ignore outside the sparse-checkout in refresh()Derrick Stolee via GitGitGadget, Jul 26, 2021
  24. 3/5 pathspec: stop calling ensure_full_indexDerrick Stolee via GitGitGadget, Jul 26, 2021
  25. 5/5 add: remove ensure_full_index() with --renormalizeDerrick Stolee via GitGitGadget, Jul 26, 2021
  26. Elijah NewrenJul 28, 2021
  27. Derrick StoleeJul 29, 2021
  28. Elijah NewrenJul 29, 2021
  29. Derrick StoleeJul 29, 2021
  30. Elijah NewrenJul 30, 2021
  31. 0/5 Sparse Index: Integrate with 'git add'Derrick Stolee via GitGitGadget, Jul 29, 2021
  32. 2/5 add: allow operating on a sparse-only indexDerrick Stolee via GitGitGadget, Jul 29, 2021
  33. 1/5 t1092: test merge conflicts outside coneDerrick Stolee via GitGitGadget, Jul 29, 2021
  34. 4/5 add: ignore outside the sparse-checkout in refresh()Derrick Stolee via GitGitGadget, Jul 29, 2021
  35. 3/5 pathspec: stop calling ensure_full_indexDerrick Stolee via GitGitGadget, Jul 29, 2021
  36. 5/5 add: remove ensure_full_index() with --renormalizeDerrick Stolee via GitGitGadget, Jul 29, 2021
  37. Elijah NewrenJul 29, 2021
  38. Junio C HamanoJul 29, 2021

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.