Can not delete asset that is marked for add with Git

This issue occurs in 4.15.1
also tested with 4.13.2 in this version the bug does not occur.

If you are running your project with git as source control and you have an asset that is marked for add.
If you now try to delete this asset it will disappear from the content browser but will still be on disk. After restarting the editor it is also visible again in the content browser.

Repro steps

  1. Create a clean project
  2. Choose git as source control provider and initialize the project with git
  3. Import any asset and save it, the asset will be marked for add
  4. Delete the asset, it will disappear from the content browser but still be on disk
  5. Restart the editor, the asset reappeared

As this bug does not occur in 4.13 I hope it gets fixed.

I think I found the source of the bug.
In 4.13 the revert operation for the asset is called before the file is deleted from disk, in 4.15 operations are batched and are performed after all requested files are deleted from disk.
This does not seem to work with git. The batched revert operation actually restores the file that is deleted before resulting in the file remaining on disk.

The code lines to look up is:
Line 1603-1666 in ObjectTools.cpp

I hope this helps to fix the issue

Hi ,

Sorry for the delayed response to your post. I was able to see the behavior that you described, and have entered UE-44637 to have this investigated further.

Hey @, I’ve made a fix for UE-44637 to my Git Plugin v2.
I will propose it as a Pull Request asap, probably tomorrow.

Edit: I created the PR 4062 for Epic Games

It will NOT be in UE4.18 (too late) so it will have to wait for UE4.19.

In the meantime, you could try to use my v2 of the plugin (with Git LFS 2 Files Locks :slight_smile:

Edit: the provided fix has been merged in master (main) for upcoming 4.19 as expected!

This has shipped in UE4.19 preview1