Skip to content

Commit 2150dfd

Browse files
Report an error if the git ls-tree command fails in the content_aware_hash script (flutter#185170)
Without this, the script will output an incorrect hash and return a successful exit code if "git ls-tree" fails. See flutter#184376
1 parent 1bd49aa commit 2150dfd

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

bin/internal/content_aware_hash.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,8 @@ GIT_OPTS=()
7171
if [[ "$(git --version)" == *"Apple Git"* ]]; then
7272
GIT_OPTS=(-c core.multiPackIndex=false)
7373
fi
74-
git "${GIT_OPTS[@]}" -C "$FLUTTER_ROOT" ls-tree "$BASEREF" -- "${TRACKEDFILES[@]}" | git hash-object --stdin
74+
if ! HASH=$(set -o pipefail; git "${GIT_OPTS[@]}" -C "$FLUTTER_ROOT" ls-tree "$BASEREF" -- "${TRACKEDFILES[@]}" | git hash-object --stdin); then
75+
>&2 echo "${0}: git error when generating Flutter content-aware hash"
76+
exit 1
77+
fi
78+
echo "$HASH"

0 commit comments

Comments
 (0)