2 test_description='"notmuch git" to save and restore tags'
3 . $(dirname "$0")/test-lib.sh || exit 1
7 git config --global user.email notmuch@example.org
8 git config --global user.name "Notmuch Test Suite"
10 test_begin_subtest "init"
11 test_expect_success "notmuch git -p '' -C remote.git init"
13 test_begin_subtest "clone"
14 test_expect_success "notmuch git -p '' -C tags.git clone remote.git"
16 test_begin_subtest "commit"
17 notmuch git -C tags.git -p '' commit
18 git -C tags.git ls-tree -r --name-only HEAD | xargs dirname | sort -u | sed s,tags/,id:, > OUTPUT
19 notmuch search --output=messages '*' | sort > EXPECTED
20 test_expect_equal_file_nonempty EXPECTED OUTPUT
22 test_begin_subtest "checkout"
24 notmuch tag -inbox '*'
25 notmuch git -C tags.git -p '' checkout
27 test_expect_equal_file_nonempty BEFORE AFTER
29 test_begin_subtest "archive"
30 notmuch git -C tags.git -p '' archive | tar tf - | \
31 grep 20091117190054.GU3165@dottiness.seas.harvard.edu | sort > OUTPUT
33 tags/20091117190054.GU3165@dottiness.seas.harvard.edu/
34 tags/20091117190054.GU3165@dottiness.seas.harvard.edu/inbox
35 tags/20091117190054.GU3165@dottiness.seas.harvard.edu/signed
36 tags/20091117190054.GU3165@dottiness.seas.harvard.edu/unread
38 notmuch git -C tags.git -p '' checkout
39 test_expect_equal_file EXPECTED OUTPUT
41 test_begin_subtest "status"
42 notmuch tag +test id:20091117190054.GU3165@dottiness.seas.harvard.edu
43 notmuch git -C tags.git -p '' status > OUTPUT
45 A 20091117190054.GU3165@dottiness.seas.harvard.edu test
47 notmuch git -C tags.git -p '' checkout
48 test_expect_equal_file EXPECTED OUTPUT
50 test_begin_subtest "fetch"
51 notmuch tag +test2 id:20091117190054.GU3165@dottiness.seas.harvard.edu
52 notmuch git -C remote.git -p '' commit
53 notmuch tag -test2 id:20091117190054.GU3165@dottiness.seas.harvard.edu
54 notmuch git -C tags.git -p '' fetch
55 notmuch git -C tags.git -p '' status > OUTPUT
57 a 20091117190054.GU3165@dottiness.seas.harvard.edu test2
59 notmuch git -C tags.git -p '' checkout
60 test_expect_equal_file EXPECTED OUTPUT
62 test_begin_subtest "merge"
63 notmuch git -C tags.git -p '' merge
64 notmuch dump id:20091117190054.GU3165@dottiness.seas.harvard.edu | grep -v '^#' > OUTPUT
66 +inbox +signed +test2 +unread -- id:20091117190054.GU3165@dottiness.seas.harvard.edu
68 test_expect_equal_file EXPECTED OUTPUT
70 test_begin_subtest "push"
71 notmuch tag +test3 id:20091117190054.GU3165@dottiness.seas.harvard.edu
72 notmuch git -C tags.git -p '' commit
73 notmuch tag -test3 id:20091117190054.GU3165@dottiness.seas.harvard.edu
74 notmuch git -C tags.git -p '' push
75 notmuch git -C remote.git -p '' checkout
76 notmuch dump id:20091117190054.GU3165@dottiness.seas.harvard.edu | grep -v '^#' > OUTPUT
78 +inbox +signed +test2 +test3 +unread -- id:20091117190054.GU3165@dottiness.seas.harvard.edu
80 test_expect_equal_file EXPECTED OUTPUT
82 test_begin_subtest "environment passed through when run as 'notmuch git'"
83 env NMBGIT=foo NMBPREFIX=bar NOTMUCH_PROFILE=default notmuch git -C tags.git -p '' -ldebug status |& \
84 grep '^env ' | notmuch_dir_sanitize > OUTPUT
88 env NOTMUCH_PROFILE = default
89 env NOTMUCH_CONFIG = CWD/notmuch-config
91 test_expect_equal_file EXPECTED OUTPUT