So it’s getaway day and the final game of a series for the Diamondbacks Wednesday in San Francisco, which naturally can mean only one thing. Or maybe two:

They’re going to win.

And they just might have to play extra innings to do it.

That’s been the pattern for the Diamondbacks, who are 6-0 in series finales, 5-0 on get-away days, and 3-0 (entering Tuesday night’s game) in extra innings — all three of which have just happened to come in, get this, getaway series finales.

“We’ve developed a mentality to hang in there,” manager Kirk Gibson told reporters.

OK, so there’s no guarantee the Diamondbacks will beat the Giants Wednesday or beat them in extra innings, for that matter.

But that’s what they generally seem to do.

They went 16 innings April 3 to beat the Cardinals 10-9 in the rubber match of a season-opening series at Chase Field.

They went 12 innings on April 7 in Milwaukee to beat the Brewers 8-7 and complete a three-game sweep on getaway day.

They went 12 innings last Thursday in New York to beat the Yankees 6-2 and avoid a three-game sweep in yet another getaway game.

And they did the same thing Sunday in Denver — albeit without the extra innings — in beating the Rockies 10-8 to avoid a sweep on getaway day. It was Colorado’s first home loss of the season.

It’s been making for some pleasant plane rides, and Gibson can only hope the trend continues.

“It is what it is,” Gibson said. “You don’t have time to be disappointed. You have to regroup immediately, play the game the right way and get back on offense and try to win the game. We’ve done a good job of it.”

On every occasion in which the Diamondbacks have come up big in the clutch on getaway games or series finales, it’s been a different player delivering the magic.

Cliff Pennington’s single in the 16th scored Jason Kubel from second to beat the Cardinals. Eric Hinske pounded a two-run, pinch-hit home run to sink the Brewers in the 11th.

Rookie outfielder A.J. Pollock snapped an 0-for-14 streak by hitting two homers and driving in four runs when Arizona toppled the Pirates 10-2. Paul Goldschmidt delivered a walk-off RBI single in the ninth to beat the Dodgers 1-0.

Cody Ross and Eric Chavez combined for four RBIs in the 12th to help down the Yankees. And in Denver, it was an RBI groundout by rookie Alfredo Marte and a run-scoring sacrifice fly by Gerardo Parra that rocked the Rockies.

“It’s nice that we keep doing this in games where they’re on the border of being losable games and we turn them into winnable games,” Diamondbacks pitcher Brandon McCarthy told reporters after that particular game.

“We’re keeping games close, which is good, and when we need to, we’re coming through. Eventually, we’ll get back in our game and everything will fall back in line and then we can start winning games comfortably. But in the meantime, as long as we’re not giving up, it’s a good thing.”