Make clean testing work for `repo`.
Check the output of `git status --porcelain=v1` rather than the exit
code which isn't a reliable indicator, especially when the command is
run via `repo`.
Change-Id: I6fec6f1f48b6de40f764fd373351a496110a4662
diff --git a/kokoro/ubuntu/build.sh b/kokoro/ubuntu/build.sh
index 553b687..bbe1e5a 100755
--- a/kokoro/ubuntu/build.sh
+++ b/kokoro/ubuntu/build.sh
@@ -30,14 +30,14 @@
# Returns true if `git status` reports uncommitted changes in the source tree.
function is_repo_dirty() {
- local cmd=(git status --porcelain)
+ local cmd=(git status --porcelain=v1)
if [ -d ".repo" ]
then
# This source tree was checked out using `repo`. Check the
# status of all projects.
cmd=(${REPO} forall -c "${cmd[@]}")
fi
- [[ $(${cmd[@]}) ]]
+ ! (u="$(${cmd[@]})" && test -z "$u")
return $?
}