7ecf193f7d
Create '--mode=<mode>' option in 'git diagnose' to allow users to optionally select non-default diagnostic information to include in the output archive. Additionally, document the currently-available modes, emphasizing the importance of not sharing a '--mode=all' archive publicly due to the presence of sensitive information. Note that the option parsing callback - 'option_parse_diagnose()' - is added to 'diagnose.c' rather than 'builtin/diagnose.c' so that it may be reused in future callers configuring a diagnostics archive. Helped-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Victoria Dye <vdye@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
61 lines
1.5 KiB
Bash
Executable File
61 lines
1.5 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
test_description='git diagnose'
|
|
|
|
TEST_PASSES_SANITIZE_LEAK=true
|
|
. ./test-lib.sh
|
|
|
|
test_expect_success UNZIP 'creates diagnostics zip archive' '
|
|
test_when_finished rm -rf report &&
|
|
|
|
git diagnose -o report -s test >out &&
|
|
grep "Available space" out &&
|
|
|
|
zip_path=report/git-diagnostics-test.zip &&
|
|
test_path_is_file "$zip_path" &&
|
|
|
|
# Check zipped archive content
|
|
"$GIT_UNZIP" -p "$zip_path" diagnostics.log >out &&
|
|
test_file_not_empty out &&
|
|
|
|
"$GIT_UNZIP" -p "$zip_path" packs-local.txt >out &&
|
|
grep ".git/objects" out &&
|
|
|
|
"$GIT_UNZIP" -p "$zip_path" objects-local.txt >out &&
|
|
grep "^Total: [0-9][0-9]*" out &&
|
|
|
|
# Should not include .git directory contents by default
|
|
! "$GIT_UNZIP" -l "$zip_path" | grep ".git/"
|
|
'
|
|
|
|
test_expect_success UNZIP '--mode=stats excludes .git dir contents' '
|
|
test_when_finished rm -rf report &&
|
|
|
|
git diagnose -o report -s test --mode=stats >out &&
|
|
|
|
# Includes pack quantity/size info
|
|
"$GIT_UNZIP" -p "$zip_path" packs-local.txt >out &&
|
|
grep ".git/objects" out &&
|
|
|
|
# Does not include .git directory contents
|
|
! "$GIT_UNZIP" -l "$zip_path" | grep ".git/"
|
|
'
|
|
|
|
test_expect_success UNZIP '--mode=all includes .git dir contents' '
|
|
test_when_finished rm -rf report &&
|
|
|
|
git diagnose -o report -s test --mode=all >out &&
|
|
|
|
# Includes pack quantity/size info
|
|
"$GIT_UNZIP" -p "$zip_path" packs-local.txt >out &&
|
|
grep ".git/objects" out &&
|
|
|
|
# Includes .git directory contents
|
|
"$GIT_UNZIP" -l "$zip_path" | grep ".git/" &&
|
|
|
|
"$GIT_UNZIP" -p "$zip_path" .git/HEAD >out &&
|
|
test_file_not_empty out
|
|
'
|
|
|
|
test_done
|