mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-12 12:55:47 +02:00
Add patch option WillBeAppliedReverse
It's not used yet, but covered with tests already.
This commit is contained in:
parent
f76cc27956
commit
c79e360584
3 changed files with 86 additions and 15 deletions
|
@ -18,6 +18,15 @@ type PatchOptions struct {
|
|||
// generating the patch.
|
||||
Reverse bool
|
||||
|
||||
// If true, we're building a patch that we are going to apply using
|
||||
// "git apply --reverse". In other words, we are not flipping the '+' and
|
||||
// '-' ourselves while creating the patch, but git is going to do that when
|
||||
// applying. This has consequences for which lines we need to keep or
|
||||
// discard when filtering lines from partial hunks.
|
||||
//
|
||||
// Currently incompatible with Reverse.
|
||||
WillBeAppliedReverse bool
|
||||
|
||||
// Whether to keep or discard the original diff header including the
|
||||
// "index deadbeef..fa1afe1 100644" line.
|
||||
KeepOriginalHeader bool
|
||||
|
@ -105,7 +114,8 @@ outer:
|
|||
formattedHunks := ""
|
||||
var formattedHunk string
|
||||
for _, hunk := range hunksInRange {
|
||||
startOffset, formattedHunk = hunk.formatWithChanges(lineIndices, opts.Reverse, startOffset)
|
||||
startOffset, formattedHunk = hunk.formatWithChanges(
|
||||
lineIndices, opts.Reverse, opts.WillBeAppliedReverse, startOffset)
|
||||
formattedHunks += formattedHunk
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue