diff options
| author | David Bremner <david@tethera.net> | 2026-01-25 07:56:37 +0900 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2026-02-16 07:24:18 +0900 |
| commit | cfc4af0e2bdf8f82ad14342baa6578d4dd366cd9 (patch) | |
| tree | b0bf98718b8ab5663d811bc0df6e3347b1db910f /test/T860-git-remote.sh | |
| parent | fcc41c82c4596aef1598eb9ea52c4b0cb4bb3c53 (diff) | |
cli/git-remote: add import command
The output in default.import is based on a modified version
of Felipe's git-remote-nm with Blake2 hashing replaced by SHA1
(for portability). This enable fetch/pull/clone, so test that as well.
Diffstat (limited to 'test/T860-git-remote.sh')
| -rwxr-xr-x | test/T860-git-remote.sh | 73 |
1 files changed, 72 insertions, 1 deletions
diff --git a/test/T860-git-remote.sh b/test/T860-git-remote.sh index 76ba7920..a516f05d 100755 --- a/test/T860-git-remote.sh +++ b/test/T860-git-remote.sh @@ -35,7 +35,6 @@ export GIT_COMMITTER_EMAIL="notmuch@example.com" export GIT_REMOTE_NM_DEBUG="s" export GIT_REMOTE_NM_LOG=grn-log.txt EXPECTED=$NOTMUCH_SRCDIR/test/git-remote.expected-output -MAKE_EXPORT_PY=$NOTMUCH_SRCDIR/test/make-export.py TAG_FILE="_notmuch_metadata/87/b1/4EFC743A.3060609@april.org/tags" @@ -57,4 +56,76 @@ cat <<EOF > EXPECTED EOF test_expect_equal_file EXPECTED OUTPUT +test_begin_subtest 'import writes lastmod file' +echo import | run_helper dummy-alias dummy-url > /dev/null +lastmod=$(notmuch count --lastmod '*' | cut -f2-) +test_expect_equal "${lastmod}" "$(cat < ${git_tmp}/notmuch/lastmod)" + +# note that this test must not be the first time import is run, +# because it depends on the lastmod file +test_begin_subtest 'import produces expected output' +echo import | run_helper | notmuch_sanitize_git > OUTPUT +test_expect_equal_file $EXPECTED/default.import OUTPUT + +test_begin_subtest "clone notmuch://" +test_expect_success "git clone notmuch:// $(mktemp -d cloneXXXXXX)" + +test_begin_subtest "clone notmuch://?config=notmuch-config" +test_expect_success "git clone notmuch://?config=notmuch-config $(mktemp -d cloneXXXXXX)" + +test_begin_subtest "clone notmuch://?profile=default" +test_expect_success "git clone notmuch://?profile=default $(mktemp -d cloneXXXXXX)" + +test_begin_subtest "clone notmuch://?config=notmuch-config&profile=default" +test_expect_success "git clone notmuch://?config=notmuch-config\&profile=default $(mktemp -d cloneXXXXXX)" + +test_begin_subtest 'clone notmuch://`pwd`/mail' +test_expect_success "env -u NOTMUCH_CONFIG git clone notmuch://`pwd`/mail $(mktemp -d cloneXXXXXX)" + +test_begin_subtest 'clone notmuch://`pwd`/mail/?config=`pwd`/notmuch-config' +test_expect_success "env -u NOTMUCH_CONFIG git clone notmuch://`pwd`/mail?config=`pwd`/notmuch-config $(mktemp -d cloneXXXXXX)" + +test_begin_subtest 'clone notmuch://.../mail/?config=.../notmuch-config&profile=default' +test_expect_success "env -u NOTMUCH_CONFIG git clone notmuch://`pwd`/mail/?config=`pwd`/notmuch-config\&profile=default $(mktemp -d clone XXX)" + +test_begin_subtest 'clone notmuch://?path=.../mail/&config=.../notmuch-config&profile=default' +test_expect_success "env -u NOTMUCH_CONFIG git clone notmuch://?path=`pwd`/mail\&config=notmuch-config\&profile=default $(mktemp -d cloneXXXXXX)" + +test_begin_subtest "clone notmuch::" +test_expect_success "git clone notmuch:: $(mktemp -d cloneXXXXXX)" + +test_begin_subtest 'clone notmuch::`pwd`/mail' +test_expect_success "env -u NOTMUCH_CONFIG git clone notmuch::`pwd`/mail $(mktemp -d cloneXXXXXX)" + +test_begin_subtest 'clone notmuch::`pwd`/mail?config=`pwd`/notmuch-config' +test_expect_success "env -u NOTMUCH_CONFIG git clone notmuch::`pwd`/mail?config=`pwd`/notmuch-config $(mktemp -d cloneXXXXXX)" + +test_begin_subtest "clone has every message" +git clone notmuch:: repo +find repo -name tags -type f | sed -e s,repo/_notmuch_metadata/../../,id:, -e s,/tags$,, | sort > OUTPUT +notmuch search --output=messages '*' | sort > EXPECTED +test_expect_equal_file EXPECTED OUTPUT + +backup_state +test_begin_subtest "pull get new tag" +notmuch tag +zznew -- id:4EFC743A.3060609@april.org +git -C repo pull +cat<<EOF >EXPECTED +inbox +unread +zznew +EOF +test_expect_equal_file EXPECTED repo/$TAG_FILE +restore_state + +backup_state +test_begin_subtest "pull sees deletion" +notmuch tag -unread -- id:4EFC743A.3060609@april.org +git -C repo pull +cat<<EOF >EXPECTED +inbox +EOF +test_expect_equal_file EXPECTED repo/$TAG_FILE +restore_state + test_done |
