diff options
| author | David Bremner <david@tethera.net> | 2026-01-25 07:56:36 +0900 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2026-02-16 07:24:18 +0900 |
| commit | fcc41c82c4596aef1598eb9ea52c4b0cb4bb3c53 (patch) | |
| tree | 8d0f74134d34a4c0e89aa1f0fa648147405375f0 /test | |
| parent | c8fcc953b5481e96d698c148325563890848c5ff (diff) | |
cli: start remote helper for git.
This is closely based on git-remote-nm (in ruby) by Felipe Contreras.
Initially just implement the commands 'capabilities' and 'list'. This
isn't enough to do anything useful but we can run some simple unit tests. Testing
of URL passing will be done after clone (import command) support is
added.
Diffstat (limited to 'test')
| -rwxr-xr-x | test/T860-git-remote.sh | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/test/T860-git-remote.sh b/test/T860-git-remote.sh new file mode 100755 index 00000000..76ba7920 --- /dev/null +++ b/test/T860-git-remote.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash +test_description='git-remote-notmuch' +. $(dirname "$0")/test-lib.sh || exit 1 + +notmuch_sanitize_git() { + sed 's/^committer \(.*\) \(<[^>]*>\) [1-9][0-9]* [-+][0-9]*/committer \1 \2 TIMESTAMP TIMEZONE/' +} + +add_email_corpus + +mkdir repo + +git_tmp=$(mktemp -d gitXXXXXXXX) + +run_helper () { + env -u NOTMUCH_CONFIG GIT_DIR=${git_tmp} git-remote-notmuch dummy-alias "?config=${NOTMUCH_CONFIG}" +} + +backup_state () { + backup_database + rm -rf repo.bak + cp -a repo repo.bak +} + +restore_state () { + restore_database + rm -rf repo + mv repo.bak repo +} + +export GIT_AUTHOR_NAME="Notmuch Test Suite" +export GIT_AUTHOR_EMAIL="notmuch@example.com" +export GIT_COMMITTER_NAME="Notmuch Test Suite" +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" + +test_begin_subtest 'capabilities' +echo capabilities | run_helper > OUTPUT +cat <<EOF > EXPECTED +import +export +refspec refs/heads/*:refs/notmuch/* + +EOF +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest 'list' +echo list | run_helper > OUTPUT +cat <<EOF > EXPECTED +? refs/heads/master + +EOF +test_expect_equal_file EXPECTED OUTPUT + +test_done |
