bitcoin/bitcoin — pull request #2658 by TheBlueMatt (2013-05-16 21:29:44+00:00)
Title: Detect any sufficiently long fork and alert the user just like any other alert

Tested with BitcoindComparisonTool (which generates a large fork) and -alertnotify script successfully notified me and I get the relevant warnings in getinfo

You'll get the usually cryptic error:
"errors" : "Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade."
and alertnotify will be called with
Warning: Large-work fork detected. You may need to upgrade, or other nodes may need to upgrade.