What if you get a 8-figure SHA clash?

Please see this post by me to a previous question.

I suggest using the 8-figure start of the “no change” snapshot’s SHA to prune it, as reported in the JSON object returned from backup using the --json switch.

I realise that 16 ** 8 is a daunting figure, 4,294,967,296 to be precise. But what would actually happen if the repo found that two SHAs began with the same 8 figures? The obvious thing there would be to try and find the full snapshot SHA based on other known characteristics of the snapshot you wanted to prune, using restic snapshots.

Seeing as this is not an occurrence one can “fake”, to my knowledge, I just want to know what actually happens in a case like this.

In that case restic will complain that the prefix is ambiguous:

The proper fix would be to solve Include full snapshot id in backup json command output · Issue #2724 · restic/restic · GitHub .


Yes, there’s a slight inconsistency there, in that restic snapshots supplies both the full SHA and the 8-figure start (as it says in that issue thread).

I assume that would be fairly easy to fix…