Git development
 help / color / mirror / Atom feed
* [BUG] `git add -p` seems to corrupt a sparse index
@ 2023-12-19 11:20 Sean Allred
  0 siblings, 0 replies; only message in thread
From: Sean Allred @ 2023-12-19 11:20 UTC (permalink / raw)
  To: git


What did you do before the bug happened? (Steps to reproduce your issue)

    git init
    for dir in a b c; do mkdir $dir && seq 1 20 > $dir/file; done
    git add -A && git commit -m'Some content'

    git sparse-checkout set --sparse-index b
    seq 1 20 > b/file-2
    git add -N b/file-2
    git add -p b/file-2
    git status

What did you expect to happen? (Expected behavior)

  I expected to be dropped into the interactive-add workflow / see my
  changes in git-status.

What happened instead? (Actual behavior)

  git-add reports 'No changes' and git-status reports nothing at all
  (empty output).

  The original internal report also was able reproduce messaging like

      fatal: cache entry out of order
      warning: die() called many times. Recursion error or racy threaded death!
      fatal: cache entry out of order
      fatal: cache entry out of order
      fatal: cache entry out of order

  though I've not been able to reproduce that myself. It seems relevant
  / worth noting that core.fsmonitor would be set to 'true' in that
  repository.

What's different between what you expected and what actually happened?

  git-status appears to silently crash in the error case.

  Compare the broken workflow with any of the following variants (all of
  which work as expected):

  - don't use `--intent-to-add`:

      git init
      for dir in a b c; do mkdir $dir && seq 1 20 > $dir/file; done
      git add -A && git commit -m'Some content'
      git sparse-checkout set --sparse-index b
      seq 1 20 > b/file-2
      git add b/file-2
      git status

  - don't use `sparse-checkout` at all:

      git init
      for dir in a b c; do mkdir $dir && seq 1 20 > $dir/file; done
      git add -A && git commit -m'Some content'
      seq 1 20 > b/file-2
      git add -N b/file-2
      git add -p b/file-2
      git status

  - don't use `--sparse-index` specifically:

      git init
      for dir in a b c; do mkdir $dir && seq 1 20 > $dir/file; done
      git add -A && git commit -m'Some content'
      git sparse-checkout set b
      seq 1 20 > b/file-2
      git add -N b/file-2
      git add -p b/file-2
      git status

Anything else you want to add:

  Seems very related to the use of sparse-index.

Please review the rest of the bug report below.
You can delete any lines you don't wish to share.


[System Info]
git version:
git version 2.43.0.windows.1
cpu: x86_64
built from commit: 4b968f3ea3b32a7bc50846bab49f3f381841d297
sizeof-long: 4
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon
uname: Windows 10.0 19044
compiler info: gnuc: 13.2
libc info: no libc information available
$SHELL (typically, interactive shell): C:\Program Files\Git\usr\bin\bash.exe


[Enabled Hooks]


--
Sean Allred

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-12-19 11:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-19 11:20 [BUG] `git add -p` seems to corrupt a sparse index Sean Allred

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox