
[jgit-dev] Set current branch on bare repository

I need to change current branch on bare Repository.
I try this:

Repository r = ...;
RefUpdate refUpdate = r.updateRef(Constants.HEAD, true);
RefUpdate.Result res = refUpdate.update();

as a result i get FAST_FORWARD (without detaching symbolic ref i get
NO_CHANGE ). But when i call  r.getBranch() result is master branch.
I think need to make some refresh or sync, but not sure. Can you help
with this problem?

Thanks, Denis Bardadym.