Fixes #3593 : No commit when restoring HEAD

http://www.rudder-project.org/redmine/issues/3593