diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-09 13:34:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-09 13:34:27 +0000 |
commit | 4dbdc42d9e7c3968ff7f690d00680419c9b8cb0f (patch) | |
tree | 47c1d492e9c956c1cd2b74dbd3b9d8b0db44dc4e /t/t3438-rebase-broken-files.sh | |
parent | Initial commit. (diff) | |
download | git-4dbdc42d9e7c3968ff7f690d00680419c9b8cb0f.tar.xz git-4dbdc42d9e7c3968ff7f690d00680419c9b8cb0f.zip |
Adding upstream version 1:2.43.0.upstream/1%2.43.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 't/t3438-rebase-broken-files.sh')
-rwxr-xr-x | t/t3438-rebase-broken-files.sh | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/t/t3438-rebase-broken-files.sh b/t/t3438-rebase-broken-files.sh new file mode 100755 index 0000000..c614c4f --- /dev/null +++ b/t/t3438-rebase-broken-files.sh @@ -0,0 +1,61 @@ +#!/bin/sh + +test_description='rebase behavior when on-disk files are broken' + +TEST_PASSES_SANITIZE_LEAK=true +. ./test-lib.sh + +test_expect_success 'set up conflicting branches' ' + test_commit base file && + git checkout -b branch1 && + test_commit one file && + git checkout -b branch2 HEAD^ && + test_commit two file +' + +create_conflict () { + test_when_finished "git rebase --abort" && + git checkout -B tmp branch2 && + test_must_fail git rebase branch1 +} + +check_resolve_fails () { + echo resolved >file && + git add file && + test_must_fail git rebase --continue +} + +for item in NAME EMAIL DATE +do + test_expect_success "detect missing GIT_AUTHOR_$item" ' + create_conflict && + + grep -v $item .git/rebase-merge/author-script >tmp && + mv tmp .git/rebase-merge/author-script && + + check_resolve_fails + ' +done + +for item in NAME EMAIL DATE +do + test_expect_success "detect duplicate GIT_AUTHOR_$item" ' + create_conflict && + + grep -i $item .git/rebase-merge/author-script >tmp && + cat tmp >>.git/rebase-merge/author-script && + + check_resolve_fails + ' +done + +test_expect_success 'unknown key in author-script' ' + create_conflict && + + echo "GIT_AUTHOR_BOGUS=${SQ}whatever${SQ}" \ + >>.git/rebase-merge/author-script && + + check_resolve_fails +' + +test_done |