Fixes <https://bugs.gnu.org/32618>.
Reported by Eric Brown <brown@fastmail.com>.
* guix/git.scm (update-cached-checkout): Remove "origin/" from default
REF. Define CANONICAL-REF and use it instead of REF.
(latest-repository-commit): Remove "origin/" from default REF.
* guix/channels.scm (%default-channels): Remove "origin/" from
'branch'.
* guix/git.scm (repository->head-sha1, copy-to-store): Remove.
(switch-to-ref): Return the OID of OBJ.
(update-cached-checkout): New procedure, with code from
'latest-repository-commit'.
(latest-repository-commit): Use it.
Fixes <https://bugs.gnu.org/30716>.
Reported by Björn Höfling <bjoern.hoefling@bjoernhoefling.de>.
* guix/git.scm (switch-to-ref): When REF is a commit, check the length
of COMMIT and use 'object-lookup-prefix' if available.
This makes 'latest-repository-commit' significantly more efficient and
reduces disk usage in the store.
* guix/git.scm (copy-to-store)[dot-git?]: New procedure.
Pass it as the #:select? argument to 'add-to-store'.