From 95633bfd9fa5ca3f8cd73282e1a73127b72523d7 Mon Sep 17 00:00:00 2001 From: Sven Weidauer Date: Mon, 6 Jun 2022 11:43:44 +0200 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20write=20formatter=20output=20to?= =?UTF-8?q?=20object=20database=20if=20not=20updating=20the=20repo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/format-staged/job.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/format-staged/job.rb b/lib/format-staged/job.rb index e061fec..18bacc8 100644 --- a/lib/format-staged/job.rb +++ b/lib/format-staged/job.rb @@ -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