summaryrefslogtreecommitdiffstats
path: root/t/t0092-diagnose.sh
diff options
context:
space:
mode:
authorVictoria Dye <vdye@github.com>2022-08-12 22:10:16 +0200
committerJunio C Hamano <gitster@pobox.com>2022-08-12 22:20:02 +0200
commit7ecf193f7d621f618b322498d884ee103a44522f (patch)
tree0f32a7af200f886cadbceab0fc86be37f2789f70 /t/t0092-diagnose.sh
parentbuiltin/diagnose.c: create 'git diagnose' builtin (diff)
downloadgit-7ecf193f7d621f618b322498d884ee103a44522f.tar.xz
git-7ecf193f7d621f618b322498d884ee103a44522f.zip
builtin/diagnose.c: add '--mode' option
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>
Diffstat (limited to '')
-rwxr-xr-xt/t0092-diagnose.sh30
1 files changed, 29 insertions, 1 deletions
diff --git a/t/t0092-diagnose.sh b/t/t0092-diagnose.sh
index b6923726fd..fca9b58489 100755
--- a/t/t0092-diagnose.sh
+++ b/t/t0092-diagnose.sh
@@ -26,7 +26,35 @@ test_expect_success UNZIP 'creates diagnostics zip archive' '
# Should not include .git directory contents by default
! "$GIT_UNZIP" -l "$zip_path" | grep ".git/"
- grep "^Total: [0-9][0-9]*" out
+'
+
+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