Light doesn't have mass...Its mass is 0 otherwise, it wudnt have traveled at c...
What happens with black holes is different matter though..It isn't gravity, actually, the black hole wraps space time, and curves space in the shape of a tunnel, so light is actually traveling in straight line...