I read somewhere that the line in Matthew traces Joseph & the one in Luke traces Mary.
That has a couple of problems.
First, it is nonsense. Mary is not mentioned in Luke, but Joseph is. Some apologists will argue that they would not have recorded her name because women were not considered important. That might be true, but as far as I know, there was no taboo on writing a woman's name for a case as special as this. But it is probably true that no one would have bothered to keep a woman's lineage because they didn't matter anyway. So that begs the question, how would anyone have known hers? And why would they have used her husband's name instead?
Second, the lineage in Matt has 12 fewer generations between Joe and Abraham than the one in Luke. So if it were true that they were separate lineages of Joe and Mary, then Joe would have been a contemporary of Mary's great, great, great, great, great, great, great, great, great, great grandfather. And we were talking first century, not the ancient times when people allegedly lived for 900 years.
These are two separate, fictional lineages written by two separate jesus cults. The only reason it mattered was because the messiah was supposed to be a descendent of David. And the only reason that mattered was because the messiah was supposed to be king of the kingdom of Israel/ Judah. They were trying to shoehorn their cult leader into a role that was specified by prophecy. They did it poorly, but enough people were/ are stupid enough to buy it.