Skip to contentSkip to conversation

index file screwed up

DISCUSSION Chuck Lever 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

i was working with a version of git that had a bug in add_cache_entry() that introduced a sorting error in my index.

[cel@dexter main]$ stg refresh -f
Refreshing patch "git-switch-branch"...AUTHORS: unmerged (098c1d3e9fe5c39b859ccff6c7d36d2c193d1b62)
AUTHORS: unmerged (098c1d3e9fe5c39b859ccff6c7d36d2c193d1b62)
COPYING: unmerged (d60c31a97a544b53039088d14fe9114583c0efc3)
COPYING: unmerged (d60c31a97a544b53039088d14fe9114583c0efc3)
INSTALL: unmerged (8d2bebd9d1824f1b7af5cfe6fbd11f9cbfde6d74)
INSTALL: unmerged (8d2bebd9d1824f1b7af5cfe6fbd11f9cbfde6d74)
MANIFEST.in: unmerged (581d0be2a5fb3569b06681b7d559f1279aa4104b)
MANIFEST.in: unmerged (581d0be2a5fb3569b06681b7d559f1279aa4104b)
README: unmerged (184ded8e08cb92a14b79c79f9919469ba352ab70)
README: unmerged (184ded8e08cb92a14b79c79f9919469ba352ab70)
...
fatal: git-write-tree: verify_merged: not able to write tree
stg refresh: git-write-tree failed

[cel@dexter main]$

how do i recover?

begin:vcard
fn:Chuck Lever
n:Lever;Charles
org:Network Appliance, Incorporated;Linux NFS Client Development
adr:535 West William Street, Suite 3100;;Center for Information Technology Integration;Ann Arbor;MI;48103-4943;USA email;internet:[email protected]
title:Member of Technical Staff
tel;work:+1 734 763 4415
tel;fax:+1 734 763 4434
tel;home:+1 734 668 1089
x-mozilla-html:FALSE
url:http://www.monkey.org/~cel/
version:2.1
end:vcard

#1 lore raw
Quoted 20 lines · Chuck Lever

i was working with a version of git that had a bug in add_cache_entry() that introduced a sorting error in my index.

[cel@dexter main]$ stg refresh -f
Refreshing patch "git-switch-branch"...AUTHORS: unmerged (098c1d3e9fe5c39b859ccff6c7d36d2c193d1b62)
AUTHORS: unmerged (098c1d3e9fe5c39b859ccff6c7d36d2c193d1b62)
COPYING: unmerged (d60c31a97a544b53039088d14fe9114583c0efc3)
COPYING: unmerged (d60c31a97a544b53039088d14fe9114583c0efc3)
INSTALL: unmerged (8d2bebd9d1824f1b7af5cfe6fbd11f9cbfde6d74)
INSTALL: unmerged (8d2bebd9d1824f1b7af5cfe6fbd11f9cbfde6d74) MANIFEST.in: unmerged (581d0be2a5fb3569b06681b7d559f1279aa4104b) MANIFEST.in: unmerged (581d0be2a5fb3569b06681b7d559f1279aa4104b)
README: unmerged (184ded8e08cb92a14b79c79f9919469ba352ab70)
README: unmerged (184ded8e08cb92a14b79c79f9919469ba352ab70)
...
fatal: git-write-tree: verify_merged: not able to write tree stg refresh: git-write-tree failed

Quoted 3 lines

[cel@dexter main]$

how do i recover?

You don't. Your index is toast.

Let's hope you didn't write any unsorted trees with _earlier_ (non-merge) commits.

Do this:

- build a new and trustworthy git somewhere else (from a tar-file if nothing else). Install it.

- get rid of the index and any half-way data in your working tree (you might want to save any diffs with "git diff HEAD" first, but I suspect you don't really care, since the changes came from some stg stuff, so you can always re-create them, no?)

	git reset --hard HEAD

- run fsck, to verify that all your trees are sorted (if they aren't, you be screwed, but "git-convert-objects" should be able to fix it for you - possibly with some additional logic).

	git-fsck-objects --full

- restart and try again.

That _should_ get you running again.

Linus

#2 lore raw
Quoted 20 lines · Linus Torvalds
Quoted 17 lines · Chuck Lever

i was working with a version of git that had a bug in add_cache_entry() that introduced a sorting error in my index.

[cel@dexter main]$ stg refresh -f
Refreshing patch "git-switch-branch"...AUTHORS: unmerged (098c1d3e9fe5c39b859ccff6c7d36d2c193d1b62)
AUTHORS: unmerged (098c1d3e9fe5c39b859ccff6c7d36d2c193d1b62)
COPYING: unmerged (d60c31a97a544b53039088d14fe9114583c0efc3)
COPYING: unmerged (d60c31a97a544b53039088d14fe9114583c0efc3)
INSTALL: unmerged (8d2bebd9d1824f1b7af5cfe6fbd11f9cbfde6d74)
INSTALL: unmerged (8d2bebd9d1824f1b7af5cfe6fbd11f9cbfde6d74)
MANIFEST.in: unmerged (581d0be2a5fb3569b06681b7d559f1279aa4104b)
MANIFEST.in: unmerged (581d0be2a5fb3569b06681b7d559f1279aa4104b)
README: unmerged (184ded8e08cb92a14b79c79f9919469ba352ab70)
README: unmerged (184ded8e08cb92a14b79c79f9919469ba352ab70)
...
fatal: git-write-tree: verify_merged: not able to write tree
stg refresh: git-write-tree failed

Quoted 8 lines
Quoted 3 lines

[cel@dexter main]$

how do i recover?

You don't. Your index is toast.

Let's hope you didn't write any unsorted trees with _earlier_ (non-merge) commits.

well, i did get this working, but i "cheated."

first i switched back to a known good version of git. then, before i received your advice, i replaced the damaged index file with a file system snapshot backup from a couple of hours earlier. after a couple of "stg refresh" commands, things seem back to normal.

it could be useful to have a few backup versions of the index file (like index.1, index.2, etc) and have write-tree rotate them before writing out a new index.

btw, the git version was my own, using a trie/list cache. it mostly works, except for this little sorting bug.

Quoted 20 lines

Do this:

- build a new and trustworthy git somewhere else (from a tar-file if nothing else). Install it.

- get rid of the index and any half-way data in your working tree (you might want to save any diffs with "git diff HEAD" first, but I suspect you don't really care, since the changes came from some stg stuff, so you can always re-create them, no?)

	git reset --hard HEAD

- run fsck, to verify that all your trees are sorted (if they aren't, you be screwed, but "git-convert-objects" should be able to fix it for you - possibly with some additional logic).

	git-fsck-objects --full

- restart and try again.

Quoted 7 lines

That _should_ get you running again.

Linus
-
To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

begin:vcard
fn:Chuck Lever
n:Lever;Charles
org:Network Appliance, Incorporated;Linux NFS Client Development
adr:535 West William Street, Suite 3100;;Center for Information Technology Integration;Ann Arbor;MI;48103-4943;USA email;internet:[email protected]
title:Member of Technical Staff
tel;work:+1 734 763 4415
tel;fax:+1 734 763 4434
tel;home:+1 734 668 1089
x-mozilla-html:FALSE
url:http://www.monkey.org/~cel/
version:2.1
end:vcard