git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Suggestion: "verify/repair" option for 'git gc'
@ 2021-10-13 15:47 Alexandr Miloslavskiy
  2021-10-14  1:19 ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 5+ messages in thread
From: Alexandr Miloslavskiy @ 2021-10-13 15:47 UTC (permalink / raw)
  To: git

Suggestion
----------
1) It would be nice if 'git gc' had an option to also verify
    (like 'git fsck') the repo and report corruption. I think that it's
    a good idea to have it in 'gc' for performance reasons, because
    'git gc' already reads things.

2) It would be nice if git could automatically download blobs from
    remote if local blob is corrupted. Maybe it was already implemented,
    see story 3 below.

Motivation
----------

-- Story 1 --
Just a few days ago I encountered another secretly broken repo which
caused some small bugs in the git UI I'm using. The repo worked mostly
fine, that's why I had no idea that it's corrupted.

My git UI invokes 'git gc' sometimes and if that detected the
corruption, I wouldn't have to spend time hunting the bug in UI.

Specifically, it reports these errors on `git fsck`
   error: object 0189425cc210555c36383293c468df5da73acc48 is a commit, 
not a blob
   error in tree 1d571d7354f99b726bbcc0cb232b3f47846c71a1: broken links
   error: object 0189425cc210555c36383293c468df5da73acc48 is a commit, 
not a blob
   error in tree 2808b286c2a933e88735d97416e29b9514fc6af2: broken links
   error: object 0189425cc210555c36383293c468df5da73acc48 is a commit, 
not a blob
   error in tree 604f6f6c4fbf8da7a593708e863e68f8c5a27d07: broken links
   error: object 0189425cc210555c36383293c468df5da73acc48 is a commit, 
not a blob
   error in tree 6a2c4a5ef0b0ee7aa85d88c3147b7558a6a7c29f: broken links

The repo is not confidential and I could share it if needed.
I "solved" the problem by cloning a new copy.

-- Story 2 --
A few years ago, I had another repo that wasn't used for a couple years
and had corrupted blobs. The repo looked fine until I tried to clone
from it. Unfortunately it was the only copy and I had to write some
code to "guess" the blob's contents to repair the repo.

If 'git gc' detected corruption, I would have known about the problem 
earlier,
when I still had other copies around.

-- Story 3 --
Also a few years ago, I had a repo with a single corrupted blob. I don't
remember why, but simply re-cloning it was a headache. I managed to fix repo
by issuing a command to re-download a blob from remote. Git could totally do
that itself, I think.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-10-15  0:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-13 15:47 Suggestion: "verify/repair" option for 'git gc' Alexandr Miloslavskiy
2021-10-14  1:19 ` Ævar Arnfjörð Bjarmason
2021-10-14 12:47   ` Alexandr Miloslavskiy
2021-10-14 15:17     ` Ævar Arnfjörð Bjarmason
2021-10-14 20:23       ` Alexandr Miloslavskiy

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).