It was my understanding that Luke’s was Mary’s, and that Matthew’s was Joseph’s, since although they were both Davidic, they were through two different branches.
The genealogy in Matthew connects Jesus to the primary kingly branch-- but he was not biologically related. There’s a lot of interesting discussion about the Curse of Jeconiah.
The genealogy in Luke also shares David as an ancestor-- but Luke is through Nathan, not through Solomon.
Other arguments suggest that Joseph had a biological father and an adoptive father.
Other arguments suggest a bunch of the in-between names were just a fabrication.
Much ink has been spilled.
But one of the interesting things was that, when the Annunciation happened–
30 But the angel said to her, “Do not be afraid, Mary; you have found favor with God. 31 You will conceive and give birth to a son, and you are to call him Jesus. 32 He will be great and will be called the Son of the Most High. The Lord God will give him the throne of his father David, 33 and he will reign over Jacob’s descendants forever; his kingdom will never end.”
34 “How will this be,” Mary asked the angel, “since I am a virgin?”
But she does not say, “How will this be, since I’m not of the House of David?”
The argument being that if an angel appeared to me and told me I would bear a son who would become the Emperor of Japan, I’d be more likely to say, “How will this be, since I’m not even Japanese, let alone related to their royal lineage—!” rather than “How will this be, since I’ve made a promise?”