Less than two weeks ago there was rejoicing in Pittsburgh for the sudden emergence of a team capable of reaching the playoffs. These days putting a few wins together would be cause for celebration.

A day after snapping their 10-game losing streak, the Pirates started another one Tuesday night with a 6-0 loss to the San Francisco Giants, who seem to find a way to stay atop their division despite their own struggles.

James McDonald (7-6) pitched six strong innings, allowing three runs and four hits for the Pirates.

"He gave up four hits," Pirates manager Clint Hurdle said. "That's four on the barrel. It seems like when he makes a mistake he pays for it. His stuff has gotten better as the season goes along, it's just a matter of execution."

McDonald has been able to complete seven innings once this year — in his last start. The Pirates have lost his last three starts. That hasn't always been the case.

After going winless in his first four starts, the Pirates won 12 of his next 16 starts. He was 7-2 during that span.

"I've given up home runs my whole career," McDonald said. "As long as I can keep the damage to a minimum I'm happy."

Madison Bumgarner (7-11) struck out 10 and walked one in seven innings. The lefty was one strikeout short of his career-high, which came against Cleveland on June 26.

With Bumgarner having another superb outing, San Francisco finally gave him some rare run support.

Chris Stewart sent a fastball from McDonald in the fifth over the wall in left field to give the Giants a 2-0 lead. He sprinted around the bases and was mobbed by teammates in the dugout after his first home run in 140 major league at-bats.

Huff added a home run over the brick wall in right in the sixth to put San Francisco ahead 3-0. The homer was his 11th of the season and a big boost for a Giants team playing without injured slugger Carlos Beltran, nursing a strained right hand for the second straight game.

San Francisco's 28 home runs at AT&T Park are the fewest for any team in the majors at home.

The Pirates had few scoring chances and saw their best one snatched away.

Ronny Cedeno had a one-out double in the fifth and moved to third with two outs on McDonald's groundout. Giants third baseman Pablo Sandoval then made a diving stop to rob Andrew McCutchen of extra bases and save a run.

That's how things have gone lately for Pittsburgh, which sat in first place in the NL Central a little more than two weeks ago.

NOTES: Giants OF Pat Burrell was scheduled to fly to North Carolina on Wednesday to seek a second opinion on his strained right foot. ... Giants 3B coach Tim Flannery sang the national anthem along with "Further" members Phil Lesh and Bob Weir. ... Pirates RHP Jeff Karstens (8-6, 3.05 ERA) will try to rebound from his last start when he takes the mound Wednesday opposite Giants LHP Jonathan Sanchez (4-6, 4.10). Karstens allowed nine runs in 3 1-3 innings last week against San Diego. It was the first time he allowed more than three earned runs in a start since April 17. ... The Giants are 2-0 on "Grateful Dead" days.