Re: commiting while the current version is in conflict
> Judging from the code in the pre-commit script, git does not
> keep conflict information in its metadata cache, but tries to guess
> conflicts from the file's contents/ This seems to be a strange
> thing to do, imo. What's the reason for this?
Because
(0) You are wrong to assume that git does not keep conflict
information; we can tell if the index is "unmerged" to see
if you still have unresolved conflicts; (1) When the index is unmerged, git-commit will stop even
before getting to pre-commit hook, so there is no point
for pre-commit hook to check if the index is unmerged; (2) pre-commit hook is a last ditch effort to help ignorant
users who have already done "git add" without thinking and
lost the "unmerged" state. It has to look at and guess at
the contents for that.