git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 1/2] Regression test for https://github.com/gitgitgadget/git/pull/1577

From
KGKevin Backhouse via GitGitGadget <gitgitgadget@gmail.com>
Date
Aug 24, 2023, 14:12 UTC
Message-ID
<f940104a7814bd0b1e45f1230b2cb4b0be305699.1692886365.git.gitgitgadget@gmail.com>
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
Previous: Kevin Backhouse via GitGitGadgetNext: Junio C Hamano
Message 5 of 8 in “This fixes a minor memory leak (detected by LeakSanitizer) in git merge.”
  1. This fixes a minor memory leak (detected by LeakSanitizer) in git merge.Kevin Backhouse via GitGitGadget, Aug 18, 2023
  2. Junio C HamanoAug 18, 2023
  3. Elijah NewrenSep 12, 2023
  4. 0/2 This fixes a minor memory leak (detected by LeakSanitizer) in git mergeKevin Backhouse via GitGitGadget, Aug 24, 2023
  5. 1/2 Regression test for https://github.com/gitgitgadget/git/pull/1577Kevin Backhouse via GitGitGadget, Aug 24, 2023
  6. Junio C HamanoAug 24, 2023
  7. 2/2 Fix minor memory leak found by LeakSanitizer.Kevin Backhouse via GitGitGadget, Aug 24, 2023
  8. Junio C HamanoAug 24, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.