revision.c: better error reporting on ref from different worktrees