{"thread":{"id":"31966","subject":"Removing unreachable objects in the presence of broken links?","startedAt":"2012-10-28T21:21:32Z","lastAt":"2012-11-11T11:15:24Z","messageCount":4,"participants":["Geert Uytterhoeven","Andreas Schwab"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"202068","messageId":"CAMuHMdUqUtDspOP2kE9wtGEr9aJHGGBG=HRomdY6NRa8gxar4A@mail.gmail.com","threadId":"31966","inReplyTo":null,"subject":"Removing unreachable objects in the presence of broken links?","fromName":"Geert Uytterhoeven","fromEmail":"geert@linux-m68k.org","sentAt":"2012-10-28T21:21:32Z","receivedAt":"2012-10-28T21:21:32Z","isPatch":false,"sender":{"key":"geert@linux-m68k.org","avatar":"https://gravatar.com/avatar/8105b34f653a7b5b98e225e565b11ebcc762ad4ab1a9d905a4663db029a9e6bc?d=mp&s=160"},"body":"Hi,\n\nI managed to have a few missing objects in my development Linux kernel\nrepository, which uses another Linux kernel clone as an alternate.\nFortunately nothing is lost, as all missing objects are unreachable.\nProbably they were in a branch that has been rebased, and the objects existed\nfor a small timespan in the alternate when I tried whether a patch created\nin the development tree applied cleanly.\n\nIs there a way to force removing unreachable objects in the presence of broken\nlinks?\n\n\"git prune\" doesn't do it, as it aborts when encountering the first\nmissing object.\nSame with \"git repack -[aA]d\".\n\n\"git fsck\" reported\nbroken link from    tree 1330855dc33c1042b80d4c8ecbb6d56a19557ee8\n              to    tree b6c8c53b804662d6a6435c62b6dec1612bfbeb46\nbroken link from    tree f182e2fa155b9684b79ff6e17159d03d4de9a773\n              to    blob d41f9ed0e2aba47ef62b4b4dd211b91cfe474ff8\nmissing blob d41f9ed0e2aba47ef62b4b4dd211b91cfe474ff8\nmissing tree b6c8c53b804662d6a6435c62b6dec1612bfbeb46\n\n\"git fsck --unreachable HEAD $(git for-each-ref\n--format=\"%(objectname)\" refs/heads)\"\ntold me about lots of unreachable objects, including the tree objects that\ncontain the two broken links.\n\nBTW, every time I now do a rebase that triggers a gc (after the actual rebase\noperation has completed), I end up with \"(no branch)\", so I have to do:\n    git banch -D <branch>\n    git branch <branch>\n    git checkout <branch>\nto get back on the branch.\nThis is with git version 1.7.0.4 (1:1.7.0.4-1ubuntu0.2).\n\nThanks!\n\nGr{oetje,eeting}s,\n\n                        Geert\n\n--\nGeert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org\n\nIn personal conversations with technical people, I call myself a hacker. But\nwhen I'm talking to journalists I just say \"programmer\" or something like that.\n                                -- Linus Torvalds\n"},{"id":"202069","messageId":"m2r4oiffgy.fsf@igel.home","threadId":"31966","inReplyTo":"CAMuHMdUqUtDspOP2kE9wtGEr9aJHGGBG=HRomdY6NRa8gxar4A@mail.gmail.com","subject":"Re: Removing unreachable objects in the presence of broken links?","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2012-10-28T21:34:37Z","receivedAt":"2012-10-28T21:34:37Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Geert Uytterhoeven <geert@linux-m68k.org> writes:\n\n> Is there a way to force removing unreachable objects in the presence of broken\n> links?\n\nDoes it help to forcibly expire the reflogs?\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"202134","messageId":"CAMuHMdU5ZNFs-_TeUE4ntzCCOp85DSOyWMrjJ=yV76MSmjfxDQ@mail.gmail.com","threadId":"31966","inReplyTo":"m2r4oiffgy.fsf@igel.home","subject":"Re: Removing unreachable objects in the presence of broken links?","fromName":"Geert Uytterhoeven","fromEmail":"geert@linux-m68k.org","sentAt":"2012-10-29T19:56:17Z","receivedAt":"2012-10-29T19:56:17Z","isPatch":false,"sender":{"key":"geert@linux-m68k.org","avatar":"https://gravatar.com/avatar/8105b34f653a7b5b98e225e565b11ebcc762ad4ab1a9d905a4663db029a9e6bc?d=mp&s=160"},"body":"Hi Andreas,\n\nOn Sun, Oct 28, 2012 at 10:34 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:\n> Geert Uytterhoeven <geert@linux-m68k.org> writes:\n>\n>> Is there a way to force removing unreachable objects in the presence of broken\n>> links?\n>\n> Does it help to forcibly expire the reflogs?\n\nYou mean \"git reflog expire --all --expire=0\"?\n\nAfter that the reflog is empty, but \"git gc\" still fails.\n\nGr{oetje,eeting}s,\n\n                        Geert\n\n--\nGeert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org\n\nIn personal conversations with technical people, I call myself a hacker. But\nwhen I'm talking to journalists I just say \"programmer\" or something like that.\n                                -- Linus Torvalds\n"},{"id":"202814","messageId":"CAMuHMdXPg-GCnkSCZmeA8HKA4hback7aUNpK5AigKKe2z+2uRA@mail.gmail.com","threadId":"31966","inReplyTo":"CAMuHMdU5ZNFs-_TeUE4ntzCCOp85DSOyWMrjJ=yV76MSmjfxDQ@mail.gmail.com","subject":"Re: Removing unreachable objects in the presence of broken links?","fromName":"Geert Uytterhoeven","fromEmail":"geert@linux-m68k.org","sentAt":"2012-11-11T11:15:24Z","receivedAt":"2012-11-11T11:15:24Z","isPatch":false,"sender":{"key":"geert@linux-m68k.org","avatar":"https://gravatar.com/avatar/8105b34f653a7b5b98e225e565b11ebcc762ad4ab1a9d905a4663db029a9e6bc?d=mp&s=160"},"body":"On Mon, Oct 29, 2012 at 8:56 PM, Geert Uytterhoeven\n<geert@linux-m68k.org> wrote:\n> On Sun, Oct 28, 2012 at 10:34 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:\n>> Geert Uytterhoeven <geert@linux-m68k.org> writes:\n>>\n>>> Is there a way to force removing unreachable objects in the presence of broken\n>>> links?\n>>\n>> Does it help to forcibly expire the reflogs?\n>\n> You mean \"git reflog expire --all --expire=0\"?\n>\n> After that the reflog is empty, but \"git gc\" still fails.\n\nAlthough \"git stash list\" didn't show anything, .git/refs/stash still contained\none hash.\n\nAfter running \"git stash clear\", \"git gc\" succeeded, and the object pointed to\nby .git/refs/stash before was gone.\n\nGr{oetje,eeting}s,\n\n                        Geert\n\n--\nGeert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org\n\nIn personal conversations with technical people, I call myself a hacker. But\nwhen I'm talking to journalists I just say \"programmer\" or something like that.\n                                -- Linus Torvalds\n"}]}