Ed Sheeran has won a copyright trial brought by the co-writer of Marvin Gaye’s Let’s Get It On.