How to remove a commit object?

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Git Users List <git@...>
Date: Thursday, September 18, 2008 - 7:41 pm

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.

Thanks!

-Steve
--
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
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
How to remove a commit object?, Steven Grimm, (Thu Sep 18, 7:41 pm)
Re: How to remove a commit object?, Michael J Gruber, (Fri Sep 19, 5:16 am)
Re: How to remove a commit object?, Klas Lindberg, (Thu Oct 2, 9:36 am)
Re: How to remove a commit object?, Jakub Narebski, (Thu Oct 2, 10:02 am)
Re: How to remove a commit object?, Klas Lindberg, (Thu Oct 2, 10:26 am)
Re: How to remove a commit object?, Johannes Sixt, (Thu Oct 2, 11:02 am)
Re: How to remove a commit object?, Klas Lindberg, (Fri Oct 3, 7:42 am)
Re: How to remove a commit object?, Johannes Sixt, (Fri Oct 3, 8:03 am)
Re: How to remove a commit object?, Michael J Gruber, (Thu Oct 2, 10:30 am)
Re: How to remove a commit object?, Klas Lindberg, (Thu Oct 2, 10:52 am)
Re: How to remove a commit object?, Michael J Gruber, (Thu Oct 2, 10:00 am)