feature freeze for notmuch 0.19

2014-10-28 Thread David Bremner

Hi Gang;

As always we have plenty of things on the go, but I think theres enough
merged in since 0.18.2 (yesterday!) to make a release worthwhile. To
pick a date completely at random *cough* I'd like to freeze on November
5. For those of you just joining us that means I'll merge master to
release at that point, and then only take "important" bug fix and NEWS
patches onto release for the next week or so, followed by a release.

d

-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 647 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20141028/0340943d/attachment.pgp>


[PATCH] test: fix test_require_external_prereq gdb in insert test

2014-10-28 Thread David Bremner
Jani Nikula  writes:


>> Of course you're right that moving it forward to only skip the gdb
>> requiring tests is the right thing to do, and in that setting having a
>> skipped message for all 10 skipped tests is a bit ugly. OTOHO your
>> version doesn't give any output at all, which seems not perfect either.
>
> How does it work if you just move the prereq test forward?
>

Then we get one message per skipped test. So twenty lines it total.

 missing prerequisites: gdb(1)
 SKIP   error exit when add_message returns OUT_OF_MEMORY
 missing prerequisites: gdb(1)
 SKIP   success exit with --keep when add_message returns OUT_OF_MEMORY
 missing prerequisites: gdb(1)
 SKIP   error exit when add_message returns XAPIAN_EXCEPTION
 missing prerequisites: gdb(1)
 SKIP   success exit with --keep when add_message returns XAPIAN_EXCEPTION
 missing prerequisites: gdb(1)
 SKIP   error exit when add_message returns FILE_NOT_EMAIL
 missing prerequisites: gdb(1)
 SKIP   success exit with --keep when add_message returns FILE_NOT_EMAIL
 missing prerequisites: gdb(1)
 SKIP   error exit when add_message returns READ_ONLY_DATABASE
 missing prerequisites: gdb(1)
 SKIP   success exit with --keep when add_message returns READ_ONLY_DATABASE
 missing prerequisites: gdb(1)
 SKIP   error exit when add_message returns UPGRADE_REQUIRED
 missing prerequisites: gdb(1)
 SKIP   success exit with --keep when add_message returns UPGRADE_REQUIRED


[PATCH] test: fix test_require_external_prereq gdb in insert test

2014-10-28 Thread Jani Nikula
On Tue, 28 Oct 2014, David Bremner  wrote:
> Jani Nikula  writes:
>
>> You need to actually check the return value. Limit the missing deps
>> part to subtests requiring gdb.
>
> For me, on a system without gdb, the current version looks like
>
> T070-insert: Testing "notmuch insert"
>  missing prerequisites: gdb(1)
>  SKIP   all tests in T070-insert
>
> This seems OK to me?

More than okay. /me hides.

> Of course you're right that moving it forward to only skip the gdb
> requiring tests is the right thing to do, and in that setting having a
> skipped message for all 10 skipped tests is a bit ugly. OTOHO your
> version doesn't give any output at all, which seems not perfect either.

How does it work if you just move the prereq test forward?

BR,
Jani.


[PATCH] emacs: add stash support for git send-email command line

2014-10-28 Thread Jani Nikula
Stash From/To/Cc as --to/--to/--cc, respectively, and Message-Id as
--in-reply-to, suitable for pasting to git send-email command line.
---
 emacs/notmuch-show.el | 25 +
 1 file changed, 25 insertions(+)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index a9974826e824..328c93ba0584 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1274,6 +1274,7 @@ reset based on the original query."
 (define-key map "t" 'notmuch-show-stash-to)
 (define-key map "l" 'notmuch-show-stash-mlarchive-link)
 (define-key map "L" 'notmuch-show-stash-mlarchive-link-and-go)
+(define-key map "G" 'notmuch-show-stash-git-send-email)
 (define-key map "?" 'notmuch-subkeymap-help)
 map)
   "Submap for stash commands")
@@ -2125,6 +2126,30 @@ the user (see 
`notmuch-show-stash-mlarchive-link-alist')."
   (notmuch-show-stash-mlarchive-link mla)
   (browse-url (current-kill 0 t)))

+(defun notmuch-show-stash-git-helper (addresses prefix)
+  "Escape, trim, and add PREFIX to each address in list of ADDRESSES."
+  (when addresses
+(mapconcat (lambda (x)
+(concat prefix "\""
+;; escape double-quotes
+(replace-regexp-in-string
+ "\"" "\""
+ ;; trim leading and trailing spaces
+ (replace-regexp-in-string
+  "\\(^ *\\| *$\\)" ""
+  x)) "\" "))
+  addresses "")))
+
+(defun notmuch-show-stash-git-send-email ()
+  "Copy From/To/Cc/Message-Id of current message to kill-ring in a form 
suitable for pasting to git send-email command line."
+  (interactive)
+  (notmuch-common-do-stash
+   (concat
+(notmuch-show-stash-git-helper (message-tokenize-header 
(notmuch-show-get-from)) "--to=")
+(notmuch-show-stash-git-helper (message-tokenize-header 
(notmuch-show-get-to)) "--to=")
+(notmuch-show-stash-git-helper (message-tokenize-header 
(notmuch-show-get-cc)) "--cc=")
+(concat "--in-reply-to=\"" (notmuch-show-get-message-id t) "\""
+
 ;; Interactive part functions and their helpers

 (defun notmuch-show-generate-part-buffer (message-id nth)
-- 
2.1.1



[PATCH] test: fix test_require_external_prereq gdb in insert test

2014-10-28 Thread Jani Nikula
You need to actually check the return value. Limit the missing deps
part to subtests requiring gdb.
---
 test/T070-insert.sh | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/test/T070-insert.sh b/test/T070-insert.sh
index 168345c9897b..b21609833228 100755
--- a/test/T070-insert.sh
+++ b/test/T070-insert.sh
@@ -2,8 +2,6 @@
 test_description='"notmuch insert"'
 . ./test-lib.sh

-test_require_external_prereq gdb
-
 # Create directories and database before inserting.
 mkdir -p "$MAIL_DIR"/{cur,new,tmp}
 mkdir -p "$MAIL_DIR"/Drafts/{cur,new,tmp}
@@ -185,6 +183,8 @@ test_expect_code 1 "Invalid tags set exit code" \

 notmuch config set new.tags $OLDCONFIG

+if test_require_external_prereq gdb; then
+
 # DUPLICATE_MESSAGE_ID is not tested here, because it should actually pass.

 for code in OUT_OF_MEMORY XAPIAN_EXCEPTION FILE_NOT_EMAIL \
@@ -211,4 +211,6 @@ gdb --batch-silent --return-child-result -x 
index-file-$code.gdb \
 test_expect_equal $? 0
 done

+fi # gdb
+
 test_done
-- 
2.1.1



[PATCH] Avoid empty thread names if possible.

2014-10-28 Thread Jani Nikula
On Wed, 08 Oct 2014, Sergei Shilovsky  wrote:
> I would also suggest to drop subjects consisting of only "Re:" and
> "Fwd" sequences

I think it's okay to avoid empty thread names at the lib level; however
I think any further processing should be done near the user interface.

BR,
Jani.



[PATCH] test: add simple tests for post-insert hook

2014-10-28 Thread David Bremner
Jani Nikula  writes:

>
> I presume the two lines above...
>
>> +notmuch insert < "$gen_msg_filename"
>> +echo $?
>
> ...and this line are leftover debug messages?

Uh, yeah. I should have fixed those a while ago when Tomi pointed them
out.

>
> Otherwise LGTM. I guess this could be expanded with a subtest checking
> that the hook does not get run on errors, and does get run with some
> errors that are ignored with --keep.

OK, I pushed these tests for now (less the debugging output).

d


[PATCH] lib: make notmuch_query_count_messages exact

2014-10-28 Thread Jani Nikula
On Tue, 14 Oct 2014, Jani Nikula  wrote:
> Our tests have expected this to be exact all along, but maybe
> inaccuracies only show up with big databases.

>From my IRC logs on Thu Oct 16 2014

j4ni   olly: does this do what it claims?
   http://mid.gmane.org/1413304374-17997-1-git-send-email-jani at nikula.org
olly   j4ni: not really
olly   if you don't set check at least it defaults to the number of
   requested matches
olly   so the code part is effectively a no-op
olly   but the reported number will be exact already so the comment
   changes are right
olly   i guess you could argue there's some merit in passing it explicitly
   in case someone decreases the request number of results

> ---
>  devel/TODO| 5 -
>  lib/notmuch.h | 6 +++---
>  lib/query.cc  | 7 ++-
>  3 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/devel/TODO b/devel/TODO
> index 1cf4089f1d93..116194d82ad1 100644
> --- a/devel/TODO
> +++ b/devel/TODO
> @@ -188,11 +188,6 @@ into the shared-library interface.
>  Audit all libnotmuch entry points to ensure that all Xapian calls are
>  wrapped in a try/catch block.
>  
> -Fix the "count" functionality to be exact as Olly explained in IRC:
> -
> - ojwb> cworth: if you set the check_at_least parameter to the
> - database size, get_matches_estimated() will be exact
> -
>  Fix the threading of a message that has a References: header but no
>  In-Reply-To: header (see id:"87lixxnxpb.fsf at yoom.home.cworth.org").
>  
> diff --git a/lib/notmuch.h b/lib/notmuch.h
> index dae041640fdb..6091082617e7 100644
> --- a/lib/notmuch.h
> +++ b/lib/notmuch.h
> @@ -893,10 +893,10 @@ void
>  notmuch_threads_destroy (notmuch_threads_t *threads);
>  
>  /**
> - * Return an estimate of the number of messages matching a search.
> + * Return the number of messages matching a search.
>   *
> - * This function performs a search and returns Xapian's best
> - * guess as to number of matching messages.
> + * This function performs a search and returns the number of matching
> + * messages.
>   *
>   * If a Xapian exception occurs, this function may return 0 (after
>   * printing a message).
> diff --git a/lib/query.cc b/lib/query.cc
> index 60ff8bd9a39e..ce26e3f3e4ed 100644
> --- a/lib/query.cc
> +++ b/lib/query.cc
> @@ -557,7 +557,12 @@ notmuch_query_count_messages (notmuch_query_t *query)
>  
>   enquire.set_query (final_query);
>  
> - mset = enquire.get_mset (0, notmuch->xapian_db->get_doccount ());
> + /*
> +  * Set the checkatleast parameter to the number of documents
> +  * in the database to make get_matches_estimated() exact.
> +  */
> + mset = enquire.get_mset (0, notmuch->xapian_db->get_doccount (),
> +  notmuch->xapian_db->get_doccount ());
>  
>   count = mset.get_matches_estimated();
>  
> -- 
> 2.1.1


[PATCH] test: add simple tests for post-insert hook

2014-10-28 Thread Jani Nikula
On Sat, 18 Oct 2014, David Bremner  wrote:
> Most of the existing tests for pre/post-new hook don't seem to apply.
> ---
>  test/T400-hooks.sh | 18 ++
>  1 file changed, 18 insertions(+)
>
> diff --git a/test/T400-hooks.sh b/test/T400-hooks.sh
> index 77e8569..e741211 100755
> --- a/test/T400-hooks.sh
> +++ b/test/T400-hooks.sh
> @@ -30,6 +30,8 @@ rm_hooks () {
>  
>  # add a message to generate mail dir and database
>  add_message
> +# create maildir structure for notmuch-insert
> +mkdir -p "$MAIL_DIR"/{cur,new,tmp}
>  
>  test_begin_subtest "pre-new is run"
>  rm_hooks
> @@ -45,6 +47,16 @@ create_echo_hook "post-new" expected output
>  notmuch new > /dev/null
>  test_expect_equal_file expected output
>  
> +test_begin_subtest "post-insert hook is run"
> +rm_hooks
> +generate_message
> +create_echo_hook "post-insert" expected output
> +echo $gen_msg_filename
> +cat output

I presume the two lines above...

> +notmuch insert < "$gen_msg_filename"
> +echo $?

...and this line are leftover debug messages?

Otherwise LGTM. I guess this could be expanded with a subtest checking
that the hook does not get run on errors, and does get run with some
errors that are ignored with --keep.

BR,
Jani.

> +test_expect_equal_file expected output
> +
>  test_begin_subtest "pre-new is run before post-new"
>  rm_hooks
>  generate_message
> @@ -82,6 +94,12 @@ test_expect_equal_file expected output
>  # depends on the previous subtest leaving broken hook behind
>  test_expect_code 1 "post-new non-zero exit status (notmuch status)" "notmuch 
> new"
>  
> +rm_hooks
> +generate_message
> +create_failing_hook "post-insert"
> +test_expect_success "post-insert hook does not affect insert status" \
> +"notmuch insert < \"$gen_msg_filename\" > /dev/null"
> +
>  # test_begin_subtest "hook without executable permissions"
>  rm_hooks
>  mkdir -p ${HOOK_DIR}
> -- 
> 2.1.1
>
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] test: fix test_require_external_prereq gdb in insert test

2014-10-28 Thread David Bremner
Jani Nikula  writes:

> You need to actually check the return value. Limit the missing deps
> part to subtests requiring gdb.

For me, on a system without gdb, the current version looks like

T070-insert: Testing "notmuch insert"
 missing prerequisites: gdb(1)
 SKIP   all tests in T070-insert

This seems OK to me?

Of course you're right that moving it forward to only skip the gdb
requiring tests is the right thing to do, and in that setting having a
skipped message for all 10 skipped tests is a bit ugly. OTOHO your
version doesn't give any output at all, which seems not perfect either.



[RFC][PATCH v1] emacs: Improve the behaviour of the 'q' binding.

2014-10-28 Thread Jani Nikula
On Thu, 16 Oct 2014, David Edmondson  wrote:
> When a user hits 'q' in a notmuch buffer, kill the buffer only if
> there are no other windows currently showing it.
> ---
>
> This arose from a discussion in #notmuch. Please try it and see if you
> like the new behaviour.

Yes, very much, thank you. In most cases I want 'q' to only affect the
current window. I like to be able to 'C-x 2' a search view, and have the
two windows work more or less independently.

BR,
Jani.


>
>  emacs/notmuch-lib.el | 8 ++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
> index 1e166c6..bc6f119 100644
> --- a/emacs/notmuch-lib.el
> +++ b/emacs/notmuch-lib.el
> @@ -240,9 +240,13 @@ depending on the value of `notmuch-poll-script'."
>  (call-process notmuch-command nil nil nil "new")))
>  
>  (defun notmuch-kill-this-buffer ()
> -  "Kill the current buffer."
> +  "Undisplay the current buffer."
>(interactive)
> -  (kill-buffer (current-buffer)))
> +  ;; If more than one window is showing this buffer, bury rather than
> +  ;; kill it.
> +  (if (> (length (get-buffer-window-list nil nil t)) 1)
> +  (bury-buffer)
> +(kill-buffer)))
>  
>  (defun notmuch-documentation-first-line (symbol)
>"Return the first line of the documentation string for SYMBOL."
> -- 
> 2.1.1
>
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v3] nmbug: Add an 'init' command

2014-10-28 Thread W. Trevor King
For folks that want to start versioning a new tag-space, instead of
cloning one that someone else has already started.

The empty-blob hash-object call avoids errors like:

  $ nmbug commit
  error: invalid object 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 for
'tags/...'
  fatal: git-write-tree: error building trees
  'git HASH(0x9ef3eb8) write-tree' exited with nonzero value

David Bremner suggested [1]:

  $ git hash-object -w /dev/null

instead of my Python version of:

  $ git hash-object -w --stdin <&-

but I expect that closing stdin is more portable than the /dev/null
path (which doesn't exist on Windows, for example).

[1]: id:87y4vu6uvf.fsf at maritornes.cs.unb.ca
 http://thread.gmane.org/gmane.mail.notmuch.general/18626/focus=18720
---
The only change since v2 [1] is a commit-message tweak:

* Mention Windows as an OS with stdin but no /dev/null [2].

Cheers,
Trevor

[1]: id:eaa9cf1cb3c00c591dc675c0f314ca31909ff74c.1412965476.git.wking at 
tremily.us
 http://thread.gmane.org/gmane.mail.notmuch.general/19289
[2]: id:20141011071000.GB10926 at odin.tremily.us
 http://article.gmane.org/gmane.mail.notmuch.general/19294

 devel/nmbug/nmbug | 24 
 1 file changed, 24 insertions(+)

diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug
index 9402ead..23bac5c 100755
--- a/devel/nmbug/nmbug
+++ b/devel/nmbug/nmbug
@@ -373,6 +373,29 @@ def fetch(remote=None):
 _git(args=args, wait=True)


+def init(remote=None):
+"""
+Create an empty nmbug repository.
+
+This wraps 'git init' with a few extra steps to support subsequent
+status and commit commands.
+"""
+with _tempfile.TemporaryDirectory(prefix='nmbug-init.') as workdir:
+_spawn(
+args=['git', 'init', '--separate-git-dir', NMBGIT, workdir],
+wait=True)
+_git(args=['config', '--unset', 'core.worktree'], wait=True)
+_git(args=['config', 'core.bare', 'true'], wait=True)
+# create an empty blob (e69de29bb2d1d6434b8b29ae775ad8c2e48c5391)
+_git(args=['hash-object', '-w', '--stdin'], input='', wait=True)
+_git(
+args=[
+'commit', '--allow-empty', '-m', 'Start a new nmbug repository'
+],
+additional_env={'GIT_WORK_TREE': workdir},
+wait=True)
+
+
 def checkout():
 """
 Update the notmuch database from Git.
@@ -703,6 +726,7 @@ if __name__ == '__main__':
 'clone',
 'commit',
 'fetch',
+'init',
 'log',
 'merge',
 'pull',
-- 
2.1.0.60.g85f0837



[PATCH] gitignore: ignore sh.config and doc/config.dox

2014-10-28 Thread David Bremner

pushed.

d



[PATCH] cli: cast timeval fields to long for format

2014-10-28 Thread David Bremner
Jani Nikula  writes:

> This hides platform differences between struct timeval field types.

pushed

d


[PATCH] cli: cast timeval fields to long for format

2014-10-28 Thread Tomi Ollila
On Tue, Oct 28 2014, Jani Nikula  wrote:

> This hides platform differences between struct timeval field types.

LGTM.

Tomi

> ---
>  notmuch-insert.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/notmuch-insert.c b/notmuch-insert.c
> index 7074077..0d2d810 100644
> --- a/notmuch-insert.c
> +++ b/notmuch-insert.c
> @@ -197,7 +197,7 @@ tempfilename (const void *ctx)
>  gettimeofday (, NULL);
>  
>  filename = talloc_asprintf (ctx, "%ld.M%ldP%d.%s",
> - tv.tv_sec, tv.tv_usec, pid, hostname);
> + (long) tv.tv_sec, (long) tv.tv_usec, pid, 
> hostname);
>  if (! filename)
>   fprintf (stderr, "Error: %s\n", strerror (ENOMEM));
>  
> -- 
> 1.7.2.5
>
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] cli: cast timeval fields to long for format

2014-10-28 Thread Jani Nikula
This hides platform differences between struct timeval field types.
---
 notmuch-insert.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/notmuch-insert.c b/notmuch-insert.c
index 7074077..0d2d810 100644
--- a/notmuch-insert.c
+++ b/notmuch-insert.c
@@ -197,7 +197,7 @@ tempfilename (const void *ctx)
 gettimeofday (, NULL);

 filename = talloc_asprintf (ctx, "%ld.M%ldP%d.%s",
-   tv.tv_sec, tv.tv_usec, pid, hostname);
+   (long) tv.tv_sec, (long) tv.tv_usec, pid, 
hostname);
 if (! filename)
fprintf (stderr, "Error: %s\n", strerror (ENOMEM));

-- 
1.7.2.5



[PATCH] cli: cast timeval fields to long for format

2014-10-28 Thread David Edmondson
On Tue, Oct 28 2014, Jani Nikula wrote:
> This hides platform differences between struct timeval field types.

Good for me. Tested on Debian Testing and OS X 10.10 (which previously
emitted a compiler warning).

> ---
>  notmuch-insert.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/notmuch-insert.c b/notmuch-insert.c
> index 7074077..0d2d810 100644
> --- a/notmuch-insert.c
> +++ b/notmuch-insert.c
> @@ -197,7 +197,7 @@ tempfilename (const void *ctx)
>  gettimeofday (, NULL);
>  
>  filename = talloc_asprintf (ctx, "%ld.M%ldP%d.%s",
> - tv.tv_sec, tv.tv_usec, pid, hostname);
> + (long) tv.tv_sec, (long) tv.tv_usec, pid, 
> hostname);
>  if (! filename)
>   fprintf (stderr, "Error: %s\n", strerror (ENOMEM));
>  
> -- 
> 1.7.2.5
>
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] cli: cast timeval fields to long for format

2014-10-28 Thread Jani Nikula
This hides platform differences between struct timeval field types.
---
 notmuch-insert.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/notmuch-insert.c b/notmuch-insert.c
index 7074077..0d2d810 100644
--- a/notmuch-insert.c
+++ b/notmuch-insert.c
@@ -197,7 +197,7 @@ tempfilename (const void *ctx)
 gettimeofday (tv, NULL);
 
 filename = talloc_asprintf (ctx, %ld.M%ldP%d.%s,
-   tv.tv_sec, tv.tv_usec, pid, hostname);
+   (long) tv.tv_sec, (long) tv.tv_usec, pid, 
hostname);
 if (! filename)
fprintf (stderr, Error: %s\n, strerror (ENOMEM));
 
-- 
1.7.2.5

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] cli: cast timeval fields to long for format

2014-10-28 Thread David Edmondson
On Tue, Oct 28 2014, Jani Nikula wrote:
 This hides platform differences between struct timeval field types.

Good for me. Tested on Debian Testing and OS X 10.10 (which previously
emitted a compiler warning).

 ---
  notmuch-insert.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

 diff --git a/notmuch-insert.c b/notmuch-insert.c
 index 7074077..0d2d810 100644
 --- a/notmuch-insert.c
 +++ b/notmuch-insert.c
 @@ -197,7 +197,7 @@ tempfilename (const void *ctx)
  gettimeofday (tv, NULL);
  
  filename = talloc_asprintf (ctx, %ld.M%ldP%d.%s,
 - tv.tv_sec, tv.tv_usec, pid, hostname);
 + (long) tv.tv_sec, (long) tv.tv_usec, pid, 
 hostname);
  if (! filename)
   fprintf (stderr, Error: %s\n, strerror (ENOMEM));
  
 -- 
 1.7.2.5

 ___
 notmuch mailing list
 notmuch@notmuchmail.org
 http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] cli: cast timeval fields to long for format

2014-10-28 Thread Tomi Ollila
On Tue, Oct 28 2014, Jani Nikula j...@nikula.org wrote:

 This hides platform differences between struct timeval field types.

LGTM.

Tomi

 ---
  notmuch-insert.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

 diff --git a/notmuch-insert.c b/notmuch-insert.c
 index 7074077..0d2d810 100644
 --- a/notmuch-insert.c
 +++ b/notmuch-insert.c
 @@ -197,7 +197,7 @@ tempfilename (const void *ctx)
  gettimeofday (tv, NULL);
  
  filename = talloc_asprintf (ctx, %ld.M%ldP%d.%s,
 - tv.tv_sec, tv.tv_usec, pid, hostname);
 + (long) tv.tv_sec, (long) tv.tv_usec, pid, 
 hostname);
  if (! filename)
   fprintf (stderr, Error: %s\n, strerror (ENOMEM));
  
 -- 
 1.7.2.5

 ___
 notmuch mailing list
 notmuch@notmuchmail.org
 http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] cli: cast timeval fields to long for format

2014-10-28 Thread David Bremner
Jani Nikula j...@nikula.org writes:

 This hides platform differences between struct timeval field types.

pushed

d
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] gitignore: ignore sh.config and doc/config.dox

2014-10-28 Thread David Bremner

pushed.

d

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [RFC][PATCH v1] emacs: Improve the behaviour of the 'q' binding.

2014-10-28 Thread Jani Nikula
On Thu, 16 Oct 2014, David Edmondson d...@dme.org wrote:
 When a user hits 'q' in a notmuch buffer, kill the buffer only if
 there are no other windows currently showing it.
 ---

 This arose from a discussion in #notmuch. Please try it and see if you
 like the new behaviour.

Yes, very much, thank you. In most cases I want 'q' to only affect the
current window. I like to be able to 'C-x 2' a search view, and have the
two windows work more or less independently.

BR,
Jani.



  emacs/notmuch-lib.el | 8 ++--
  1 file changed, 6 insertions(+), 2 deletions(-)

 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
 index 1e166c6..bc6f119 100644
 --- a/emacs/notmuch-lib.el
 +++ b/emacs/notmuch-lib.el
 @@ -240,9 +240,13 @@ depending on the value of `notmuch-poll-script'.
  (call-process notmuch-command nil nil nil new)))
  
  (defun notmuch-kill-this-buffer ()
 -  Kill the current buffer.
 +  Undisplay the current buffer.
(interactive)
 -  (kill-buffer (current-buffer)))
 +  ;; If more than one window is showing this buffer, bury rather than
 +  ;; kill it.
 +  (if ( (length (get-buffer-window-list nil nil t)) 1)
 +  (bury-buffer)
 +(kill-buffer)))
  
  (defun notmuch-documentation-first-line (symbol)
Return the first line of the documentation string for SYMBOL.
 -- 
 2.1.1

 ___
 notmuch mailing list
 notmuch@notmuchmail.org
 http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] test: add simple tests for post-insert hook

2014-10-28 Thread Jani Nikula
On Sat, 18 Oct 2014, David Bremner da...@tethera.net wrote:
 Most of the existing tests for pre/post-new hook don't seem to apply.
 ---
  test/T400-hooks.sh | 18 ++
  1 file changed, 18 insertions(+)

 diff --git a/test/T400-hooks.sh b/test/T400-hooks.sh
 index 77e8569..e741211 100755
 --- a/test/T400-hooks.sh
 +++ b/test/T400-hooks.sh
 @@ -30,6 +30,8 @@ rm_hooks () {
  
  # add a message to generate mail dir and database
  add_message
 +# create maildir structure for notmuch-insert
 +mkdir -p $MAIL_DIR/{cur,new,tmp}
  
  test_begin_subtest pre-new is run
  rm_hooks
 @@ -45,6 +47,16 @@ create_echo_hook post-new expected output
  notmuch new  /dev/null
  test_expect_equal_file expected output
  
 +test_begin_subtest post-insert hook is run
 +rm_hooks
 +generate_message
 +create_echo_hook post-insert expected output
 +echo $gen_msg_filename
 +cat output

I presume the two lines above...

 +notmuch insert  $gen_msg_filename
 +echo $?

...and this line are leftover debug messages?

Otherwise LGTM. I guess this could be expanded with a subtest checking
that the hook does not get run on errors, and does get run with some
errors that are ignored with --keep.

BR,
Jani.

 +test_expect_equal_file expected output
 +
  test_begin_subtest pre-new is run before post-new
  rm_hooks
  generate_message
 @@ -82,6 +94,12 @@ test_expect_equal_file expected output
  # depends on the previous subtest leaving broken hook behind
  test_expect_code 1 post-new non-zero exit status (notmuch status) notmuch 
 new
  
 +rm_hooks
 +generate_message
 +create_failing_hook post-insert
 +test_expect_success post-insert hook does not affect insert status \
 +notmuch insert  \$gen_msg_filename\  /dev/null
 +
  # test_begin_subtest hook without executable permissions
  rm_hooks
  mkdir -p ${HOOK_DIR}
 -- 
 2.1.1

 ___
 notmuch mailing list
 notmuch@notmuchmail.org
 http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] lib: make notmuch_query_count_messages exact

2014-10-28 Thread Jani Nikula
On Tue, 14 Oct 2014, Jani Nikula j...@nikula.org wrote:
 Our tests have expected this to be exact all along, but maybe
 inaccuracies only show up with big databases.

From my IRC logs on Thu Oct 16 2014

j4ni   olly: does this do what it claims?
   http://mid.gmane.org/1413304374-17997-1-git-send-email-j...@nikula.org
olly   j4ni: not really
olly   if you don't set check at least it defaults to the number of
   requested matches
olly   so the code part is effectively a no-op
olly   but the reported number will be exact already so the comment
   changes are right
olly   i guess you could argue there's some merit in passing it explicitly
   in case someone decreases the request number of results

 ---
  devel/TODO| 5 -
  lib/notmuch.h | 6 +++---
  lib/query.cc  | 7 ++-
  3 files changed, 9 insertions(+), 9 deletions(-)

 diff --git a/devel/TODO b/devel/TODO
 index 1cf4089f1d93..116194d82ad1 100644
 --- a/devel/TODO
 +++ b/devel/TODO
 @@ -188,11 +188,6 @@ into the shared-library interface.
  Audit all libnotmuch entry points to ensure that all Xapian calls are
  wrapped in a try/catch block.
  
 -Fix the count functionality to be exact as Olly explained in IRC:
 -
 - ojwb cworth: if you set the check_at_least parameter to the
 - database size, get_matches_estimated() will be exact
 -
  Fix the threading of a message that has a References: header but no
  In-Reply-To: header (see id:87lixxnxpb@yoom.home.cworth.org).
  
 diff --git a/lib/notmuch.h b/lib/notmuch.h
 index dae041640fdb..6091082617e7 100644
 --- a/lib/notmuch.h
 +++ b/lib/notmuch.h
 @@ -893,10 +893,10 @@ void
  notmuch_threads_destroy (notmuch_threads_t *threads);
  
  /**
 - * Return an estimate of the number of messages matching a search.
 + * Return the number of messages matching a search.
   *
 - * This function performs a search and returns Xapian's best
 - * guess as to number of matching messages.
 + * This function performs a search and returns the number of matching
 + * messages.
   *
   * If a Xapian exception occurs, this function may return 0 (after
   * printing a message).
 diff --git a/lib/query.cc b/lib/query.cc
 index 60ff8bd9a39e..ce26e3f3e4ed 100644
 --- a/lib/query.cc
 +++ b/lib/query.cc
 @@ -557,7 +557,12 @@ notmuch_query_count_messages (notmuch_query_t *query)
  
   enquire.set_query (final_query);
  
 - mset = enquire.get_mset (0, notmuch-xapian_db-get_doccount ());
 + /*
 +  * Set the checkatleast parameter to the number of documents
 +  * in the database to make get_matches_estimated() exact.
 +  */
 + mset = enquire.get_mset (0, notmuch-xapian_db-get_doccount (),
 +  notmuch-xapian_db-get_doccount ());
  
   count = mset.get_matches_estimated();
  
 -- 
 2.1.1
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] Avoid empty thread names if possible.

2014-10-28 Thread Jani Nikula
On Wed, 08 Oct 2014, Sergei Shilovsky sshilov...@gmail.com wrote:
 I would also suggest to drop subjects consisting of only Re: and
 Fwd sequences

I think it's okay to avoid empty thread names at the lib level; however
I think any further processing should be done near the user interface.

BR,
Jani.

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] test: fix test_require_external_prereq gdb in insert test

2014-10-28 Thread Jani Nikula
You need to actually check the return value. Limit the missing deps
part to subtests requiring gdb.
---
 test/T070-insert.sh | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/test/T070-insert.sh b/test/T070-insert.sh
index 168345c9897b..b21609833228 100755
--- a/test/T070-insert.sh
+++ b/test/T070-insert.sh
@@ -2,8 +2,6 @@
 test_description='notmuch insert'
 . ./test-lib.sh
 
-test_require_external_prereq gdb
-
 # Create directories and database before inserting.
 mkdir -p $MAIL_DIR/{cur,new,tmp}
 mkdir -p $MAIL_DIR/Drafts/{cur,new,tmp}
@@ -185,6 +183,8 @@ test_expect_code 1 Invalid tags set exit code \
 
 notmuch config set new.tags $OLDCONFIG
 
+if test_require_external_prereq gdb; then
+
 # DUPLICATE_MESSAGE_ID is not tested here, because it should actually pass.
 
 for code in OUT_OF_MEMORY XAPIAN_EXCEPTION FILE_NOT_EMAIL \
@@ -211,4 +211,6 @@ gdb --batch-silent --return-child-result -x 
index-file-$code.gdb \
 test_expect_equal $? 0
 done
 
+fi # gdb
+
 test_done
-- 
2.1.1

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] test: fix test_require_external_prereq gdb in insert test

2014-10-28 Thread David Bremner
Jani Nikula j...@nikula.org writes:

 You need to actually check the return value. Limit the missing deps
 part to subtests requiring gdb.

For me, on a system without gdb, the current version looks like

T070-insert: Testing notmuch insert
 missing prerequisites: gdb(1)
 SKIP   all tests in T070-insert

This seems OK to me?

Of course you're right that moving it forward to only skip the gdb
requiring tests is the right thing to do, and in that setting having a
skipped message for all 10 skipped tests is a bit ugly. OTOHO your
version doesn't give any output at all, which seems not perfect either.

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] test: add simple tests for post-insert hook

2014-10-28 Thread David Bremner
Jani Nikula j...@nikula.org writes:


 I presume the two lines above...

 +notmuch insert  $gen_msg_filename
 +echo $?

 ...and this line are leftover debug messages?

Uh, yeah. I should have fixed those a while ago when Tomi pointed them
out.


 Otherwise LGTM. I guess this could be expanded with a subtest checking
 that the hook does not get run on errors, and does get run with some
 errors that are ignored with --keep.

OK, I pushed these tests for now (less the debugging output).

d
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] test: fix test_require_external_prereq gdb in insert test

2014-10-28 Thread Jani Nikula
On Tue, 28 Oct 2014, David Bremner da...@tethera.net wrote:
 Jani Nikula j...@nikula.org writes:

 You need to actually check the return value. Limit the missing deps
 part to subtests requiring gdb.

 For me, on a system without gdb, the current version looks like

 T070-insert: Testing notmuch insert
  missing prerequisites: gdb(1)
  SKIP   all tests in T070-insert

 This seems OK to me?

More than okay. /me hides.

 Of course you're right that moving it forward to only skip the gdb
 requiring tests is the right thing to do, and in that setting having a
 skipped message for all 10 skipped tests is a bit ugly. OTOHO your
 version doesn't give any output at all, which seems not perfect either.

How does it work if you just move the prereq test forward?

BR,
Jani.
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] test: fix test_require_external_prereq gdb in insert test

2014-10-28 Thread David Bremner
Jani Nikula j...@nikula.org writes:


 Of course you're right that moving it forward to only skip the gdb
 requiring tests is the right thing to do, and in that setting having a
 skipped message for all 10 skipped tests is a bit ugly. OTOHO your
 version doesn't give any output at all, which seems not perfect either.

 How does it work if you just move the prereq test forward?


Then we get one message per skipped test. So twenty lines it total.

 missing prerequisites: gdb(1)
 SKIP   error exit when add_message returns OUT_OF_MEMORY
 missing prerequisites: gdb(1)
 SKIP   success exit with --keep when add_message returns OUT_OF_MEMORY
 missing prerequisites: gdb(1)
 SKIP   error exit when add_message returns XAPIAN_EXCEPTION
 missing prerequisites: gdb(1)
 SKIP   success exit with --keep when add_message returns XAPIAN_EXCEPTION
 missing prerequisites: gdb(1)
 SKIP   error exit when add_message returns FILE_NOT_EMAIL
 missing prerequisites: gdb(1)
 SKIP   success exit with --keep when add_message returns FILE_NOT_EMAIL
 missing prerequisites: gdb(1)
 SKIP   error exit when add_message returns READ_ONLY_DATABASE
 missing prerequisites: gdb(1)
 SKIP   success exit with --keep when add_message returns READ_ONLY_DATABASE
 missing prerequisites: gdb(1)
 SKIP   error exit when add_message returns UPGRADE_REQUIRED
 missing prerequisites: gdb(1)
 SKIP   success exit with --keep when add_message returns UPGRADE_REQUIRED
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


feature freeze for notmuch 0.19

2014-10-28 Thread David Bremner

Hi Gang;

As always we have plenty of things on the go, but I think theres enough
merged in since 0.18.2 (yesterday!) to make a release worthwhile. To
pick a date completely at random *cough* I'd like to freeze on November
5. For those of you just joining us that means I'll merge master to
release at that point, and then only take important bug fix and NEWS
patches onto release for the next week or so, followed by a release.

d



signature.asc
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v4 0/6] notmuch search --output=sender/recipients

2014-10-28 Thread Tomi Ollila
On Mon, Oct 27 2014, Michal Sojka sojk...@fel.cvut.cz wrote:

 Hi all,

 this is v4 of the search --output=address series. It obsoletes v3 that
 starts at id:1413150093-8383-1-git-send-email-sojk...@fel.cvut.cz.

 It addresses most comments made by Mark Walters and others. In
 addition to v3, it also implements new --output=count (also suggested
 by Mark). This required changes even in the initial patches of the
 series but the result is cleaner code.

I looked through the messages

 id:1414421455-3037-2-git-send-email-sojk...@fel.cvut.cz
 id:1414421455-3037-3-git-send-email-sojk...@fel.cvut.cz
 id:1414421455-3037-4-git-send-email-sojk...@fel.cvut.cz
 id:1414421455-3037-5-git-send-email-sojk...@fel.cvut.cz

First I read the changes in this email thread and then changes in each of
these messages with xxdiff(1) -- and applied the patches and ran tests
(which passed).

These 4 patches LGTM.

The filtering/uniqueness whatnot handling still ¡IMO! has things to hope
for, which I will write later...

Finally, a promise I made a in reply to another patch series: Although
these emails are patches when sent to this mailing list, when these
are applied and pushed to notmuch repository the commit message should
not refer these as patches -- and therefore the email part that will
eventually be in commit message should be written differently. But that
is not a reason enough to require patch email resent.


Tomi



 Detailed changes from v3:

 - `o' renamed to `opt'.
 - Conversion of --output from keyword to keyword-flags is now a
   separate patch.
 - Structured output formats print name and address separately.
 - Added test for --format=json.
 - Changed --filter-by default to nameaddr. In v2, the default was
   addrfold, in v3 the default was no filtering at all. I believe that
   Mark's suggestion to make nameaddr the default is good trade off.
 - Added new --output=count
 - Minor style fixes
 - Few typos fixed
 - There is no way to output unfiltered (duplicite) addresses.
   Hopefully, the introduction of --output=count is sufficient
   replacement for this feature.

 Cheers,
 -Michal


 Jani Nikula (1):
   cli: Add support for parsing keyword-flag arguments

 Michal Sojka (5):
   cli: search: Refactor passing of command line options
   cli: search: Convert --output to keyword-flag argument
   cli: search: Add --output={sender,recipients}
   cli: search: Add configurable way to filter out duplicate addresses
   cli: search: Add --output=count

  command-line-arguments.c   |   6 +-
  command-line-arguments.h   |   1 +
  completion/notmuch-completion.bash |   8 +-
  completion/notmuch-completion.zsh  |   4 +-
  doc/man1/notmuch-search.rst|  65 ++-
  notmuch-search.c   | 385 
 +
  test/T090-search-output.sh | 137 +
  test/T095-search-filter-by.sh  |  64 ++
  test/T410-argument-parsing.sh  |   3 +-
  test/arg-test.c|   9 +
  10 files changed, 600 insertions(+), 82 deletions(-)
  create mode 100755 test/T095-search-filter-by.sh

 -- 
 2.1.1
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] test: use LDFLAGS in test/Makefile.local

2014-10-28 Thread Tomi Ollila
On Mon, Oct 20 2014, Jani Nikula wrote:

 Apparently the test binaries are built with minimal LDFLAGS, only
 adding dependency specific LDFLAGS as needed. However because some of
 the test binaries incorporate notmuch object files, it is necessary to
 use the same link flags as notmuch. For example user provided
 CFLAGS/CXXFLAGS/LDFLAGS with -fsanitize=undefined fails to build the
 test binaries if the flags differ.

 ---

 With this I could do

 CFLAGS=-fsanitize=undefined -g CXXFLAGS=-fsanitize=undefined -g 
 LDFLAGS=-fsanitize=undefined -g ./configure

 to try ubsan with gcc 4.9. No problems found while running make test
 (and it did find an UB I planted to ensure I had it all set up right).
 ---
  test/Makefile.local | 14 +++---
  1 file changed, 7 insertions(+), 7 deletions(-)

 diff --git a/test/Makefile.local b/test/Makefile.local
 index a2d58fc1a1b0..2331ceb15e33 100644
 --- a/test/Makefile.local
 +++ b/test/Makefile.local
 @@ -13,10 +13,10 @@ smtp_dummy_srcs = \
  smtp_dummy_modules = $(smtp_dummy_srcs:.c=.o)
  
  $(dir)/arg-test: $(dir)/arg-test.o command-line-arguments.o util/libutil.a
 - $(call quiet,CC) $^ -o $@
 + $(call quiet,CC) $^ -o $@ $(LDFLAGS)
  
  $(dir)/hex-xcode: $(dir)/hex-xcode.o command-line-arguments.o util/libutil.a
 - $(call quiet,CC) $^ $(TALLOC_LDFLAGS) -o $@
 + $(call quiet,CC) $^ -o $@ $(LDFLAGS) $(TALLOC_LDFLAGS)

LGTM; especially the above change which moves all *LDFLAGS after -o $@...

Tomi

  
  random_corpus_deps =  $(dir)/random-corpus.o  $(dir)/database-test.o \
   notmuch-config.o command-line-arguments.o \
 @@ -24,19 +24,19 @@ random_corpus_deps =  $(dir)/random-corpus.o  
 $(dir)/database-test.o \
   parse-time-string/libparse-time-string.a
  
  $(dir)/random-corpus: $(random_corpus_deps)
 - $(call quiet,CXX) $(CFLAGS_FINAL) $^ -o $@ $(CONFIGURE_LDFLAGS)
 + $(call quiet,CXX) $^ -o $@ $(LDFLAGS) $(CONFIGURE_LDFLAGS)
  
  $(dir)/smtp-dummy: $(smtp_dummy_modules)
 - $(call quiet,CC) $^ -o $@
 + $(call quiet,CC) $^ -o $@ $(LDFLAGS)
  
  $(dir)/symbol-test: $(dir)/symbol-test.o lib/$(LINKER_NAME)
 - $(call quiet,CXX) $^ -o $@ -Llib -lnotmuch $(XAPIAN_LDFLAGS)
 + $(call quiet,CXX) $^ -o $@ $(LDFLAGS) -Llib -lnotmuch $(XAPIAN_LDFLAGS)
  
  $(dir)/parse-time: $(dir)/parse-time.o parse-time-string/parse-time-string.o
 - $(call quiet,CC) $^ -o $@
 + $(call quiet,CC) $^ -o $@ $(LDFLAGS)
  
  $(dir)/make-db-version: $(dir)/make-db-version.o
 - $(call quiet,CXX) $^ -o $@ $(XAPIAN_LDFLAGS)
 + $(call quiet,CXX) $^ -o $@ $(LDFLAGS) $(XAPIAN_LDFLAGS)
  
  .PHONY: test check
  
 -- 
 2.1.1

 ___
 notmuch mailing list
 notmuch@notmuchmail.org
 http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] Avoid empty thread names if possible.

2014-10-28 Thread Tomi Ollila
On Tue, Oct 07 2014, Jesse Rosenthal wrote:

 Currently the thread is named based on either the oldest or newest
 matching message (depending on the search order). If this message has
 an empty subject, though, the thread will show up with an empty
 subject in the search results. (See the thread starting with
 `id:1412371140-21051-1-git-send-email-da...@tethera.net` for an
 example.)

 This patch changes the behavior to name based on the oldest/newest
 matching non-empty subject. This is particularly helpful for patchsets.
 If the only subjects are empty, the thread subject will still be empty.

 Signed-off-by: Jesse Rosenthal jrosent...@jhu.edu
 ---
  lib/thread.cc | 6 --
  1 file changed, 4 insertions(+), 2 deletions(-)

 diff --git a/lib/thread.cc b/lib/thread.cc
 index 8922403..ea10295 100644
 --- a/lib/thread.cc
 +++ b/lib/thread.cc
 @@ -348,18 +348,20 @@ _thread_add_matched_message (notmuch_thread_t *thread,
  {
  time_t date;
  notmuch_message_t *hashed_message;
 +const char *cur_subject;
  
  date = notmuch_message_get_date (message);
 +cur_subject = notmuch_thread_get_subject (thread);
  
  if (date  thread-oldest || ! thread-matched_messages) {
   thread-oldest = date;
 - if (sort == NOTMUCH_SORT_OLDEST_FIRST)
 + if (sort == NOTMUCH_SORT_OLDEST_FIRST || strlen(cur_subject) == 0)

IMO it is a bit silly to scan through the whole string and use the return
value of 0 (vs != 0) to have effect. we should probably have something like
#define EMPTY_STRING(s) ((s)[0] == '\0') 
and use that instead.

Also, to keep promise, mentioning 'patch' in commit message referring to 
the change introduced does IMO also look silly :D

Tomi

   _thread_set_subject_from_message (thread, message);
  }
  
  if (date  thread-newest || ! thread-matched_messages) {
   thread-newest = date;
 - if (sort != NOTMUCH_SORT_OLDEST_FIRST)
 + if (sort != NOTMUCH_SORT_OLDEST_FIRST || strlen(cur_subject) == 0)
   _thread_set_subject_from_message (thread, message);
  }
  
 -- 
 2.1.2

 ___
 notmuch mailing list
 notmuch@notmuchmail.org
 http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v3] nmbug: Add an 'init' command

2014-10-28 Thread W. Trevor King
For folks that want to start versioning a new tag-space, instead of
cloning one that someone else has already started.

The empty-blob hash-object call avoids errors like:

  $ nmbug commit
  error: invalid object 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 for
'tags/...'
  fatal: git-write-tree: error building trees
  'git HASH(0x9ef3eb8) write-tree' exited with nonzero value

David Bremner suggested [1]:

  $ git hash-object -w /dev/null

instead of my Python version of:

  $ git hash-object -w --stdin -

but I expect that closing stdin is more portable than the /dev/null
path (which doesn't exist on Windows, for example).

[1]: id:87y4vu6uvf@maritornes.cs.unb.ca
 http://thread.gmane.org/gmane.mail.notmuch.general/18626/focus=18720
---
The only change since v2 [1] is a commit-message tweak:

* Mention Windows as an OS with stdin but no /dev/null [2].

Cheers,
Trevor

[1]: id:eaa9cf1cb3c00c591dc675c0f314ca31909ff74c.1412965476.git.wk...@tremily.us
 http://thread.gmane.org/gmane.mail.notmuch.general/19289
[2]: id:20141011071000.gb10...@odin.tremily.us
 http://article.gmane.org/gmane.mail.notmuch.general/19294

 devel/nmbug/nmbug | 24 
 1 file changed, 24 insertions(+)

diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug
index 9402ead..23bac5c 100755
--- a/devel/nmbug/nmbug
+++ b/devel/nmbug/nmbug
@@ -373,6 +373,29 @@ def fetch(remote=None):
 _git(args=args, wait=True)
 
 
+def init(remote=None):
+
+Create an empty nmbug repository.
+
+This wraps 'git init' with a few extra steps to support subsequent
+status and commit commands.
+
+with _tempfile.TemporaryDirectory(prefix='nmbug-init.') as workdir:
+_spawn(
+args=['git', 'init', '--separate-git-dir', NMBGIT, workdir],
+wait=True)
+_git(args=['config', '--unset', 'core.worktree'], wait=True)
+_git(args=['config', 'core.bare', 'true'], wait=True)
+# create an empty blob (e69de29bb2d1d6434b8b29ae775ad8c2e48c5391)
+_git(args=['hash-object', '-w', '--stdin'], input='', wait=True)
+_git(
+args=[
+'commit', '--allow-empty', '-m', 'Start a new nmbug repository'
+],
+additional_env={'GIT_WORK_TREE': workdir},
+wait=True)
+
+
 def checkout():
 
 Update the notmuch database from Git.
@@ -703,6 +726,7 @@ if __name__ == '__main__':
 'clone',
 'commit',
 'fetch',
+'init',
 'log',
 'merge',
 'pull',
-- 
2.1.0.60.g85f0837

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch