Repairing broken repositories

Alexander Miloslavskiy 3 years ago 0

Recently, I have seen a few broken repositories, both on my computer and my team members' computers. I believe this is connected to SSD's, where failing to write cache (due to blue screen or power failure) will often turn a file into a handful of zeroes.

Repairing a repository is usually simple, git fsck will tell SHAs for objects that are corrupted, then one needs to find the same object on remote, or team member, or backup, or a copy of repository, and copy it to corrupted repository.

In practice, repairing by hand is more complicated:

1) Many people simply don't know how to repair a repository

2) Repairing by hand becomes more difficult when object is packed on healthy repository.

I suggest that a feature is added to SmartGit, which will search all known copies of repository for a healthy copy of corrupted object, and repair it.