Added a check for this.  I've done this by ensuring the a tree change adding the file exists on refs/heads/foo branch.