SAN FRANCISCO — It wasn’t pretty. But it’s a win. At this point, that’s good enough for the Giants, who staved off sole possession of the majors’ worst record Friday with a 5-2 win to start their series against the Pirates. Robbie Ray walked four batters and was at 72 pitches through three innings, but the Giants’ starter buckled down to complete six frames. Despite walking the bases loaded in the third, Pittsburgh’s only damage against the left-hander came on a solo shot from Marcell Ozuna. Robbie Ray walked four batters and was at 72 pitches through three innings, but the Giants’ starter buckled down to complete six frames. AP Rafael Devers was the solo proprietor of runs for the home team until San Francisco finally broke through Getty Images Rafael Devers was the solo proprietor of runs for the home team until San Francisco finally broke through for some insurance in its third scoring opportunity of the evening.…