Read git ref for this session from server response

Also, refactor cache parameter computation.
a little more shell escaping