@@ -202,9 +202,45 @@ You can find more about conversions with reposurgeon
202202### Reviews
203203-->
204204
205- <!-- -
206205### Support
207- -->
206+
207+ * [ Broken branch after git commit
] ( https://lore.kernel.org/git/[email protected] / ) 208+
209+ Torsten Krah wrote that after using ` git restore --staged $my-files `
210+ to remove some files from the index, but not the working tree, and
211+ then ` git commit ` to commit other changes, he found that the files
212+ were marked as deleted in the index though they are still in the
213+ working tree.
214+
215+ He didn't understand what happened and didn't know how to fix the
216+ situation. He later added that the ` git commit ` he had done had
217+ actually commited the files even though ` git status ` told him that
218+ the files wouldn't go into the commit. And he also sent instructions
219+ to help reproduce the issue.
220+
221+ Jeff King, alias Peff, replied to Torsten saying that he couldn't
222+ reproduce the issue and asking for more details and examples.
223+
224+ Torsten then sent an example with a lot more details which enabled
225+ Peff to reproduce the issue. Peff confirmed that there was a bug in
226+ ` git restore ` and also found that the index-reading code could
227+ segfault when it processes bogus cache-trees.
228+
229+ Peff also mentioned that Emily Shaffer had recently found a similar
230+ segfault and that she had provided
[ a fix
] ( https://lore.kernel.org/git/[email protected] / ) ,
231+ and then came up with
[ a patch
] ( https://lore.kernel.org/git/[email protected] / ) 232+ to fix the bug in ` git restore --staged ` .
233+
234+ Junio Hamano, the Git maintainer, review the patch and praised Peff,
235+ while Dennis Kaarsemaker reported just being bitten by seemingly the
236+ same bug.
237+
238+ In the meantime Torsten also thanked Peff for investigating the
239+ issue and asked for a way to fix his current index. Peff suggested
240+ using ` git reset --hard <original-commit> ` after finding the
241+ original commit in the reflog. Torsten replied that he actually had
242+ to remove the index using ` rm .git/index ` first to get back to a
243+ working state.
208244
209245<!-- -
210246## Developer Spotlight:
0 commit comments