{"thread":{"id":"57677","subject":"BUG: cannot remove new staged files in sparse checkout","startedAt":"2022-04-06T15:37:12Z","lastAt":"2022-04-06T16:32:52Z","messageCount":2,"participants":["Erik Cervin Edin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"453178","messageId":"CA+JQ7M-Haf3R8xp-sqyJXPZza3VeaRf9uK=tyuviNFVZ0kdBTw@mail.gmail.com","threadId":"57677","inReplyTo":null,"subject":"BUG: cannot remove new staged files in sparse checkout","fromName":"Erik Cervin Edin","fromEmail":"erik@cervined.in","sentAt":"2022-04-06T12:51:48Z","receivedAt":"2022-04-06T15:37:12Z","isPatch":false,"sender":{"key":"erik@cervined.in","avatar":null},"body":"Hi friends!\n\nI've stumbled across what I believe is a bug\n\nI've found myself with new files that are staged, not part of the\nsparse-checkout, that I cannot unstage using git restore --staged, ie\n  git restore --staged :\\\ndoes nothing.\n\nI'm able to get rid of the using\n  git stash && git stash drop\nbut intuitively I would expect restore --staged to work, even if the\nfiles are not part of the sparse checkout\n\nI end up in this peculiar situation by doing the following.\nHaving branches:\n  foo/bar\n  origin/foo\nand then running\n  git switch -c foo\nUpdatings files: 100% (X/X) done.\nfatal: cannot lock ref 'refs/heads/foo': 'refs/heads/foo/bar' exists;\ncannot create 'refs/heads/foo'\n"},{"id":"453181","messageId":"CA+JQ7M-CNYCUAWEi42=0d6LVHZREAm7bFN=BAxA9ZWmqmZ6K7Q@mail.gmail.com","threadId":"57677","inReplyTo":"CA+JQ7M-Haf3R8xp-sqyJXPZza3VeaRf9uK=tyuviNFVZ0kdBTw@mail.gmail.com","subject":"Re: BUG: cannot remove new staged files in sparse checkout","fromName":"Erik Cervin Edin","fromEmail":"erik@cervined.in","sentAt":"2022-04-06T13:52:28Z","receivedAt":"2022-04-06T16:32:52Z","isPatch":false,"sender":{"key":"erik@cervined.in","avatar":null},"body":"I should add this behavior was seen in\n  git version 2.35.1.windows.2\n"}]}