* corrupted Git repository
@ 2011-06-21 6:58 Kasra Khosoussi
2011-06-21 8:19 ` Michael J Gruber
0 siblings, 1 reply; 11+ messages in thread
From: Kasra Khosoussi @ 2011-06-21 6:58 UTC (permalink / raw)
To: git
Hi all,
My thesis repository is corrupted and I don't have any recent backup
(my files are OK, but the history is lost). I've seen the recovery
examples in the manual, but I believe my case is somehow different.
The repository is linear.
1- At the beginning, git status/log/fsck -full said:
> fatal: object 0a83757505387aacc2fd36b3c996729e6bf9d6e5 is corrupted
and there was an empty file in .git/objects/01/8375... .
2- If I move the corrupted object, git fsck --ful would return this:
> error: HEAD: invalid sha1 pointer 0a83757505387aacc2fd36b3c996729e6bf9d6e5
> error: refs/heads/master does not point to a valid object!
> dangling tree 06f388dc60cfb014b5e1f70ecdaa568efe6bd0fa
> dangling tree d86f8c75e836e13b6e0336361641223f48fde722
3- I guess I have to edit refs/heads/master and replace the corrupted
sha1 with another hash, but I'm not sure how I can find the proper
commit (e.g.,maybe by using find -mtime?).
Thanks in advance,
-Kasra
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: corrupted Git repository
2011-06-21 6:58 corrupted Git repository Kasra Khosoussi
@ 2011-06-21 8:19 ` Michael J Gruber
2011-06-21 9:30 ` Kasra Khosoussi
0 siblings, 1 reply; 11+ messages in thread
From: Michael J Gruber @ 2011-06-21 8:19 UTC (permalink / raw)
To: Kasra Khosoussi; +Cc: git
Kasra Khosoussi venit, vidit, dixit 21.06.2011 08:58:
> Hi all,
>
> My thesis repository is corrupted and I don't have any recent backup
> (my files are OK, but the history is lost). I've seen the recovery
Backup now!
I guess you've done that meanwhile anyways, but it's important before
any recovery attempts.
Is your reflog OK, i.e. do you get proper output from "git reflog" or
"git log -g"?
> examples in the manual, but I believe my case is somehow different.
> The repository is linear.
>
> 1- At the beginning, git status/log/fsck -full said:
>
>> fatal: object 0a83757505387aacc2fd36b3c996729e6bf9d6e5 is corrupted
Hopefully and probably only the most recent commit (the one above) is
lost, not all of our history.
>
> and there was an empty file in .git/objects/01/8375... .
.git/objects/0a83... probably
>
> 2- If I move the corrupted object, git fsck --ful would return this:
>
>> error: HEAD: invalid sha1 pointer 0a83757505387aacc2fd36b3c996729e6bf9d6e5
>> error: refs/heads/master does not point to a valid object!
>> dangling tree 06f388dc60cfb014b5e1f70ecdaa568efe6bd0fa
>> dangling tree d86f8c75e836e13b6e0336361641223f48fde722
>
> 3- I guess I have to edit refs/heads/master and replace the corrupted
> sha1 with another hash, but I'm not sure how I can find the proper
> commit (e.g.,maybe by using find -mtime?).
>
> Thanks in advance,
>
> -Kasra
The reflog will give you the previous value of HEAD. You can set
refs/heads/master to that (git update-ref) and then rebuild the lost
commit on top of that (assuming only one commit is lost). The dangling
trees are not necessarily due to the corrupt commit object. Have you
changed any files since the corrupt commit? Do you remember which files
you changed in that commit?
Michael
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: corrupted Git repository
2011-06-21 8:19 ` Michael J Gruber
@ 2011-06-21 9:30 ` Kasra Khosoussi
2011-06-21 9:38 ` Michael J Gruber
0 siblings, 1 reply; 11+ messages in thread
From: Kasra Khosoussi @ 2011-06-21 9:30 UTC (permalink / raw)
To: Michael J Gruber; +Cc: git
> Backup now!
> I guess you've done that meanwhile anyways, but it's important before
> any recovery attempts.
Yes, I've done that.
> Is your reflog OK, i.e. do you get proper output from "git reflog" or
> "git log -g"?
No. Before moving the corrupted object git reflog would return:
fatal: object 0a83757505387aacc2fd36b3c996729e6bf9d6e5 is corrupted
and after moving the file it would say:
fatal: bad object HEAD
> .git/objects/0a83... probably
Yes, it was a typo.
> The reflog will give you the previous value of HEAD. You can set
> refs/heads/master to that (git update-ref) and then rebuild the lost
> commit on top of that (assuming only one commit is lost). The dangling
> trees are not necessarily due to the corrupt commit object. Have you
> changed any files since the corrupt commit?
Yes, I've changed two files after the last commit (I knew about the
corruption when I was just about to commit the changes).
> Do you remember which files
> you changed in that commit?
>
> Michael
If the the corrupt commit is the last one, yes.
Thanks.
-- Kasra
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: corrupted Git repository
2011-06-21 9:30 ` Kasra Khosoussi
@ 2011-06-21 9:38 ` Michael J Gruber
2011-06-21 10:10 ` Kasra Khosoussi
0 siblings, 1 reply; 11+ messages in thread
From: Michael J Gruber @ 2011-06-21 9:38 UTC (permalink / raw)
To: Kasra Khosoussi; +Cc: git
Kasra Khosoussi venit, vidit, dixit 21.06.2011 11:30:
>> Backup now!
>> I guess you've done that meanwhile anyways, but it's important before
>> any recovery attempts.
>
> Yes, I've done that.
>
>> Is your reflog OK, i.e. do you get proper output from "git reflog" or
>> "git log -g"?
>
> No. Before moving the corrupted object git reflog would return:
> fatal: object 0a83757505387aacc2fd36b3c996729e6bf9d6e5 is corrupted
>
> and after moving the file it would say:
> fatal: bad object HEAD
Oh yes, stupid me, sorry. "git reflog" tries to parse HEAD. But you can
look at the file directly:
tail .git/logs/HEAD
tail .git/logs/refs/heads/master
etc. show you what's been going on with those refs lately.
You should be able to pick the the sha1 before the corrupt one from that
and do things like "git log that_sha1" if only the most recent commit is
corrupt.
Michael
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: corrupted Git repository
2011-06-21 9:38 ` Michael J Gruber
@ 2011-06-21 10:10 ` Kasra Khosoussi
2011-06-21 10:39 ` Ilari Liusvaara
2011-06-21 13:47 ` Johannes Sixt
0 siblings, 2 replies; 11+ messages in thread
From: Kasra Khosoussi @ 2011-06-21 10:10 UTC (permalink / raw)
To: Michael J Gruber; +Cc: git
Thanks for your help.
I used update-ref and changed refs/heads/master to the sha1 of
previous commit. Then I commit the changes. Everything seems fine now
except (as you previously mentioned), git fsck -full complains about
dangling trees. Is it critical?
-Kasra
On Tue, Jun 21, 2011 at 2:08 PM, Michael J Gruber
<git@drmicha.warpmail.net> wrote:
> Kasra Khosoussi venit, vidit, dixit 21.06.2011 11:30:
>>> Backup now!
>>> I guess you've done that meanwhile anyways, but it's important before
>>> any recovery attempts.
>>
>> Yes, I've done that.
>>
>>> Is your reflog OK, i.e. do you get proper output from "git reflog" or
>>> "git log -g"?
>>
>> No. Before moving the corrupted object git reflog would return:
>> fatal: object 0a83757505387aacc2fd36b3c996729e6bf9d6e5 is corrupted
>>
>> and after moving the file it would say:
>> fatal: bad object HEAD
>
> Oh yes, stupid me, sorry. "git reflog" tries to parse HEAD. But you can
> look at the file directly:
>
> tail .git/logs/HEAD
> tail .git/logs/refs/heads/master
>
> etc. show you what's been going on with those refs lately.
>
> You should be able to pick the the sha1 before the corrupt one from that
> and do things like "git log that_sha1" if only the most recent commit is
> corrupt.
>
> Michael
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: corrupted Git repository
2011-06-21 10:10 ` Kasra Khosoussi
@ 2011-06-21 10:39 ` Ilari Liusvaara
2011-06-21 10:40 ` Kasra Khosoussi
2011-06-21 13:47 ` Johannes Sixt
1 sibling, 1 reply; 11+ messages in thread
From: Ilari Liusvaara @ 2011-06-21 10:39 UTC (permalink / raw)
To: Kasra Khosoussi; +Cc: Michael J Gruber, git
On Tue, Jun 21, 2011 at 02:40:47PM +0430, Kasra Khosoussi wrote:
> Thanks for your help.
>
> I used update-ref and changed refs/heads/master to the sha1 of
> previous commit. Then I commit the changes. Everything seems fine now
> except (as you previously mentioned), git fsck -full complains about
> dangling trees. Is it critical?
Dangling trees are normal. They are not errors.
-Ilari
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: corrupted Git repository
2011-06-21 10:39 ` Ilari Liusvaara
@ 2011-06-21 10:40 ` Kasra Khosoussi
0 siblings, 0 replies; 11+ messages in thread
From: Kasra Khosoussi @ 2011-06-21 10:40 UTC (permalink / raw)
To: Ilari Liusvaara; +Cc: Michael J Gruber, git
Thanks for your help.
On Tue, Jun 21, 2011 at 3:09 PM, Ilari Liusvaara
<ilari.liusvaara@elisanet.fi> wrote:
> On Tue, Jun 21, 2011 at 02:40:47PM +0430, Kasra Khosoussi wrote:
>> Thanks for your help.
>>
>> I used update-ref and changed refs/heads/master to the sha1 of
>> previous commit. Then I commit the changes. Everything seems fine now
>> except (as you previously mentioned), git fsck -full complains about
>> dangling trees. Is it critical?
>
> Dangling trees are normal. They are not errors.
>
> -Ilari
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: corrupted Git repository
2011-06-21 10:10 ` Kasra Khosoussi
2011-06-21 10:39 ` Ilari Liusvaara
@ 2011-06-21 13:47 ` Johannes Sixt
2011-06-21 14:26 ` Kasra Khosoussi
1 sibling, 1 reply; 11+ messages in thread
From: Johannes Sixt @ 2011-06-21 13:47 UTC (permalink / raw)
To: Kasra Khosoussi; +Cc: Michael J Gruber, git
Am 6/21/2011 12:10, schrieb Kasra Khosoussi:
> Everything seems fine now
But it would still be good to know how the corruption could have happened.
Do you have any clues?
Disk full?
Ctrl-C in the middle of a git operation?
Some cron script interference (unlikely)?
Permission problems (unlikely)?
Networking problems (only if the repository is on a network mount)?
Something else?
-- Hannes
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: corrupted Git repository
2011-06-21 13:47 ` Johannes Sixt
@ 2011-06-21 14:26 ` Kasra Khosoussi
2011-06-21 14:32 ` Carlos Martín Nieto
0 siblings, 1 reply; 11+ messages in thread
From: Kasra Khosoussi @ 2011-06-21 14:26 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Michael J Gruber, git
Good question! Actually I have no idea!
It was fine yesterday. I had to leave home so I just shutdown my
netbook (I just issued the command and closed the lid). Files were
open in my editor but I'm sure that there were no Git processes
running at the time. The battery was empty this morning, so my best
guess is that the halt operation was somehow failed, but I think it
can not explain the corruption.
Any idea?
-Kasra
On Tue, Jun 21, 2011 at 6:17 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:
> Am 6/21/2011 12:10, schrieb Kasra Khosoussi:
>> Everything seems fine now
>
> But it would still be good to know how the corruption could have happened.
> Do you have any clues?
>
> Disk full?
> Ctrl-C in the middle of a git operation?
> Some cron script interference (unlikely)?
> Permission problems (unlikely)?
> Networking problems (only if the repository is on a network mount)?
> Something else?
>
> -- Hannes
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: corrupted Git repository
2011-06-21 14:26 ` Kasra Khosoussi
@ 2011-06-21 14:32 ` Carlos Martín Nieto
2011-06-21 14:59 ` Kasra Khosoussi
0 siblings, 1 reply; 11+ messages in thread
From: Carlos Martín Nieto @ 2011-06-21 14:32 UTC (permalink / raw)
To: Kasra Khosoussi; +Cc: Johannes Sixt, Michael J Gruber, git
[-- Attachment #1: Type: text/plain, Size: 717 bytes --]
On Tue, Jun 21, 2011 at 06:56:55PM +0430, Kasra Khosoussi wrote:
> Good question! Actually I have no idea!
>
> It was fine yesterday. I had to leave home so I just shutdown my
> netbook (I just issued the command and closed the lid). Files were
> open in my editor but I'm sure that there were no Git processes
> running at the time. The battery was empty this morning, so my best
> guess is that the halt operation was somehow failed, but I think it
> can not explain the corruption.
>
> Any idea?
Does your computer actually shutdown or suspend? It could be that the
files still hadn't been flushed to disc when the battery ran out, but
that is unlikely if it did keep running.
Cheers,
cmn
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: corrupted Git repository
2011-06-21 14:32 ` Carlos Martín Nieto
@ 2011-06-21 14:59 ` Kasra Khosoussi
0 siblings, 0 replies; 11+ messages in thread
From: Kasra Khosoussi @ 2011-06-21 14:59 UTC (permalink / raw)
To: Carlos Martín Nieto; +Cc: Johannes Sixt, Michael J Gruber, git
The battery was not empty when I issued the shutdown command, so there
should have been plenty of time before it ran out.
-Kasra
On Tue, Jun 21, 2011 at 7:02 PM, Carlos Martín Nieto <cmn@elego.de> wrote:
> On Tue, Jun 21, 2011 at 06:56:55PM +0430, Kasra Khosoussi wrote:
>> Good question! Actually I have no idea!
>>
>> It was fine yesterday. I had to leave home so I just shutdown my
>> netbook (I just issued the command and closed the lid). Files were
>> open in my editor but I'm sure that there were no Git processes
>> running at the time. The battery was empty this morning, so my best
>> guess is that the halt operation was somehow failed, but I think it
>> can not explain the corruption.
>>
>> Any idea?
>
> Does your computer actually shutdown or suspend? It could be that the
> files still hadn't been flushed to disc when the battery ran out, but
> that is unlikely if it did keep running.
>
> Cheers,
> cmn
>
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2011-06-21 14:59 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-21 6:58 corrupted Git repository Kasra Khosoussi
2011-06-21 8:19 ` Michael J Gruber
2011-06-21 9:30 ` Kasra Khosoussi
2011-06-21 9:38 ` Michael J Gruber
2011-06-21 10:10 ` Kasra Khosoussi
2011-06-21 10:39 ` Ilari Liusvaara
2011-06-21 10:40 ` Kasra Khosoussi
2011-06-21 13:47 ` Johannes Sixt
2011-06-21 14:26 ` Kasra Khosoussi
2011-06-21 14:32 ` Carlos Martín Nieto
2011-06-21 14:59 ` Kasra Khosoussi
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).