Check the existence of .aidl-format before using it
Bug: 178876998
Test: add a new aidl file that isn't correctly formatted.
create a CL, and run `repo upload`.
The formatting error is detected and automatic fix is applied.
Amend the comment and re-run `repo upload`.
No error.
Change-Id: Ib7a038c00fb4801b50edee9aed5defe6c1789098
diff --git a/aidl-format.sh b/aidl-format.sh
index 61c900d..ab9e207 100755
--- a/aidl-format.sh
+++ b/aidl-format.sh
@@ -73,7 +73,7 @@
local input="$1"
local style="$2"
local temp="$(mktemp)"
- local styletext="$([ -n "$style" ] && cat "$style" | tr '\n' ',' 2> /dev/null)"
+ local styletext="$([ -f "$style" ] && cat "$style" | tr '\n' ',' 2> /dev/null)"
cat "$input" | clang-format \
--style='{BasedOnStyle: Google,
ColumnLimit: 100,