git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Corrupted git repository?
@ 2011-02-15 14:57 Piotr Krukowiecki
  2011-02-15 20:00 ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Piotr Krukowiecki @ 2011-02-15 14:57 UTC (permalink / raw)
  To: git

Hi,

it looks like my git repository got corrupted today.

git status shows no changes,
git cherry-pick says "error: Your local changes to the following files
would be overwritten by merge:",
git fsck starts checking objects but hangs on one "Checking tree"

Other commands (gc, checkout, reset) seem to work correctly.

I've tried hard resetting to HEAD, didn't help.

What can I do? Cloning is very expensive operation here.

-- 
Piotrek

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Corrupted git repository?
  2011-02-15 14:57 Corrupted git repository? Piotr Krukowiecki
@ 2011-02-15 20:00 ` Junio C Hamano
  2011-02-16 16:44   ` Piotr Krukowiecki
  0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2011-02-15 20:00 UTC (permalink / raw)
  To: Piotr Krukowiecki; +Cc: git

Piotr Krukowiecki <piotr.krukowiecki.news@gmail.com> writes:

> it looks like my git repository got corrupted today.
>
> git status shows no changes,
> git cherry-pick says "error: Your local changes to the following files
> would be overwritten by merge:",

with some paths, or without naming any path?

> git fsck starts checking objects but hangs on one "Checking tree"

I take it that you are talking about "git fsck -v".  Is it really "hangs",
or just "takes a long time"?  You mentioned that a clone is expensive so I
am guessing that your repository has some huge trees or objects in
general.

The details you gave in your message are a bit sketchy to give you an
exact diagnosis, but if "cherry-pick" stops with the above message and
tells you the names of files that are not tracked in your current branch,
I don't see there is anything unusual going on.  You have these files with
random contents that git does not know about, and git is refusing to
lose their contents by overwriting them during the cherry-pick.

After making sure that they are indeed untracked paths, if you think you
can remove them (or move them away), first do so and retry cherry-pick,
and then everything should be Ok.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Corrupted git repository?
  2011-02-15 20:00 ` Junio C Hamano
@ 2011-02-16 16:44   ` Piotr Krukowiecki
  2011-02-16 18:54     ` Johannes Sixt
  0 siblings, 1 reply; 5+ messages in thread
From: Piotr Krukowiecki @ 2011-02-16 16:44 UTC (permalink / raw)
  To: Junio C Hamano, git

On Tue, Feb 15, 2011 at 9:00 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Piotr Krukowiecki <piotr.krukowiecki.news@gmail.com> writes:
>
>> it looks like my git repository got corrupted today.
>>
>> git status shows no changes,
>> git cherry-pick says "error: Your local changes to the following files
>> would be overwritten by merge:",
>
> with some paths, or without naming any path?

With one path:

$ git status
# On branch master
nothing to commit (working directory clean)

$ git cherry-pick 7d193bb0c1f14908361d9d9d5e30f0c12d5f2c2f
error: Your local changes to the following files would be overwritten by merge:
	<<PATH>>
Please, commit your changes or stash them before you can merge.
Aborting

$ git status
# On branch master
nothing to commit (working directory clean)

7d193bb comes from trunk, master was reset to a branch,
the <<PATH>> is a file that was not changed in the commit,
git clean -n -- <<PATH>> does not show anything

They should not have "assume unchanged" bit because I did
git update-index --no-assume-unchanged --verbose -- <<PATH>>


>> git fsck starts checking objects but hangs on one "Checking tree"
>
> I take it that you are talking about "git fsck -v".  Is it really "hangs",
> or just "takes a long time"?

I was too hasty - fsck finished fine. It just took long time for one object
(a couple of minutes while other checked objects took less than second).

It only printed several dangling objects:

$ git fsck
dangling tree 0ff163a56128d95c5b88c520f68792f6f900bb18
dangling commit deb988eeb2404dd1e57c8894c3cfd93dd316aca3
dangling tree 50323779bd6c0d4eb19664a3945c6c31fe9dadd4
dangling commit 9ed87852fdf6775a3c071faec05388eda5cd5de1
dangling commit a4d09c76a1b58bbf51f2b701407493c5ed9f9b78


> You mentioned that a clone is expensive so I
> am guessing that your repository has some huge trees or objects in
> general.

That's one reason, the other is that I'm using git-svn ...


> The details you gave in your message are a bit sketchy to give you an
> exact diagnosis, but if "cherry-pick" stops with the above message and
> tells you the names of files that are not tracked in your current branch,

"git log -- <<PATH>>" shows two commits for this file on this branch and
on trunk, and "git status" does not list the file as untracked.


> I don't see there is anything unusual going on.  You have these files with
> random contents that git does not know about, and git is refusing to
> lose their contents by overwriting them during the cherry-pick.
>
> After making sure that they are indeed untracked paths, if you think you
> can remove them (or move them away), first do so and retry cherry-pick,
> and then everything should be Ok.

I believe the file is tracked and is not modified?

I have deleted the whole top-level directory in which the file was and run:

$ git status | grep  <<PATH>>
#	deleted:    <<PATH>>

$ git checkout -- <<top dir>>

$ git status
# On branch master
nothing to commit (working directory clean)

$ git cherry-pick 7d193bb0c1f14908361d9d9d5e30f0c12d5f2c2f
error: Your local changes to the following files would be overwritten by merge:
	<<PATH>>
Please, commit your changes or stash them before you can merge.
Aborting


-- 
Piotrek

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Corrupted git repository?
  2011-02-16 16:44   ` Piotr Krukowiecki
@ 2011-02-16 18:54     ` Johannes Sixt
  2011-02-16 19:21       ` Piotr Krukowiecki
  0 siblings, 1 reply; 5+ messages in thread
From: Johannes Sixt @ 2011-02-16 18:54 UTC (permalink / raw)
  To: Piotr Krukowiecki; +Cc: Junio C Hamano, git

On Mittwoch, 16. Februar 2011, Piotr Krukowiecki wrote:
> I have deleted the whole top-level directory in which the file was and run:
>
> $ git status | grep  <<PATH>>
> #	deleted:    <<PATH>>
>
> $ git checkout -- <<top dir>>
>
> $ git status
> # On branch master
> nothing to commit (working directory clean)
>
> $ git cherry-pick 7d193bb0c1f14908361d9d9d5e30f0c12d5f2c2f
> error: Your local changes to the following files would be overwritten by
> merge: <<PATH>>
> Please, commit your changes or stash them before you can merge.
> Aborting

A wild guess: You are on Windows or OS/X, and the file exists in your worktree 
with different uppercase/lowercase name? Rename the file so that its case is 
the same as it is recorded in the repository.

-- Hannes

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Corrupted git repository?
  2011-02-16 18:54     ` Johannes Sixt
@ 2011-02-16 19:21       ` Piotr Krukowiecki
  0 siblings, 0 replies; 5+ messages in thread
From: Piotr Krukowiecki @ 2011-02-16 19:21 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Junio C Hamano, git

On Wed, Feb 16, 2011 at 7:54 PM, Johannes Sixt <j6t@kdbg.org> wrote:
> On Mittwoch, 16. Februar 2011, Piotr Krukowiecki wrote:
>> I have deleted the whole top-level directory in which the file was and run:
>>
>> $ git status | grep  <<PATH>>
>> #     deleted:    <<PATH>>
>>
>> $ git checkout -- <<top dir>>
>>
>> $ git status
>> # On branch master
>> nothing to commit (working directory clean)
>>
>> $ git cherry-pick 7d193bb0c1f14908361d9d9d5e30f0c12d5f2c2f
>> error: Your local changes to the following files would be overwritten by
>> merge: <<PATH>>
>> Please, commit your changes or stash them before you can merge.
>> Aborting
>
> A wild guess: You are on Windows or OS/X, and the file exists in your worktree
> with different uppercase/lowercase name? Rename the file so that its case is
> the same as it is recorded in the repository.

Nope, I'm on linux with case-sensitive file system.

Some commits to svn repository are coming from windows. But the cherry-picked
one was my commit from linux. It was first done in git, then dcomitted
to svn and
then I tried to merge it to git branch - that failed.


-- 
Piotrek

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-02-16 19:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-15 14:57 Corrupted git repository? Piotr Krukowiecki
2011-02-15 20:00 ` Junio C Hamano
2011-02-16 16:44   ` Piotr Krukowiecki
2011-02-16 18:54     ` Johannes Sixt
2011-02-16 19:21       ` Piotr Krukowiecki

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).