From: "Kevin Backhouse via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Kevin Backhouse <kevinbackhouse@github.com>,
Kevin Backhouse <kevinbackhouse@github.com>
Subject: [PATCH v2 1/2] Regression test for https://github.com/gitgitgadget/git/pull/1577
Date: Thu, 24 Aug 2023 14:12:44 +0000 [thread overview]
Message-ID: <f940104a7814bd0b1e45f1230b2cb4b0be305699.1692886365.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1577.v2.git.1692886365.gitgitgadget@gmail.com>
From: Kevin Backhouse <kevinbackhouse@github.com>
Signed-off-by: Kevin Backhouse <kevinbackhouse@github.com>
---
t/t9904-merge-leak.sh | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
create mode 100755 t/t9904-merge-leak.sh
diff --git a/t/t9904-merge-leak.sh b/t/t9904-merge-leak.sh
new file mode 100755
index 00000000000..09a4474fd73
--- /dev/null
+++ b/t/t9904-merge-leak.sh
@@ -0,0 +1,40 @@
+#!/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
+ASAN_OPTIONS=
+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 &&
+ test_must_fail git merge -s ort dev 2>actual &&
+ test_cmp expected actual
+'
+
+test_done
--
gitgitgadget
next prev parent reply other threads:[~2023-08-24 14:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-18 20:04 [PATCH] This fixes a minor memory leak (detected by LeakSanitizer) in git merge Kevin Backhouse via GitGitGadget
2023-08-18 21:41 ` Junio C Hamano
2023-09-12 15:06 ` Elijah Newren
2023-08-24 14:12 ` [PATCH v2 0/2] " Kevin Backhouse via GitGitGadget
2023-08-24 14:12 ` Kevin Backhouse via GitGitGadget [this message]
2023-08-24 15:11 ` [PATCH v2 1/2] Regression test for https://github.com/gitgitgadget/git/pull/1577 Junio C Hamano
2023-08-24 14:12 ` [PATCH v2 2/2] Fix minor memory leak found by LeakSanitizer Kevin Backhouse via GitGitGadget
2023-08-24 15:56 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f940104a7814bd0b1e45f1230b2cb4b0be305699.1692886365.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--cc=kevinbackhouse@github.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).