Your example is actually not as trivial as you may think, because your changes are all on consecutive lines. The main problem is that the diff introduced by third commit
actually depends on changes done in second commit
. Git stores the full tree of each commit, but still needs to be able to express a commit as a diff in terms of the previous commit (don't know if that makes sense to you).
If you try the same operations but by doing 3 commits modifying different parts of the same file, the revert of the second commit will not fail. Since the default context diff is 3, it should not fail if your edits are further than 3 lines apart from each other.