generate .gitrevision file if it does not exist

(cherry picked from commit eb06db1a12ee39cc251f3ff7d7fe6918a6c5898c)