t3301: Modernize

Make this test script appear somewhat less old-fashioned:
 - Use test helper functions:
    - write_script
    - test_commit
    - test_write_lines
    - test_config
    - test_unconfig
    - test_path_is_missing
 - Remove whitespace between redirection operators and their targets.
 - Move preparation of "expect" files into tests.
 - More consistent quoting, especially around commands that might
   expand to nothing.
 - More visibility of important whitespace with ${indent}.
 - Combine pairs of tests that unnecessarily split setup and verification.

Improved-by: Eric Sunshine <sunshine@sunshineco.com>
Improved-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johan Herland <johan@herland.net>
squash! t3301: Modernize

Remove quoting of $(... | wc -l) output to fix tests on mac

Improved-by: Eric Sunshine <sunshine@sunshineco.com>
squash! squash! t3301: Modernize

s/output/actual/

Improved-by: Eric Sunshine <sunshine@sunshineco.com>