{"thread":{"id":"60632","subject":"[BUG] `git add -p` seems to corrupt a sparse index","startedAt":"2023-12-19T11:30:29Z","lastAt":"2023-12-19T11:30:29Z","messageCount":1,"participants":["Sean Allred"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"485810","messageId":"m01qbia0q5.fsf@epic96565.epic.com","threadId":"60632","inReplyTo":null,"subject":"[BUG] `git add -p` seems to corrupt a sparse index","fromName":"Sean Allred","fromEmail":"allred.sean@gmail.com","sentAt":"2023-12-19T11:20:03Z","receivedAt":"2023-12-19T11:30:29Z","isPatch":false,"sender":{"key":"allred.sean@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2082195?v=4"},"body":"\nWhat did you do before the bug happened? (Steps to reproduce your issue)\n\n    git init\n    for dir in a b c; do mkdir $dir && seq 1 20 > $dir/file; done\n    git add -A && git commit -m'Some content'\n\n    git sparse-checkout set --sparse-index b\n    seq 1 20 > b/file-2\n    git add -N b/file-2\n    git add -p b/file-2\n    git status\n\nWhat did you expect to happen? (Expected behavior)\n\n  I expected to be dropped into the interactive-add workflow / see my\n  changes in git-status.\n\nWhat happened instead? (Actual behavior)\n\n  git-add reports 'No changes' and git-status reports nothing at all\n  (empty output).\n\n  The original internal report also was able reproduce messaging like\n\n      fatal: cache entry out of order\n      warning: die() called many times. Recursion error or racy threaded death!\n      fatal: cache entry out of order\n      fatal: cache entry out of order\n      fatal: cache entry out of order\n\n  though I've not been able to reproduce that myself. It seems relevant\n  / worth noting that core.fsmonitor would be set to 'true' in that\n  repository.\n\nWhat's different between what you expected and what actually happened?\n\n  git-status appears to silently crash in the error case.\n\n  Compare the broken workflow with any of the following variants (all of\n  which work as expected):\n\n  - don't use `--intent-to-add`:\n\n      git init\n      for dir in a b c; do mkdir $dir && seq 1 20 > $dir/file; done\n      git add -A && git commit -m'Some content'\n      git sparse-checkout set --sparse-index b\n      seq 1 20 > b/file-2\n      git add b/file-2\n      git status\n\n  - don't use `sparse-checkout` at all:\n\n      git init\n      for dir in a b c; do mkdir $dir && seq 1 20 > $dir/file; done\n      git add -A && git commit -m'Some content'\n      seq 1 20 > b/file-2\n      git add -N b/file-2\n      git add -p b/file-2\n      git status\n\n  - don't use `--sparse-index` specifically:\n\n      git init\n      for dir in a b c; do mkdir $dir && seq 1 20 > $dir/file; done\n      git add -A && git commit -m'Some content'\n      git sparse-checkout set b\n      seq 1 20 > b/file-2\n      git add -N b/file-2\n      git add -p b/file-2\n      git status\n\nAnything else you want to add:\n\n  Seems very related to the use of sparse-index.\n\nPlease review the rest of the bug report below.\nYou can delete any lines you don't wish to share.\n\n\n[System Info]\ngit version:\ngit version 2.43.0.windows.1\ncpu: x86_64\nbuilt from commit: 4b968f3ea3b32a7bc50846bab49f3f381841d297\nsizeof-long: 4\nsizeof-size_t: 8\nshell-path: /bin/sh\nfeature: fsmonitor--daemon\nuname: Windows 10.0 19044\ncompiler info: gnuc: 13.2\nlibc info: no libc information available\n$SHELL (typically, interactive shell): C:\\Program Files\\Git\\usr\\bin\\bash.exe\n\n\n[Enabled Hooks]\n\n\n--\nSean Allred\n"}]}