If an item already has Mending, it'll get fully repaired and its extra repair cost reset if you ever repair it in any fashion.
Items that have been repaired get a little note in their tooltip to let you know.
I personally am not a fan of how the Mending enchantment effectively makes diamonds a worthless resource. Once you have your set of god tools, all you need is a xp grinder to keep them going forever. As such, I've been trying to find a way to make mending be a less game defining feature, but still keeping it useful in some format.
I believe that this implementation is optimal as it still maintains the need for additional resources to repair your items, all the while keeping the ability to use the extremely powerful tools you spent ages enchanting for much longer.