lazygit: discard/reset on folder can cause errors

Describe the bug

This only seems to apply to YAML files (extensions .unity, .asset) created in Unity3D. To make sure there are no handles to those files, every related program was closed first.

Using a hard reset on a folder from the Files panel (i.e. D > h) causes a list of errors in the form:

error: unable to unlink old 'path/to/file1': Invalid argument
error: unable to unlink old 'path/to/file2': Invalid argument
fatal: Could not reset index file to revision 'HEAD'

Using a hard reset on the same folder via the Local Branches panel (g > h) or directly from the command line does not cause those errors.

Same applies to using Discard Changes on a folder as opposed to individual files.

Expected behavior Discard all the changes without issues

Version info: commit=367b0d331836c90c015bf0c45f88612f3d94d08a, build date=2022-07-20T09:27:56Z, build source=binaryRelease, version=0.35, os=windows, arch=amd64

git version 2.37.3.windows.1

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 25 (2 by maintainers)

Most upvoted comments

I have another Windows PC, but with Windows 11 on it. I’ll try it on that and at least see if it’s machine/windows version related

I’m sorry, but I think you’ve been accidentally tagging mjarkk instead of mark2185 for the past couple of months.

Oh my goodness, apologies to both of you! (and hi @mjarkk I hope you’re doing well if you’re reading this)

@mjarkk this is another argument in favour of changing how we discard folders (i.e. just using git checkout)