update-marl: run Gerrit hook on generated CLs

This CL ports the changes from:
https://swiftshader-review.googlesource.com/c/SwiftShader/+/65648
to the update-marl script.

Bug: b/231456527
Change-Id: I13b0791de74ef323fafd1973e4628076f91979fb
diff --git a/third_party/update-marl.sh b/third_party/update-marl.sh
index 7ca1ec1..09aa245 100755
--- a/third_party/update-marl.sh
+++ b/third_party/update-marl.sh
@@ -15,3 +15,10 @@
 HEAD_CHANGE=`echo "$ALL_CHANGES" | egrep '[0-9a-f]{9}' -o -m 1`
 LOG_MSG=`echo -e "Update Marl to $HEAD_CHANGE\n${REASON}\nChanges:\n$ALL_CHANGES\n\nCommands:\n    ./third_party/update-marl.sh\n\nBug: b/140546382"`
 git commit --amend -m "$LOG_MSG"
+
+# Use filter-branch to apply the Gerrit commit hook to both CLs
+GIT_DIR=$(readlink -f "$(git rev-parse --git-dir)")
+TMP_MSG="${GIT_DIR}/COMMIT_MSG_REWRITE"
+FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch -f --msg-filter \
+  "cat > ${TMP_MSG} && \"${GIT_DIR}/hooks/commit-msg\" ${TMP_MSG} && cat \"${TMP_MSG}\"" HEAD...HEAD~1
+rm -rf "${TMP_MSG}"
\ No newline at end of file