We need the first if statement because current code will call update() where it should call keep() when merge and head are equal by mode and content but merge and index differ. The comment shows the misunderstanding: we will not always try to update index to merge when they differ.

We need the second if statement because current code will call conflict() where it should call keep() when merge and index are equal by mode and content but merge and head differ by mode and the file is dirty. Again the comment shows the misunderstanding: It's not always a conflict if workingtree, head and merge have different content.

Sorry, I know, all that sounds far too complicated, but what git does during checkout is really complicated. Look at cases 15 and 19 in the "carry forward rules" in http://linux.die.net/man/1/git-read-tree to see the explanation for this two cases.

I'll propose some testcases which cover this.