threads / discuss / 31966

Removing unreachable objects in the presence of broken links?

Subject: Removing unreachable objects in the presence of broken links?

## tl;dr

4 messages between Oct 28, 2012 and Nov 11, 2012.

replies: 3people: 2as markdown or json

Geert Uytterhoeven· Oct 28, 2012, 21:21 UTC · lore
Hi,

I managed to have a few missing objects in my development Linux kernel repository, which uses another Linux kernel clone as an alternate. Fortunately nothing is lost, as all missing objects are unreachable. Probably they were in a branch that has been rebased, and the objects existed for a small timespan in the alternate when I tried whether a patch created in the development tree applied cleanly.

Is there a way to force removing unreachable objects in the presence of broken links?

"git prune" doesn't do it, as it aborts when encountering the first missing object. Same with "git repack -[aA]d".

"git fsck" reported
broken link from    tree 1330855dc33c1042b80d4c8ecbb6d56a19557ee8
              to    tree b6c8c53b804662d6a6435c62b6dec1612bfbeb46
broken link from    tree f182e2fa155b9684b79ff6e17159d03d4de9a773
              to    blob d41f9ed0e2aba47ef62b4b4dd211b91cfe474ff8
missing blob d41f9ed0e2aba47ef62b4b4dd211b91cfe474ff8
missing tree b6c8c53b804662d6a6435c62b6dec1612bfbeb46

"git fsck --unreachable HEAD $(git for-each-ref --format="%(objectname)" refs/heads)" told me about lots of unreachable objects, including the tree objects that contain the two broken links.

BTW, every time I now do a rebase that triggers a gc (after the actual rebase
operation has completed), I end up with "(no branch)", so I have to do:
    git banch -D <branch>
    git branch <branch>
    git checkout <branch>
to get back on the branch.
This is with git version 1.7.0.4 (1:1.7.0.4-1ubuntu0.2).
Thanks!
Gr{oetje,eeting}s,
                        Geert

-- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Andreas Schwab· Oct 28, 2012, 21:34 UTC · re: Geert Uytterhoeven · lore

Re: Removing unreachable objects in the presence of broken links?

Geert Uytterhoeven <geert@linux-m68k.org> writes:
> Is there a way to force removing unreachable objects in the presence of broken
> links?
Does it help to forcibly expire the reflogs?
Andreas.
-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Geert Uytterhoeven· Oct 29, 2012, 19:56 UTC · re: Andreas Schwab · lore

Re: Removing unreachable objects in the presence of broken links?

Hi Andreas,
On Sun, Oct 28, 2012 at 10:34 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
Show 6 quoted lines
> Geert Uytterhoeven <geert@linux-m68k.org> writes:
>
>> Is there a way to force removing unreachable objects in the presence of broken
>> links?
>
> Does it help to forcibly expire the reflogs?
You mean "git reflog expire --all --expire=0"?
After that the reflog is empty, but "git gc" still fails.
Gr{oetje,eeting}s,
                        Geert

-- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Geert Uytterhoeven· Nov 11, 2012, 11:15 UTC · re: Geert Uytterhoeven · lore

Re: Removing unreachable objects in the presence of broken links?

On Mon, Oct 29, 2012 at 8:56 PM, Geert Uytterhoeven <geert@linux-m68k.org> wrote:

Show 11 quoted lines
> On Sun, Oct 28, 2012 at 10:34 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
>> Geert Uytterhoeven <geert@linux-m68k.org> writes:
>>
>>> Is there a way to force removing unreachable objects in the presence of broken
>>> links?
>>
>> Does it help to forcibly expire the reflogs?
>
> You mean "git reflog expire --all --expire=0"?
>
> After that the reflog is empty, but "git gc" still fails.

Although "git stash list" didn't show anything, .git/refs/stash still contained one hash.

After running "git stash clear", "git gc" succeeded, and the object pointed to by .git/refs/stash before was gone.

Gr{oetje,eeting}s,
                        Geert

-- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

← back to recent threads