template.ref must recursive to find the original source template

R=arv
BUG=

Review URL: https://codereview.appspot.com/9769044