Skip to main content

fish_functions: add other Python tool dirs to .git/info/exclude

ID
bdb083a
date
2025-08-13 06:32:04+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
de6b484
message
fish_functions: add other Python tool dirs to `.git/info/exclude`
changed files
1 file, 12 additions

Changed files

fish_functions/venv.fish (1495) → fish_functions/venv.fish (2083)

diff --git a/fish_functions/venv.fish b/fish_functions/venv.fish
index 6bf454a..acca34a 100644
--- a/fish_functions/venv.fish
+++ b/fish_functions/venv.fish
@@ -33,6 +33,18 @@ function venv --description "Create and activate a new virtual environment"
     if test -e .git
         append_to_file_if_not_exists ".git/info/exclude" ".venv"
     end
+    
+    # Append some other common Python tool directories to the Git
+    # exclude file.  These tools already write a `.gitignore` entry
+    # for all the files they contain, but not the folder.
+    #
+    # This is necessary for Nova, a macOS text editor I sometimes use.
+    if test -e .git
+        append_to_file_if_not_exists ".git/info/exclude" ".mypy_cache"
+        append_to_file_if_not_exists ".git/info/exclude" ".pytest_cache"
+        append_to_file_if_not_exists ".git/info/exclude" ".ruff_cache"
+        append_to_file_if_not_exists ".git/info/exclude" "__pycache__"
+    end
 
     # Tell Time Machine that it doesn't need to both backing up the
     # virtualenv directory.