Add very draft version of code taken from cmd/go

It enough for use VCS commands.