[PATCH 12/16] CLI/git: rename private index file.

Subject:[PATCH 12/16] CLI/git: rename private index file.

Date:Sat, 23 Apr 2022 10:38:44 -0300

To:notmuch@notmuchmail.org

Cc:

From:David Bremner


All files created by notmuch-git should be in a private directory to
avoid collisions.
---
 notmuch-git.in | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/notmuch-git.in b/notmuch-git.in
index 0d9f50a1..b69d57e7 100755
--- a/notmuch-git.in
+++ b/notmuch-git.in
@@ -638,8 +638,9 @@ def get_status():
 
 @timed
 def _index_tags():
-    "Write notmuch tags to the nmbug.index."
-    path = _os.path.join(NMBGIT, 'nmbug.index')
+    "Write notmuch tags to private git index."
+    ensure_private_directory(NMBGIT)
+    path = _os.path.join(NMBGIT, 'notmuch','index')
     prefix = '+{0}'.format(_ENCODED_TAG_PREFIX)
     _git(
         args=['read-tree', '--empty'],
@@ -747,6 +748,12 @@ def _help(parser, command=None):
         parser.parse_args(['--help'])
 
 
+def ensure_private_directory(repo):
+    try:
+        _os.makedirs(_os.path.join(repo, 'notmuch'))
+    except FileExistsError:
+        pass
+
 if __name__ == '__main__':
     import argparse
 
-- 
2.35.2

_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: