diff options
| author | David Bremner <david@tethera.net> | 2022-06-23 09:30:45 -0300 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2022-07-07 07:05:55 -0300 |
| commit | bf5eacbe7e5b852e030e6a05469dbc9eae48535e (patch) | |
| tree | 87a9c95e8f7bec76db40c0e1b0115fcb2b769ebc /test | |
| parent | 6219e7380ae34cc0c8142f4174bee3cde9bf9662 (diff) | |
CLI/git: add --format-version argument to init subcommand
This is primarily intended to support testing upward compatibility
with legacy repos.
Diffstat (limited to 'test')
| -rwxr-xr-x | test/T850-git.sh | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/T850-git.sh b/test/T850-git.sh index 342cc31b..55cec78a 100755 --- a/test/T850-git.sh +++ b/test/T850-git.sh @@ -347,4 +347,50 @@ prefix = test:: EOF test_expect_equal_file EXPECTED OUTPUT +test_begin_subtest "default version is 1" +notmuch git -l debug -C default-version.git init +output=$(git -C default-version.git cat-file blob HEAD:FORMAT) +test_expect_equal "${output}" 1 + +test_begin_subtest "illegal version" +test_expect_code 1 "notmuch git -l debug -C default-version.git init --format-version=42" + +hash=("" "8d/c3/") # for use in synthetic repo contents. +for ver in {0..1}; do + test_begin_subtest "init version=${ver}" + notmuch git -C version-${ver}.git -p "test${ver}::" init --format-version=${ver} + output=$(git -C version-${ver}.git ls-tree -r --name-only HEAD) + expected=("" "FORMAT") + test_expect_equal "${output}" "${expected[${ver}]}" + + test_begin_subtest "initial commit version=${ver}" + notmuch tag "+test${ver}::a" "+test${ver}::b" id:20091117190054.GU3165@dottiness.seas.harvard.edu + notmuch git -C version-${ver}.git -p "test${ver}::" commit --force + git -C version-${ver}.git ls-tree -r --name-only HEAD | grep -v FORMAT > OUTPUT +cat <<EOF > EXPECTED +tags/${hash[${ver}]}20091117190054.GU3165@dottiness.seas.harvard.edu/a +tags/${hash[${ver}]}20091117190054.GU3165@dottiness.seas.harvard.edu/b +EOF + test_expect_equal_file_nonempty EXPECTED OUTPUT + + test_begin_subtest "second commit repo=${ver}" + notmuch tag "+test${ver}::c" "+test${ver}::d" id:20091117190054.GU3165@dottiness.seas.harvard.edu + notmuch git -C version-${ver}.git -p "test${ver}::" commit --force + git -C version-${ver}.git ls-tree -r --name-only HEAD | grep -v FORMAT > OUTPUT +cat <<EOF > EXPECTED +tags/${hash[$ver]}20091117190054.GU3165@dottiness.seas.harvard.edu/a +tags/${hash[$ver]}20091117190054.GU3165@dottiness.seas.harvard.edu/b +tags/${hash[$ver]}20091117190054.GU3165@dottiness.seas.harvard.edu/c +tags/${hash[$ver]}20091117190054.GU3165@dottiness.seas.harvard.edu/d +EOF + test_expect_equal_file_nonempty EXPECTED OUTPUT + + test_begin_subtest "checkout repo=${ver} " + notmuch dump > BEFORE + notmuch tag -test::${ver}::a '*' + notmuch git -C version-${ver}.git -p "test${ver}::" checkout --force + notmuch dump > AFTER + test_expect_equal_file_nonempty BEFORE AFTER +done + test_done |
