Re: git fsck: unreachable vs. dangling
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 14, 2015, 08:05 UTC
- Message-ID
- <CAPc5daXRpfSrvcae0W+YU-51prCoFGxz_hkhtp7FZ-K9_eeeBQ@mail.gmail.com>
- In-Reply-To
- <CAHGBnuOYLpkeUop9vNH3+WSKqrM3NCSqvu-NZnPnk3gEkAr6eg@mail.gmail.com>
On Tue, Apr 14, 2015 at 12:16 AM, Sebastian Schuberth <sschuberth@gmail.com> wrote:
Show 8 quoted lines
> Hi, > > reading through the fsck docs [1] I'm having a hard time understanding > what the difference between "unreachable" and "dangling" objects are. > > By example, suppose I have a commit A that is the tip of exactly one > branch (and no tag or other ref points to A). If I delete that branch, > is A now dangling, or unreachable, or both?
Suppose that branch consists of two commits, A and A^. When you lose that branch (git branch -D that-branch), both A and A^ become unreachable. So are trees and blobs that appear only in A and A^ and nowhere else; they are also unreachable.
A dangling object is an unreachable object that cannot be made reachable by any way other than pointing at it directly with a ref. A^ is not dangling, because you can make it reachable by pointing A (the tip of the original branch you just lost) with a ref. A on the other hand is dangling (if you had a tag object that points at A that you lost, then A is merely unreachable but not dangling, because you can point at that tag with a ref and make A reachable).