aboutsummaryrefslogtreecommitdiffstats
path: root/src/suggestion.rs
diff options
context:
space:
mode:
authorTeddy Wing2020-07-28 02:06:39 +0200
committerTeddy Wing2020-07-28 19:47:13 +0200
commit11118c94cc8fa315cbad1e39f3f285eb7ccbcca8 (patch)
tree2fbd459446106448d95d29753468d319a0ad67c3 /src/suggestion.rs
parent1283d0511bac89957163097d1a68bb9753208f09 (diff)
downloadgit-suggestion-11118c94cc8fa315cbad1e39f3f285eb7ccbcca8.tar.bz2
Suggestion.apply(): Error when patch doesn't apply
Don't apply the patch when it doesn't apply, instead fail with an error. Previously, the `apply()` method would apply the patch to the lines from `Suggestion`, even if the file was different from what the suggestion expected. So, you could end up with the `Suggestion` lines being overwritten with the suggestion text, even when they didn't match the original side of the suggestion. Fix this by getting the diff text from `diff_with_repo()` and applying it using `git-apply`. This gives us a suitable error when the patch doesn't apply to the file, leaving the file alone.
Diffstat (limited to 'src/suggestion.rs')
0 files changed, 0 insertions, 0 deletions