filter-repo: add tests for --debug and --dry-run

Signed-off-by: Elijah Newren <newren@gmail.com>
This commit is contained in:
Elijah Newren 2019-03-13 07:39:33 -07:00
parent 690c824fad
commit 8a8a15b998

View File

@ -282,6 +282,80 @@ test_expect_success 'refs/replace/ to add more initial history' '
)
'
test_expect_success '--debug' '
(
git clone file://"$(pwd)"/metasyntactic debug &&
cd debug &&
git filter-repo --path words --debug &&
test $(git rev-list --count HEAD) = 2 &&
git cat-file --batch-check --batch-all-objects >all-objs &&
test_line_count = 12 all-objs &&
git log --format=%n --name-only | sort | uniq >filenames &&
test_line_count = 6 filenames &&
test_path_is_file .git/filter-repo/fast-export.original &&
grep "^commit " .git/filter-repo/fast-export.original >out &&
test_line_count = 3 out &&
test_path_is_file .git/filter-repo/fast-export.filtered &&
grep "^commit " .git/filter-repo/fast-export.filtered >out &&
test_line_count = 2 out
)
'
test_expect_success '--dry-run' '
(
git clone file://"$(pwd)"/metasyntactic dry_run &&
cd dry_run &&
git filter-repo --path words --dry-run &&
git show-ref | grep master >out &&
test_line_count = 2 out &&
awk "{print \$1}" out | uniq >out2 &&
test_line_count = 1 out2 &&
test $(git rev-list --count HEAD) = 3 &&
git cat-file --batch-check --batch-all-objects >all-objs &&
test_line_count = 19 all-objs &&
git log --format=%n --name-only | sort | uniq >filenames &&
test_line_count = 9 filenames &&
test_path_is_file .git/filter-repo/fast-export.original &&
grep "^commit " .git/filter-repo/fast-export.original >out &&
test_line_count = 3 out &&
test_path_is_file .git/filter-repo/fast-export.filtered &&
grep "^commit " .git/filter-repo/fast-export.filtered >out &&
test_line_count = 2 out
)
'
test_expect_success '--dry-run --stdin' '
(
git clone file://"$(pwd)"/metasyntactic dry_run_stdin &&
cd dry_run_stdin &&
git fast-export --all | git filter-repo --path words --dry-run --stdin &&
git show-ref | grep master >out &&
test_line_count = 2 out &&
awk "{print \$1}" out | uniq >out2 &&
test_line_count = 1 out2 &&
test $(git rev-list --count HEAD) = 3 &&
git cat-file --batch-check --batch-all-objects >all-objs &&
test_line_count = 19 all-objs &&
git log --format=%n --name-only | sort | uniq >filenames &&
test_line_count = 9 filenames &&
test_path_is_missing .git/filter-repo/fast-export.original &&
test_path_is_file .git/filter-repo/fast-export.filtered &&
grep "^commit " .git/filter-repo/fast-export.filtered >out &&
test_line_count = 2 out
)
'
test_expect_success 'setup analyze_me' '
test_create_repo analyze_me &&
(