Thread (10 messages) flat view 10 messages, 5 authors, 2016-06-15

Re: git blame crashes with internal error

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2016-06-15 22:43:41
Subsystem: the rest · Maintainer: Linus Torvalds


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));
 	}
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help