Fix "move patch into new commit" for partial hunk (#2507)

This commit is contained in:
Stefan Haller 2023-03-18 08:17:47 +01:00 committed by GitHub
parent 81ea3107ed
commit 4b4dccfd7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 534 additions and 44 deletions

View file

@ -26,7 +26,7 @@ func TestRebaseRebaseBranch(t *testing.T) {
testName: "successful rebase",
arg: "master",
runner: oscommands.NewFakeRunner(t).
Expect(`git rebase --interactive --autostash --keep-empty --no-autosquash master`, "", nil),
Expect(`git rebase --interactive --autostash --keep-empty --empty=keep --no-autosquash master`, "", nil),
test: func(err error) {
assert.NoError(t, err)
},
@ -35,7 +35,7 @@ func TestRebaseRebaseBranch(t *testing.T) {
testName: "unsuccessful rebase",
arg: "master",
runner: oscommands.NewFakeRunner(t).
Expect(`git rebase --interactive --autostash --keep-empty --no-autosquash master`, "", errors.New("error")),
Expect(`git rebase --interactive --autostash --keep-empty --empty=keep --no-autosquash master`, "", errors.New("error")),
test: func(err error) {
assert.Error(t, err)
},
@ -125,7 +125,7 @@ func TestRebaseDiscardOldFileChanges(t *testing.T) {
commitIndex: 0,
fileName: "test999.txt",
runner: oscommands.NewFakeRunner(t).
Expect(`git rebase --interactive --autostash --keep-empty --no-autosquash abcdef`, "", nil).
Expect(`git rebase --interactive --autostash --keep-empty --empty=keep --no-autosquash abcdef`, "", nil).
Expect(`git cat-file -e HEAD^:"test999.txt"`, "", nil).
Expect(`git checkout HEAD^ -- "test999.txt"`, "", nil).
Expect(`git commit --amend --no-edit --allow-empty`, "", nil).