Here's an incredibly quick "cut and paste" from some notes I have regarding both lines being Joseph's......sorry, I don't seem to be able to find the source I got it from - I'll try checking later.
"An extremely simple explanation is readily available, and it involves no strange customs or textual twists at all. Both genealogies are clearly through Joseph. I believe that one traces the lineage back through Joseph's father, and that the other traces back through Joseph's mother. However, the maternal genealogy drops the name of Joseph's mother, and instead skips back to her father. Which is which? I believe that the genealogy in Luke is through Joseph's father. I believe the one in Matthew is through Joseph's maternal grandfather.
[TABLE]
[TR]
[TD]Matthew's Genealogy
[/TD]
[TD]Luke's Genealogy
[/TD]
[/TR]
[TR]
[TD]JACOB (maternal grandfather)
[/TD]
[TD]MATTHAT (paternal grandfather)
[/TD]
[/TR]
[TR]
[TD](mother--unlisted)
[/TD]
[TD]HELI (father)
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]JOSEPH
[/TD]
[TD]Mary
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]JESUS
[/TD]
[/TR]
[/TABLE]
That Matthew should skip Joseph's mother in the genealogical listing is not peculiar since it is readily apparent that Matthew skips a number of people in his genealogy. For instance, in Matt 1:8 he writes: "Joram the father of Uzziah". But when his statement is compared with 1 Chr 3:10-12, the reader sees that three people have been left out of Matthew's genealogy: Ahaziah, Joash, and Amaziah. Why did Matthew leave names out? So he could get the structural symmetry he desired. In Matt 1:17 he records:
Thus there were fourteen generations
in all from Abraham to David,
fourteen from David to the exile to Babylon,
and fourteen from the exile to Christ.
Therefore, it would not be unreasonable to suppose that Matthew might leave out the name of Joseph's mother so he could get the structural format he desired. Furthermore, this genealogy does list four women: Tamar, Rahab, Ruth, and Bathsheba, which lends, I think, some support to the idea that this might be a woman's genealogy.
I believe this explanation for the two genealogies has the advantage of simplicity, and that this explanation also has the textual support which the other common theories lack."