From 246635341526ee71f12afd4d1f8a30d18f7dd99b Mon Sep 17 00:00:00 2001 From: Xuehai Pan Date: Mon, 3 Jan 2022 22:08:49 +0800 Subject: [PATCH] style: use short flags for `patch` command for compatibility --- Library/Homebrew/style.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/style.rb b/Library/Homebrew/style.rb index 9e3d5bab9a..32ffd11ac0 100644 --- a/Library/Homebrew/style.rb +++ b/Library/Homebrew/style.rb @@ -180,13 +180,14 @@ module Homebrew if fix # patch options: - # --get=0 : suppress environment variable `PATCH_GET`, ignore RCS, ClearCase, Perforce, and SCCS - # --force : we know what we are doing, force apply patches - # --directory=/ : change to root directory, since we use absolute file paths - # --strip=0 : do not strip path prefixes, since we are at root directory - patch_command = %w[patch --get=0 --force --directory=/ --strip=0] + # -g 0 (--get=0) : suppress environment variable `PATCH_GET` + # -f (--force) : we know what we are doing, force apply patches + # -d / (--directory=/) : change to root directory, since we use absolute file paths + # -p0 (--strip=0) : do not strip path prefixes, since we are at root directory + # NOTE: we use short flags where for compatibility + patch_command = %w[patch -g 0 -f -d / -p0] patches = system_command(shellcheck, args: ["--format=diff", *args]).stdout - Utils.safe_popen_write(*patch_command) { |p| p.write(patches) } + Utils.safe_popen_write(*patch_command) { |p| p.write(patches) } if patches.present? end case output_type