Only update metadata that has changed

We don't always have to do an update for a file and if we do, let's not update everything.

#3118

@icewind1991 @bartv2 @karlitschek