Skip to content

Commit 05b0721

Browse files
jeffhostetlerdscho
authored andcommitted
t7524: add test for verbose status deserialzation
Verify that `git status --deserialize=x -v` does not crash and generates the same output as a normal (scanning) status command. These issues are described in the previous 2 commits. Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
1 parent 3e1eb2b commit 05b0721

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

Diff for: t/t7522-serialized-status.sh

+39
Original file line numberDiff line numberDiff line change
@@ -400,4 +400,43 @@ EOF
400400
401401
'
402402

403+
test_expect_success 'ensure deserialize -v does not crash' '
404+
405+
git init -b main verbose_test &&
406+
touch verbose_test/a &&
407+
touch verbose_test/b &&
408+
touch verbose_test/c &&
409+
git -C verbose_test add a b c &&
410+
git -C verbose_test commit -m abc &&
411+
412+
echo green >>verbose_test/a &&
413+
git -C verbose_test add a &&
414+
echo red_1 >>verbose_test/b &&
415+
echo red_2 >verbose_test/dirt &&
416+
417+
git -C verbose_test status >output.ref &&
418+
git -C verbose_test status -v >output.ref_v &&
419+
420+
git -C verbose_test --no-optional-locks status --serialize=../verbose_test.dat >output.ser.long &&
421+
git -C verbose_test --no-optional-locks status --serialize=../verbose_test.dat_v -v >output.ser.long_v &&
422+
423+
# Verify that serialization does not affect the status output itself.
424+
test_cmp output.ref output.ser.long &&
425+
test_cmp output.ref_v output.ser.long_v &&
426+
427+
GIT_TRACE2_PERF="$(pwd)"/verbose_test.log \
428+
git -C verbose_test status --deserialize=../verbose_test.dat >output.des.long &&
429+
430+
# Verify that normal deserialize was actually used and produces the same result.
431+
test_cmp output.ser.long output.des.long &&
432+
grep -q "deserialize/result:ok" verbose_test.log &&
433+
434+
GIT_TRACE2_PERF="$(pwd)"/verbose_test.log_v \
435+
git -C verbose_test status --deserialize=../verbose_test.dat_v -v >output.des.long_v &&
436+
437+
# Verify that vebose mode produces the same result because verbose was rejected.
438+
test_cmp output.ser.long_v output.des.long_v &&
439+
grep -q "deserialize/reject:args/verbose" verbose_test.log_v
440+
'
441+
403442
test_done

0 commit comments

Comments
 (0)