gitgit-checkout

git tries to delete a directory on checkout


Whenever I switch between my branch (Li) to the master branch I get the following message:

Deletion of directory 'sys/console/api' failed. Should I try again? (y/n)

Anyone knows how do I get rid of this message? I think that in the past I tried to delete this directory by mistake and now I'm stuck with this error message.


Solution

  • This error message comes from this patch (in compat/mingw.c), and this one (also in compat/mingw.c).
    It usually means your directory is "busy", or isn't empty (but contains only private files, ie non-versioned files).

    So make sure that, when checking out a branch, you don't have a running process making your specific directory "busy".

    Ted M Young helpfully comments:

    Another definition of "busy" is that it's your current directory!
    It seems safest to do a cd to the root directory and then change directories to avoid this error.