forked from git/git
-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f997272
commit d751eee
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/sh | ||
# | ||
|
||
test_description='regression test for memory leak in git merge' | ||
|
||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main | ||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME | ||
|
||
. ./lib-bash.sh | ||
|
||
# test-lib.sh disables LeakSanitizer by default, but we want it enabled | ||
# for this test | ||
export ASAN_OPTIONS= | ||
|
||
. "$GIT_BUILD_DIR/contrib/completion/git-prompt.sh" | ||
|
||
test_expect_success 'Merge fails due to local changes' ' | ||
git init && | ||
echo x > x.txt && | ||
git add . && | ||
git commit -m "WIP" && | ||
git checkout -b dev && | ||
echo y > x.txt && | ||
git add . && | ||
git commit -m "WIP" && | ||
git checkout main && | ||
echo z > x.txt && | ||
git add . && | ||
git commit -m "WIP" && | ||
echo a > x.txt && | ||
git add . && | ||
(echo "error: ''Your local changes to the following files would be overwritten by merge:''" >expected && | ||
echo " x.txt" >>expected && | ||
echo "Merge with strategy ort failed." >>expected && | ||
(git merge dev 2>actual || echo "merge error is expected") && | ||
test_cmp expected actual) | ||
' | ||
|
||
test_done |