Don’t write formatter output to object database if not updating the repo

This commit is contained in:
Sven Weidauer 2022-06-06 11:43:44 +02:00
parent aad741f8cc
commit 95633bfd9f

View file

@ -102,7 +102,9 @@ module FormatStaged
pid1, r = pipe_command 'git', 'cat-file', '-p', file.dst_hash
pid2, r = pipe_command format_command, source: r
pid3, r = pipe_command 'git', 'hash-object', '-w', '--stdin', source: r
write_args = write ? ['-w'] : []
pid3, r = pipe_command 'git', 'hash-object', *write_args, '--stdin', source: r
result = read_output(r, lines: false).chomp