From: "Klas Lindberg" <klas.lindberg@gmail.com>
To: "Michael J Gruber" <git@drmicha.warpmail.net>
Cc: "Steven Grimm" <koreth@midwinter.com>,
"Git Users List" <git@vger.kernel.org>
Subject: Re: How to remove a commit object?
Date: Thu, 2 Oct 2008 15:36:41 +0200 [thread overview]
Message-ID: <33f4f4d70810020636g77f4180cm7aa6b7de07ae5beb@mail.gmail.com> (raw)
In-Reply-To: <48D36DF4.3030607@drmicha.warpmail.net>
This doesn't seem to work for me. I will soon be in a situation where
I need to selectively delete commits in such a way that they become
completely irrecoverable. I.e. it is not enough to revert a commit.
The *original* commit must be removed. And of course, the repo history
is too complex to allow for rebasing followed by garbage collection or
something like that.
The reason is that we consider opening a repository to external
participants, but some commits contain stuff that we'd really rather
not show to anyone else. Making the repository public without loosing
history would then force us to either
1. Recreate every commit in a new repo, sans the offending commits.
Seems like hard work.
2. ?
Would it be feasible to write a tool that can selectively replace a
specific commit in the commit DAG, or would that automatically
invalidate every SHA key for every commit that follows the replaced
original?
BR / Klas
On Fri, Sep 19, 2008 at 11:16 AM, Michael J Gruber
<git@drmicha.warpmail.net> wrote:
> Steven Grimm venit, vidit, dixit 19.09.2008 01:41:
>> I maintain a shared repository a bunch of my coworkers push to for
>> code reviews. It has accumulated a lot of packfiles, so I want to
>> shrink it down a bit, but there's a problem:
>>
>> % git repack -A -d
>> Counting objects: ...
>> error: Could not read 125bf191b65189aaec7a6aa24ff26460d141d587
>> fatal: bad tree object 125bf191b65189aaec7a6aa24ff26460d141d587
>>
>> "git fsck" confirms that the tree object is missing:
>>
>> % git fsck
>> broken link from commit 1b2f0595bb4a6c2e17ca43a9cc41feec88c72a47
>> to tree 125bf191b65189aaec7a6aa24ff26460d141d587
>> ...
>> missing tree 125bf191b65189aaec7a6aa24ff26460d141d587
>>
>> This is a dangling commit, but that's fine; for this particular
>> repository we actually *want* lots of dangling commits since they
>> represent the history of people's code review requests. (Hence me
>> running git-repack with -A instead of -a.)
>>
>> Given that it's dangling, it seems like it'd be safe to just remove
>> entirely (we lose that little bit of code-review history but we've
>> lost it already anyway with the tree object missing). But I'm not sure
>> how to do it. Is it possible to delete a commit object, and if so, how?
>>
>> I don't know how the corruption happened in the first place. There was
>> a short time at one point where the permissions on the object
>> directories were inconsistent, so it's possible someone pushed during
>> that period and managed to create the commit object file in .git/
>> objects but didn't have permission to create the tree object. That's
>> just speculation on my part, though. This is the only corrupt object
>> in the repository according to git-fsck, so at this point I just want
>> to know how to get rid of it so I can do the repack.
>
> git prune should delete dangling commits. Is that commit already in a
> pack? Then the -f option to repack may help.
>
> Michael
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2008-10-02 13:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-18 23:41 How to remove a commit object? Steven Grimm
2008-09-19 9:16 ` Michael J Gruber
2008-10-02 13:36 ` Klas Lindberg [this message]
2008-10-02 14:00 ` Michael J Gruber
2008-10-02 14:02 ` Jakub Narebski
2008-10-02 14:26 ` Klas Lindberg
2008-10-02 14:30 ` Michael J Gruber
2008-10-02 14:52 ` Klas Lindberg
2008-10-02 15:02 ` Johannes Sixt
2008-10-03 11:42 ` Klas Lindberg
2008-10-03 12:03 ` Johannes Sixt
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=33f4f4d70810020636g77f4180cm7aa6b7de07ae5beb@mail.gmail.com \
--to=klas.lindberg@gmail.com \
--cc=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=koreth@midwinter.com \
/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).