Skip to content

Commit

Permalink
Regression test for gitgitgadget#1577
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Backhouse <kevinbackhouse@github.com>
  • Loading branch information
kevinbackhouse committed Aug 22, 2023
1 parent f997272 commit 9311f55
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions t/t9904-merge-leak.sh
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

0 comments on commit 9311f55

Please sign in to comment.