fdo#75815: Write test for this first.

Change-Id: I2a5a1964dc6496aa4db15c9e8644692b460d0527
fdo#75815: Adjust external references here too.

Adjusting external references are much simpler than adjusting internal
ones since we don't need to worry about deleted references etc.

Change-Id: I82111e383e1fc6976ef08c1438c3dd916a249af6