Subject: (wishlist) time-machine and ambiguous prefix SHA-1

From: zimoun <[email-masked]>
Date: Thu, 06 Jan 2022 10:27:00 +0100

Hi,

Now the repo is becoming large, the short prefix using 6 character can
be refer to 2 Git objects.  For instance,

--8<---------------cut here---------------start------------->8---
$ git show 7022eb6
error: short object ID 7022eb6 is ambiguous
hint: The candidates are:
hint:   7022eb6ea0 commit 2021-12-07 - gnu: Add notcurses.
hint:   7022eb6c9a blob
[..]
--8<---------------cut here---------------end--------------->8---

The issue is the error report by “guix time-machine” (or guix pull), for
instance,

--8<---------------cut here---------------start------------->8---
$ guix time-machine --commit=7022eb6 -- help
guix time-machine: error: Git error: ambiguous SHA1 prefix - found multiple pack entries
--8<---------------cut here---------------end--------------->8---

It could be nice that, when short prefix is ambiguous:

   1) try the commit object candidate if only one
   2) show a hint for the possible candidates

Cheers,
simon