Sublime Forum

Sublime Text prevents ejecting external drive (git-related problem)


Sublime Text 3 appears to create and use a temporary file on one of my external drives, even though I am not editing any file on that drive.

This is Sublime version 3.2.1, Build 3207 on a Mac running macOS 10.13.6 .

The external drive is inserted in the SD-CARD slot and formatted with APFS file system.

Because the file is in use, I cannot eject the drive.

Error message:
Transcend - Sublime Text is using pack-4217dd303211fbb43114b2929dfe02afc293744c.pack

After I quit Sublime Text I can eject the external drive.

I think this is a bug, temporary files should only be created on the boot drive or internal drives.

Edit: The external drive contains the git repository for one of the folders I am working with in Sublime. But Sublime should never write directly to a git repo, or does it?



.pack files are very likely git repository files, not temp files.
I don’t think ST write anything in it, it’s only opened for reading and OS warn you when you want to unmount the filesystem.

IMHO, nothing wrong here.



I think it’s a bug because I cannot eject my external drive while Sublime Text is running.

My other git clients do not prevent me from ejecting the drive, only Sublime Text.

Can I disable Sublime’s git functions, preferably on a per Workspace basis?

With this in Settings:
“show_git_status”: false,

I fixed the problem.

But now I lost git functionality of Sublime in all workspaces.



To clarify I should add that for this workspace the repository (which normally would reside in .git) is stored on the external drive, even though the workspace is on the internal drive.

This is a special feature of git as explained here:

But this is a documented feature of git and works with no problem with all my other git clients. They don’t keep files open permanently, just open them when needed.



I have confirmed recently that the current implementation of the Git status in Sublime Text does prevent unmounting NFS drives on Mac and Linux and appears (as you’ve indicated) to prevent ejecting external drives also.

The difference between Sublime Text and other clients is likely that we’ve strived to make things as fast as possible. Currently we mmap the git pack files to improve performance when reading them so that we don’t have pauses when performing various git operations, especially when files on disk are changing.

I’m planning on looking into this issue to see how we can retain the performance, but allow the OS to eject the drive without closing Sublime Text first.

1 Like