Re: [PATCH 9/9] add has: query prefix to search for specific properties
[notmuch-archives.git] / 5b / bf17c85a379e8375b71dac9cab30173b33c3b3
1 Return-Path: <tomi.ollila@iki.fi>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 991A3431FB6\r
6         for <notmuch@notmuchmail.org>; Mon, 19 Jan 2015 01:44:48 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 2.438\r
10 X-Spam-Level: **\r
11 X-Spam-Status: No, score=2.438 tagged_above=-999 required=5\r
12         tests=[DNS_FROM_AHBL_RHSBL=2.438] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id 4W8muZ0hLuck for <notmuch@notmuchmail.org>;\r
16         Mon, 19 Jan 2015 01:44:44 -0800 (PST)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id 82E5F431FAF\r
19         for <notmuch@notmuchmail.org>; Mon, 19 Jan 2015 01:44:44 -0800 (PST)\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
21         by guru.guru-group.fi (Postfix) with ESMTP id 13C8F1000E0;\r
22         Mon, 19 Jan 2015 11:44:17 +0200 (EET)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: "W. Trevor King" <wking@tremily.us>, notmuch@notmuchmail.org\r
25 Subject: Re: [PATCH v4] nmbug: Add an 'init' command\r
26 In-Reply-To:\r
27  <b3d22d1d587a626e91f536f6393e476a41de84c9.1421627321.git.wking@tremily.us>\r
28 References:\r
29  <b3d22d1d587a626e91f536f6393e476a41de84c9.1421627321.git.wking@tremily.us>\r
30 User-Agent: Notmuch/0.19+29~g7367d27 (http://notmuchmail.org) Emacs/24.3.1\r
31         (x86_64-unknown-linux-gnu)\r
32 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
33         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
34         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
35 Date: Mon, 19 Jan 2015 11:44:16 +0200\r
36 Message-ID: <m2oapvf6kv.fsf@guru.guru-group.fi>\r
37 MIME-Version: 1.0\r
38 Content-Type: text/plain; charset=utf-8\r
39 Content-Transfer-Encoding: quoted-printable\r
40 X-BeenThere: notmuch@notmuchmail.org\r
41 X-Mailman-Version: 2.1.13\r
42 Precedence: list\r
43 List-Id: "Use and development of the notmuch mail system."\r
44         <notmuch.notmuchmail.org>\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
46         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
48 List-Post: <mailto:notmuch@notmuchmail.org>\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
51         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
52 X-List-Received-Date: Mon, 19 Jan 2015 09:44:48 -0000\r
53 \r
54 On Mon, Jan 19 2015, "W. Trevor King" <wking@tremily.us> wrote:\r
55 \r
56 > For folks that want to start versioning a new tag-space, instead of\r
57 > cloning one that someone else has already started.\r
58 >\r
59 > The empty-blob hash-object call avoids errors like:\r
60 >\r
61 >   $ nmbug commit\r
62 >   error: invalid object 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 f=\r
63 or\r
64 > 'tags/...'\r
65 >   fatal: git-write-tree: error building trees\r
66 >   'git HASH(0x9ef3eb8) write-tree' exited with nonzero value\r
67 >\r
68 > David Bremner suggested [1]:\r
69 >\r
70 >   $ git hash-object -w /dev/null\r
71 >\r
72 > instead of my Python version of:\r
73 >\r
74 >   $ git hash-object -w --stdin <&-\r
75 >\r
76 > but I expect that closing stdin is more portable than the /dev/null\r
77 > path (which doesn't exist on Windows, for example).\r
78 \r
79 I agree with this...\r
80 \r
81 I attempted to try this (being stup^H^H^H^Hadventurous and not backupping\r
82 ~/.nmbug -- should the existence be checked first ???) and got the followin=\r
83 g ;/\r
84 \r
85 $ python2.7 devel/nmbug/nmbug init\r
86 Reinitialized existing Git repository in /home/too/.nmbug/\r
87 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391\r
88 user.name not defined\r
89 [u'git', u'--git-dir', u'/home/too/.nmbug', u'commit', u'--allow-empty',\r
90 u'-m', u'Start a new nmbug repository'] exited with 1\r
91 zsh: exit 1     python2.7 devel/nmbug/nmbug init\r
92 \r
93 This is due to my default /path/to/git-templates/pre-commit forbidding\r
94 commits unless I've configured user.name & user.email for that particular\r
95 repository....\r
96 \r
97 I guess there is not much one can do to handle users' mystic global\r
98 hooks -- I'll look (later) whether e.g. '--no-hooks' parameter could be giv=\r
99 en\r
100 to nmbug from command line...\r
101 \r
102 ... Ok, it was --no-verify and patching that to the command line worked --\r
103 git complained that "Your name and email address were configured\r
104 automatically based on your username and hostname..." but commit succeeded =\r
105 :).\r
106 \r
107 ... but Now I issued nmbug init twice. now there are 2=20\r
108 \r
109     Start a new nmbug repository\r
110 \r
111 commits. I think it should be checked so that init on already-existing\r
112 repository does not succeed.\r
113 \r
114 \r
115 Tomi\r
116 \r
117 >\r
118 > The --bare init and use of NMBGIT as the work tree (what could go\r
119 > wrong with an empty commit?) are suggestions from Michal Sojka [2].\r
120 >\r
121 > [1]: id:87y4vu6uvf.fsf@maritornes.cs.unb.ca\r
122 >      http://thread.gmane.org/gmane.mail.notmuch.general/18626/focus=3D187=\r
123 20\r
124 > [2]: id:87a93a5or2.fsf@resox.2x.cz\r
125 >      http://thread.gmane.org/gmane.mail.notmuch.general/19495/focus=3D197=\r
126 67\r
127 > ---\r
128 > Since v3 [1] I've incorporated Michal's suggestions [2]:\r
129 >\r
130 > * Start with 'git --git-dir {NMBGIT} init --bare\r
131 > * Use NMBGIT instead of a temporary workdir when creating the initial\r
132 >   =E2=80=9CStart a new nmbug repository=E2=80=9D commit.\r
133 >\r
134 > As well as the core.logallrefupdates tweak I turned up in testing [3].\r
135 >\r
136 > [1]: id:113512958b3fd64902517c1c55576faef816f852.1414532174.git.wking@tre=\r
137 mily.us\r
138 >      http://thread.gmane.org/gmane.mail.notmuch.general/19495\r
139 > [2]: id:87a93a5or2.fsf@resox.2x.cz\r
140 >      http://thread.gmane.org/gmane.mail.notmuch.general/19495/focus=3D197=\r
141 67\r
142 > [3]: id:20141129201829.GI4062@odin.tremily.us\r
143 >      http://thread.gmane.org/gmane.mail.notmuch.general/19495/focus=3D197=\r
144 74\r
145 >\r
146 >  devel/nmbug/nmbug | 20 ++++++++++++++++++++\r
147 >  1 file changed, 20 insertions(+)\r
148 >\r
149 > diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug\r
150 > index 932ec12..1297345 100755\r
151 > --- a/devel/nmbug/nmbug\r
152 > +++ b/devel/nmbug/nmbug\r
153 > @@ -374,6 +374,25 @@ def fetch(remote=3DNone):\r
154 >      _git(args=3Dargs, wait=3DTrue)\r
155 >=20=20\r
156 >=20=20\r
157 > +def init(remote=3DNone):\r
158 > +    """\r
159 > +    Create an empty nmbug repository.\r
160 > +\r
161 > +    This wraps 'git init' with a few extra steps to support subsequent\r
162 > +    status and commit commands.\r
163 > +    """\r
164 > +    _spawn(args=3D['git', '--git-dir', NMBGIT, 'init', '--bare'], wait=\r
165 =3DTrue)\r
166 > +    _git(args=3D['config', 'core.logallrefupdates', 'true'], wait=3DTrue)\r
167 > +    # create an empty blob (e69de29bb2d1d6434b8b29ae775ad8c2e48c5391)\r
168 > +    _git(args=3D['hash-object', '-w', '--stdin'], input=3D'', wait=3DTru=\r
169 e)\r
170 > +    _git(\r
171 > +        args=3D[\r
172 > +            'commit', '--allow-empty', '-m', 'Start a new nmbug reposito=\r
173 ry'\r
174 > +        ],\r
175 > +        additional_env=3D{'GIT_WORK_TREE': NMBGIT},\r
176 > +        wait=3DTrue)\r
177 > +\r
178 > +\r
179 >  def checkout():\r
180 >      """\r
181 >      Update the notmuch database from Git.\r
182 > @@ -725,6 +744,7 @@ if __name__ =3D=3D '__main__':\r
183 >              'commit',\r
184 >              'fetch',\r
185 >              'help',\r
186 > +            'init',\r
187 >              'log',\r
188 >              'merge',\r
189 >              'pull',\r
190 > --=20\r
191 > 2.1.0.60.g85f0837\r