]> granicus.if.org Git - libevent/commitdiff
checkpatch.sh: fix clang-format-diff usage
authorAzat Khuzhin <azat@libevent.org>
Wed, 27 May 2020 17:33:25 +0000 (20:33 +0300)
committerAzat Khuzhin <azat@libevent.org>
Wed, 27 May 2020 17:36:38 +0000 (20:36 +0300)
- strip 1 path component
- it does not accept file name anymore, only stdin

Refs: #1029

checkpatch.sh

index 3ce56b7a9c0b83cb60f5c771669f3fdfcbb58833..5393799dcdf6677a49c624fcb6158382b3dbdc95 100755 (executable)
@@ -165,7 +165,7 @@ function clang_style()
     echo "{ $(sed -e 's/#.*//' -e '/---/d' -e '/\.\.\./d' "$c" | tr $'\n' ,) }"
 }
 function clang_format() { clang-format -style="$(clang_style)" "$@"; }
-function clang_format_diff() { clang-format-diff -style="$(clang_style)" "$@"; }
+function clang_format_diff() { cat "$@" | clang-format-diff -p1 -style="$(clang_style)"; }
 # for non-bare repo will work
 function clang_format_git()
 { git format-patch --stdout "$@" -1 | clang_format_diff; }