1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
| | .. _notmuch-git(1):
===========
notmuch-git
===========
SYNOPSIS
========
**notmuch** **git** [-h] [-N] [-C *repo*] [-p *prefix*] [-v] [-l *log level*] *subcommand*
**nmbug** [-h] [-C *repo*] [-p *prefix*] [-v] [-l *log level*] *subcommand*
DESCRIPTION
===========
Manage notmuch tags with Git.
OPTIONS
-------
Supported options for `notmuch git` include
.. program:: notmuch-git
.. option:: -h, --help
show help message and exit
.. option:: -N, --nmbug
Set defaults for :option:`--tag-prefix` and :option:`--git-dir` suitable for the
:any:`notmuch` bug tracker
.. option:: -C <repo>, --git-dir <repo>
Operate on git repository *repo*. See :ref:`repo_location` for
defaults.
.. option:: -p <prefix>, --tag-prefix <prefix>
Operate only on tags with prefix *prefix*. See :ref:`prefix_val` for
defaults.
.. option:: -v, --version
show notmuch-git's version number and exit
.. option:: -l <level>, --log-level <level>
Log verbosity, one of: `critical`, `error`, `warning`, `info`,
`debug`. Defaults to `warning`.
SUBCOMMANDS
-----------
For help on a particular subcommand, run: 'notmuch-git ... <command> --help'.
.. program:: notmuch-git
.. option:: archive [tree-ish] [arg ...]
Dump a tar archive of a committed tag set using 'git archive'. See
:any:`format` for details of the archive contents.
.. describe:: tree-ish
The tree or commit to produce an archive for. Defaults to 'HEAD'.
.. describe:: arg
If present, any optional arguments are passed through to
:manpage:`git-archive(1)`. Arguments to `git-archive` are reordered
so that *tree-ish* comes last.
.. option:: checkout
Update the notmuch database from Git.
This is mainly useful to discard your changes in notmuch relative
to Git.
.. option:: clone <repository>
Create a local `notmuch git` repository from a remote source.
This wraps 'git clone', adding some options to avoid creating a
working tree while preserving remote-tracking branches and
upstreams.
.. describe:: repository
The (possibly remote) repository to clone from. See the URLS
section of :manpage:`git-clone(1)` for more information on
specifying repositories.
.. option:: commit [message]
Commit prefix-matching tags from the notmuch database to Git.
.. describe:: message
Optional text for the commit message.
.. option:: fetch [remote]
Fetch changes from the remote repository.
.. describe:: remote
Override the default configured in `branch.<name>.remote` to fetch
from a particular remote repository (e.g. `origin`).
.. option:: help
Show brief help for an `notmuch git` command.
.. option:: init
Create an empty `notmuch git` repository.
This wraps 'git init' with a few extra steps to support subsequent
status and commit commands.
.. option:: log [arg ...]
A wrapper for 'git log'.
.. describe:: arg
Additional arguments are passed through to 'git log'.
After running `notmuch git fetch`, you can inspect the changes with
::
$ notmuch git log HEAD..@{upstream}
.. option:: merge [reference]
Merge changes from 'reference' into HEAD and load the result into notmuch.
.. describe:: reference
Reference, usually other branch heads, to merge into our
branch. Defaults to `@{upstream}`.
.. option:: pull [repository] [refspec ...]
Pull (merge) remote repository changes to notmuch.
**pull** is equivalent to **fetch** followed by **merge**. We use the
Git-configured repository for your current branch
(`branch.<name>.repository`, likely `origin`, and `branch.<name>.merge`,
likely `master` or `main`).
.. describe:: repository
The "remote" repository that is the source of the pull. This parameter
can be either a URL (see the section GIT URLS in :manpage:`git-pull(1)`) or the
name of a remote (see the section REMOTES in :manpage:`git-pull(1)`).
.. describe:: refspec
Refspec (usually a branch name) to fetch and merge. See the
*refspec* entry in the OPTIONS section of :manpage:`git-pull(1`) for
other possibilities.
.. option:: push [repository] [refspec]
Push the local `notmuch git` Git state to a remote repository.
.. describe:: repository
The "remote" repository that is the destination of the push. This
parameter can be either a URL (see the section GIT URLS in
:manpage:`git-push(1)`) or the name of a remote (see the section
REMOTES in :manpage:`git-push(1)`).
.. describe:: refspec
Refspec (usually a branch name) to push. See the *refspec* entry in the OPTIONS section of
:manpage:`git-push(1)` for other possibilities.
.. option:: status
Show pending updates in notmuch or git repo.
Prints lines of the form
| ng Message-Id tag
where n is a single character representing notmuch database status
.. describe:: A
Tag is present in notmuch database, but not committed to nmbug
(equivalently, tag has been deleted in nmbug repo, e.g. by a
pull, but not restored to notmuch database).
.. describe:: D
Tag is present in nmbug repo, but not restored to notmuch
database (equivalently, tag has been deleted in notmuch).
.. describe:: U
Message is unknown (missing from local notmuch database).
The second character *g* (if present) represents a difference between
local and upstream branches. Typically `notmuch git fetch` needs to be
run to update this.
.. describe:: a
Tag is present in upstream, but not in the local Git branch.
.. describe:: d
Tag is present in local Git branch, but not upstream.
.. _format:
REPOSITORY CONTENTS
===================
The tags are stored in the git repo (and exported) as a set of empty
files. For a message with Message-Id *id*, for each tag *tag*, there
is an empty file with path
tags/ `encode` (*id*) / `encode` (*tag*)
The encoding preserves alphanumerics, and the characters `+-_@=.,:`.
All other octets are replaced with `%` followed by a two digit hex
number.
.. _repo_location:
REPOSITORY LOCATION
===================
:any:`notmuch-git` uses the first of the following with a non-empty
value to locate the git repository.
- Option :option:`--git-dir`.
- Environment variable :envvar:`NOTMUCH_GIT_DIR`.
- If invoked as `nmbug` or with the :option:`--nmbug` option,
:code:`$HOME/.nmbug`; otherwise
:code:`$XDG_DATA_HOME/notmuch/$NOTMUCH_PROFILE/git`.
.. _prefix_val:
PREFIX VALUE
============
:any:`notmuch-git` uses the first of the following with a non-null
value to define the tag prefix.
- Option :option:`--tag-prefix`.
- Environment variable :envvar:`NOTMUCH_GIT_PREFIX`.
- If invoked as `nmbug` or with the :option:`--nmbug` option,
:code:`notmuch::`, otherwise the empty string.
ENVIRONMENT
===========
Variable :envvar:`NOTMUCH_PROFILE` influences :ref:`repo_location`.
If it is unset, 'default' is assumed.
.. envvar:: NOTMUCH_GIT_DIR
Default location of git repository. Overriden by :option:`--git-dir`.
.. envvar:: NOTMUCH_GIT_PREFIX
Default tag prefix (filter). Overriden by :option:`--tag-prefix`.
SEE ALSO
========
:any:`notmuch(1)`,
:any:`notmuch-dump(1)`,
:any:`notmuch-restore(1)`,
:any:`notmuch-tag(1)`
|