This tale was published in the collection Cuentos Populars Catalans by D. Francisco de S. Maspons y Labros in 1885, so its probably earlier anything from a year to 500 years I would say.
So here it goes, of to Spain. A poor girl is herding cows when one day she hears a moan which turns out to be from a wounded Lion. This girl having no survival instincts it would seem goes of the help the king of beasts. The lion was grateful and licked her faces (what can I say cats are just fond of bathing that way) anyway, while she was doing this good deed of the day she lost her cows and got a beating after which she was sent of with donkeys, now next year it was the same story with the same result only this time she was sent out herding pigs. The third year the lion appeared again, wounded, helped and ofcourse she lost the pigs. Now she sat in tree looking if she couldn't find them again. Since she liked it up there she stayed and saw a man disappear behind a rock and decided to wait until he came back again (oh well each his/her own hobby). She sat there all night and at dawn a lion came from behind the rock. Now this really was something to be curious about and the sherperdess decided to go and ask him what that was all about (privacy was a foreign concept it would seem). He told her he was enchanted by a giant (ofcourse LOL), that same giant had stolen her animals in revenge for her help, a good deed never goes unpunished afterall. She ofcourse wanted to free him and he told her that the only way to do that was to get a lock of her from a princess and make a cloak out of it for the giant. She set out to do this oh so easy task and after two tries the cloak was finished. However the princess wanted a good return for the loss of those 2 locks and said she wanted the sheperdess to bring her a prince to marry. The giant was equally difficult to negociate with, but in the end he told her how to reverse the spell. Now this is the not for the fainted hearted part. She needed to kill the prince, chop him into pieces, burn them and throw those in the river. Somehow a man would reappear.
She was not eager to do this and even wept over it. The lion however told her that it was true, this was what she had to do. So she set of the work and when he did indeed come back from the death as his princely self he promised to marry her. Yet in the selfless way of her she said she could not, there was a princess awaiting his arrival. Which was a pretty big ask for a lock of hair but still they set of. Luckily this princess proved to be the sister of our former lion so she didn't hold our sheperdess to her promise and the wedding went as planned.