Index: add a setter for workdir
support setting a detatched HEAD