Reland "[clang-format] Optimize processing .clang-format-ignore files"

(42ec976184ac was reverted by 26993f61673e due to a use-after-scope bug.)

Reuse the patterns governing the previous input file being formatted if
the current input file is from the same directory.

NOKEYCHECK=True
GitOrigin-RevId: b53628a52d1947c51e250d6fa4ff5dd12b737aa0
1 file changed