git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: index file screwed up

From
Linus Torvalds <torvalds@osdl.org>
Date
Sep 28, 2005, 15:37 UTC
Message-ID
<Pine.LNX.4.58.0509280831130.3308@g5.osdl.org>
In-Reply-To
<433AB170.90608@citi.umich.edu>
On Wed, 28 Sep 2005, Chuck Lever wrote:
Show 23 quoted lines
>
> 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?
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
Previous: Chuck LeverNext: Chuck Lever
Message 2 of 3 in “index file screwed up”
  1. Chuck LeverSep 28, 2005
  2. Linus TorvaldsSep 28, 2005
  3. Chuck LeverSep 28, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.