notmuch and git

Adam Wolfe Gordon awg+notmuch at xvx.ca
Tue Oct 4 08:28:20 PDT 2011


On Mon, Oct 3, 2011 at 11:38, Tom Prince <tom.prince at ualberta.net> wrote:
> I know that having an exclude option for notmuch has been discussed a
> number of times. I have wanted such a feature to be able to ignore the
> .git directroy, since I keep my mail in a git repository. I recently
> discovered a workaround.
>
> If you make .git a text file containing
> ===== .git ====
> gitdir: .notmuch/git
> ===============
> and move the .git directory to .notmuch/git, git will behave as if it is
> a normal repository, and notmuch will ignore .notmuch/git. notmuch will
> warn once about .git not being a mail file, but since it is static, it
> won't warn about it every time one does 'notmuch new'.

I use another workaround, which doesn't require anything in the
notmuch directory:

I initialized a bare repository in /home/adam/.mailgit by running git
init --bare.  Then in my scripts I do:

export GIT_WORK_TREE=/home/adam/mail
cd /home/adam/.mailgit
git ... (any git commands you want)

Git uses the directory specified by GIT_WORK_TREE as the working tree
(where the actual files are), and the current directory as a bare
repository containing just the git metadata.

Because there's nothing git-related in /home/adam/mail, notmuch is
completely unaware of git.

-- 
Adam Wolfe Gordon


More information about the notmuch mailing list