Jonathan Nieder [off-list ref] writes:
Introduce a test_line_count function to help. If used like
git ls-files -u B >output &&
test_line_count -eq 3 output
it will produce output like
test_line_count: line count for output !-eq 3
100644 b023018cabc396e7692c70bbf5784a93d3f738ab 2 hi.c
100644 45b983be36b73c0788dc9cbcb76cbb80fc7bb057 3 hi.c
on failure.
Sounds like a sane thing to do.
Especially because you wrote the implementation without surrounding dq
pair, the callers can say "test_line_count = $N $file" instead of -eq and
things will not break. Nice.