diff options
| author | David Bremner <david@tethera.net> | 2022-06-23 09:30:44 -0300 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2022-07-07 06:56:05 -0300 |
| commit | 6219e7380ae34cc0c8142f4174bee3cde9bf9662 (patch) | |
| tree | 633a3b5ac38b66c8d33f171320c9b2c52d28fadc /test | |
| parent | b07e121923a4ca00d0ec68ba9eebe8dafb70e13a (diff) | |
CL/git: add format version 1
The original nmbug format (now called version 0) creates 1
subdirectory of 'tags/' per message. This causes problems for more
than (roughly) 100k messages.
Version 1 introduces 2 layers of hashed directories. This scheme was
chose to balance the number of subdirectories with the number of extra
directories (and git objects) created via hashing.
This should be upward compatible in the sense that old repositories
will continue to work with the updated notmuch-git.
Diffstat (limited to 'test')
| -rwxr-xr-x | test/T850-git.sh | 48 | ||||
| -rw-r--r-- | test/test-lib.sh | 4 |
2 files changed, 28 insertions, 24 deletions
diff --git a/test/T850-git.sh b/test/T850-git.sh index 7ea50939..342cc31b 100755 --- a/test/T850-git.sh +++ b/test/T850-git.sh @@ -40,10 +40,10 @@ notmuch tag -new-prefix::foo id:20091117190054.GU3165@dottiness.seas.harvard.edu test_begin_subtest "committing new prefix works with force" notmuch tag +new-prefix::foo id:20091117190054.GU3165@dottiness.seas.harvard.edu notmuch git -l debug -p 'new-prefix::' -C force-prefix.git commit --force -git -C force-prefix.git ls-tree -r --name-only HEAD | xargs dirname | sort -u | sed s,tags/,id:, > OUTPUT +git -C force-prefix.git ls-tree -r --name-only HEAD | notmuch_git_sanitize | xargs dirname | sort -u > OUTPUT notmuch tag -new-prefix::foo id:20091117190054.GU3165@dottiness.seas.harvard.edu cat <<EOF>EXPECTED -id:20091117190054.GU3165@dottiness.seas.harvard.edu +20091117190054.GU3165@dottiness.seas.harvard.edu EOF test_expect_equal_file_nonempty EXPECTED OUTPUT @@ -62,8 +62,8 @@ test_expect_equal_file_nonempty EXPECTED OUTPUT test_begin_subtest "commit" notmuch git -C tags.git commit --force -git -C tags.git ls-tree -r --name-only HEAD | xargs dirname | sort -u | sed s,tags/,id:, > OUTPUT -notmuch search --output=messages '*' | sort > EXPECTED +git -C tags.git ls-tree -r --name-only HEAD | notmuch_git_sanitize | xargs dirname | sort -u > OUTPUT +notmuch search --output=messages '*' | sed s/^id:// | sort > EXPECTED test_expect_equal_file_nonempty EXPECTED OUTPUT test_begin_subtest "commit --force succeeds" @@ -88,22 +88,22 @@ test_expect_equal_file_nonempty BEFORE AFTER test_begin_subtest "commit (incremental)" notmuch tag +test id:20091117190054.GU3165@dottiness.seas.harvard.edu notmuch git -C tags.git commit -git -C tags.git ls-tree -r --name-only HEAD | +git -C tags.git ls-tree -r --name-only HEAD | notmuch_git_sanitize | \ grep 20091117190054 | sort > OUTPUT echo "--------------------------------------------------" >> OUTPUT notmuch tag -test id:20091117190054.GU3165@dottiness.seas.harvard.edu notmuch git -C tags.git commit -git -C tags.git ls-tree -r --name-only HEAD | +git -C tags.git ls-tree -r --name-only HEAD | notmuch_git_sanitize | \ grep 20091117190054 | sort >> OUTPUT cat <<EOF > EXPECTED -tags/20091117190054.GU3165@dottiness.seas.harvard.edu/inbox -tags/20091117190054.GU3165@dottiness.seas.harvard.edu/signed -tags/20091117190054.GU3165@dottiness.seas.harvard.edu/test -tags/20091117190054.GU3165@dottiness.seas.harvard.edu/unread +20091117190054.GU3165@dottiness.seas.harvard.edu/inbox +20091117190054.GU3165@dottiness.seas.harvard.edu/signed +20091117190054.GU3165@dottiness.seas.harvard.edu/test +20091117190054.GU3165@dottiness.seas.harvard.edu/unread -------------------------------------------------- -tags/20091117190054.GU3165@dottiness.seas.harvard.edu/inbox -tags/20091117190054.GU3165@dottiness.seas.harvard.edu/signed -tags/20091117190054.GU3165@dottiness.seas.harvard.edu/unread +20091117190054.GU3165@dottiness.seas.harvard.edu/inbox +20091117190054.GU3165@dottiness.seas.harvard.edu/signed +20091117190054.GU3165@dottiness.seas.harvard.edu/unread EOF test_expect_equal_file_nonempty EXPECTED OUTPUT @@ -111,18 +111,18 @@ test_begin_subtest "commit (change prefix)" notmuch tag +test::one id:20091117190054.GU3165@dottiness.seas.harvard.edu notmuch git -C tags.git -p 'test::' commit --force git -C tags.git ls-tree -r --name-only HEAD | - grep 20091117190054 | sort > OUTPUT + grep 20091117190054 | notmuch_git_sanitize | sort > OUTPUT echo "--------------------------------------------------" >> OUTPUT notmuch tag -test::one id:20091117190054.GU3165@dottiness.seas.harvard.edu notmuch git -C tags.git commit --force -git -C tags.git ls-tree -r --name-only HEAD | +git -C tags.git ls-tree -r --name-only HEAD | notmuch_git_sanitize | \ grep 20091117190054 | sort >> OUTPUT cat <<EOF > EXPECTED -tags/20091117190054.GU3165@dottiness.seas.harvard.edu/one +20091117190054.GU3165@dottiness.seas.harvard.edu/one -------------------------------------------------- -tags/20091117190054.GU3165@dottiness.seas.harvard.edu/inbox -tags/20091117190054.GU3165@dottiness.seas.harvard.edu/signed -tags/20091117190054.GU3165@dottiness.seas.harvard.edu/unread +20091117190054.GU3165@dottiness.seas.harvard.edu/inbox +20091117190054.GU3165@dottiness.seas.harvard.edu/signed +20091117190054.GU3165@dottiness.seas.harvard.edu/unread EOF test_expect_equal_file_nonempty EXPECTED OUTPUT @@ -151,12 +151,12 @@ test_expect_equal_file_nonempty BEFORE AFTER test_begin_subtest "archive" notmuch git -C tags.git archive | tar tf - | \ - grep 20091117190054.GU3165@dottiness.seas.harvard.edu | sort > OUTPUT + grep 20091117190054.GU3165@dottiness.seas.harvard.edu | notmuch_git_sanitize | sort > OUTPUT cat <<EOF > EXPECTED -tags/20091117190054.GU3165@dottiness.seas.harvard.edu/ -tags/20091117190054.GU3165@dottiness.seas.harvard.edu/inbox -tags/20091117190054.GU3165@dottiness.seas.harvard.edu/signed -tags/20091117190054.GU3165@dottiness.seas.harvard.edu/unread +20091117190054.GU3165@dottiness.seas.harvard.edu/ +20091117190054.GU3165@dottiness.seas.harvard.edu/inbox +20091117190054.GU3165@dottiness.seas.harvard.edu/signed +20091117190054.GU3165@dottiness.seas.harvard.edu/unread EOF notmuch git -C tags.git checkout test_expect_equal_file EXPECTED OUTPUT diff --git a/test/test-lib.sh b/test/test-lib.sh index 4eb58ea0..e9f32582 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -559,6 +559,10 @@ notmuch_date_sanitize () { -e 's/^Date: Fri, 05 Jan 2001 .*0000/Date: GENERATED_DATE/' } +# remove redundant parts of notmuch-git internal paths +notmuch_git_sanitize () { + sed -e 's,tags/\([0-9a-f]\{2\}/\)\{2\},,' -e '/FORMAT/d' +} notmuch_uuid_sanitize () { sed 's/[0-9a-f]\{8\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{12\}/UUID/g' } |
