This is the question every homeowner asks and the one where the answer feels least trustworthy, because the person answering it also gets paid more for one option than the other. That is a fair thing to be suspicious about. So rather than telling you what to do, here is how the decision actually gets made, so you can evaluate what you are told and ask better questions. There are four factors that decide it, and they are not subjective. Age, the extent of the damage, the condition of the decking, and the math of repairing repeatedly versus replacing once. A contractor who can walk you through all four with photos is giving you a real answer. A contractor who leads with a replacement quote before getting in the attic is giving you a sales pitch.

How Old Is the Roof
This is the first filter and it settles a lot of cases on its own. Architectural asphalt shingles have a service life measured in decades, not years, and the closer a roof gets to the end of that window, the less sense a repair makes. Spending real money on a roof with two or three years left is throwing it away. On the other hand, a roof in the first half of its life with localized damage is almost always a repair, and anybody telling you otherwise should be asked why. If you do not know the age, a roofer can usually estimate it from the shingle type, the wear pattern and the layers. Ask what they are basing the estimate on.
How Much of the Roof Is Actually Affected
Localized damage means a repair. One valley, one section of flashing, a dozen shingles blown off in a storm, a leak around a vent stack. All of that is fixable and should be fixed rather than turned into a replacement. The picture changes when the problem shows up in multiple places at once, because that usually means the roof is failing as a system rather than at one point. Granules filling the gutters, shingles curling or cupping across whole slopes, several leaks in different areas. That pattern is a roof at the end of its life, and patching it becomes an ongoing expense with no end date. Ask for photos of every area of concern, not just the one you called about.
What the Decking Underneath Is Telling You
This is the factor homeowners never think about and it matters more than the shingles. The decking is the plywood or board layer the shingles are nailed to. If water has been getting in, the decking goes soft, and soft decking will not hold a nail properly. You can put a beautiful new roof on bad decking and it will fail early, which is why any honest replacement quote includes an allowance for replacing rotted sections once the old roof comes off. Nobody knows exactly how much until the tear off happens. From inside the attic you can often see it directly, as dark staining or sagging between rafters. Ask whether the attic was inspected.
The Math Nobody Walks You Through
Here is the calculation that actually decides it. Take the repair cost and ask how long it realistically buys you. Then take the replacement cost and divide it across the service life of the new roof. When a repair buys three years on a roof that has five left, repairing is the better financial move even though you will replace it soon. When you have paid for three repairs in four years, you have already spent a meaningful chunk of a replacement and still have the old roof. Ask any contractor to tell you how long the repair is expected to hold. If they will not put a number on it, that hesitation is information.