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

Re: git blame crashes with internal error

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Oct 15, 2007, 15:39 UTC
Message-ID
<alpine.LFD.0.999.0710150831410.6887@woody.linux-foundation.org>
In-Reply-To
<20071014143628.GA22568@atjola.homenet>
On Sun, 14 Oct 2007, Bj?rn Steinbrink wrote:
> 
> git blame just decided to crash on me, when I tried to use it while
> resolving a merge conflict.

Yes. What's going on is that "ce_mode = 0" is a magic marker for an unmerged entry (set up by things like diff-lib.c:do_diff_cache() and builtin-read-tree.c:read_tree_unmerged()) and the ce_match_stat_basic() function gets upset about this.

I'm not entirely sure that the whole "ce_mode = 0" case is a good idea to begin with, and maybe the right thing to do is to remove that horrid freakish special case, but removing the internal error seems to be the simplest fix for now.

		Linus
---
 read-cache.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/read-cache.c b/read-cache.c
index 56202d1..3b11aa7 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -149,6 +149,8 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st)
 		else if (ce_compare_gitlink(ce))
 			changed |= DATA_CHANGED;
 		return changed;
+	case 0:		/* Special case: unmerged file in index */
+		return MODE_CHANGED | DATA_CHANGED | TYPE_CHANGED;
 	default:
 		die("internal error: ce_mode is %o", ntohl(ce->ce_mode));
 	}
Previous: Johannes Schindelin
Message 12 of 12 in “git blame crashes with internal error”
  1. Björn SteinbrinkOct 14, 2007
  2. Andreas EricssonOct 14, 2007
  3. David KastrupOct 14, 2007
  4. Pierre HabouzitOct 14, 2007
  5. Björn SteinbrinkOct 14, 2007
  6. Johannes SchindelinOct 14, 2007
  7. Björn SteinbrinkOct 14, 2007
  8. Johannes SchindelinOct 14, 2007
  9. Alex RiesenOct 14, 2007
  10. Alex RiesenOct 14, 2007
  11. Johannes SchindelinOct 14, 2007
  12. Linus TorvaldsOct 15, 2007

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.