git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergio Callegari <sergio.callegari@gmail.com>
To: git@vger.kernel.org
Subject: Potentially dangerous behavior of git gc
Date: Mon, 19 Oct 2009 08:04:58 +0000 (UTC)	[thread overview]
Message-ID: <loom.20091019T095725-840@post.gmane.org> (raw)

Hi,

I encountered an issue with git gc.

Consider the following scenario. Repo A is using repo B as an alternate object
database through the .git/objects/info/alternates mechanism. B is at
/some_path/B.  A has some references, including HEAD that are pointing at
objects that are in fact in the object database of B.

For some reasons, paths are modified on the machine, so that B gets moved at
/some_new_path/B.

Obviously A cannot find its objects anymore and its alternate info should be
updated.

Suppose that now one runs git gc on A.

Correctly git gc complains about the broken alternate link.
And then complains again as it cannot find some objects.

However, rather than trying to preserve the repo integrity, it then _removes_
all the references pointing to non existing objects.

With this when the alternate info of A is finally updated, A is broken, missing
many references and not having a head anymore.

Would it be better to have git gc not to take dangerous actions on potentially
problematic repos?

Thanks

Sergio

             reply	other threads:[~2009-10-19  8:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-19  8:04 Sergio Callegari [this message]
2009-10-19 11:21 ` Potentially dangerous behavior of git gc Miklos Vajna
2009-10-20 11:40   ` Sergio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=loom.20091019T095725-840@post.gmane.org \
    --to=sergio.callegari@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).