Merge branch 'js/add-p-diff-parsing-fix'
[git/debian.git] / t / t0092-diagnose.sh
blobfca9b58489cf5409dc1a9d908a058ddfd24b8fa2
1 #!/bin/sh
3 test_description='git diagnose'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 test_expect_success UNZIP 'creates diagnostics zip archive' '
9 test_when_finished rm -rf report &&
11 git diagnose -o report -s test >out &&
12 grep "Available space" out &&
14 zip_path=report/git-diagnostics-test.zip &&
15 test_path_is_file "$zip_path" &&
17 # Check zipped archive content
18 "$GIT_UNZIP" -p "$zip_path" diagnostics.log >out &&
19 test_file_not_empty out &&
21 "$GIT_UNZIP" -p "$zip_path" packs-local.txt >out &&
22 grep ".git/objects" out &&
24 "$GIT_UNZIP" -p "$zip_path" objects-local.txt >out &&
25 grep "^Total: [0-9][0-9]*" out &&
27 # Should not include .git directory contents by default
28 ! "$GIT_UNZIP" -l "$zip_path" | grep ".git/"
31 test_expect_success UNZIP '--mode=stats excludes .git dir contents' '
32 test_when_finished rm -rf report &&
34 git diagnose -o report -s test --mode=stats >out &&
36 # Includes pack quantity/size info
37 "$GIT_UNZIP" -p "$zip_path" packs-local.txt >out &&
38 grep ".git/objects" out &&
40 # Does not include .git directory contents
41 ! "$GIT_UNZIP" -l "$zip_path" | grep ".git/"
44 test_expect_success UNZIP '--mode=all includes .git dir contents' '
45 test_when_finished rm -rf report &&
47 git diagnose -o report -s test --mode=all >out &&
49 # Includes pack quantity/size info
50 "$GIT_UNZIP" -p "$zip_path" packs-local.txt >out &&
51 grep ".git/objects" out &&
53 # Includes .git directory contents
54 "$GIT_UNZIP" -l "$zip_path" | grep ".git/" &&
56 "$GIT_UNZIP" -p "$zip_path" .git/HEAD >out &&
57 test_file_not_empty out
60 test_done