[PATCH] Add a new test to ensure merging a submodule is handled properly.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In this test we cause a directory / submodule conflict then we check if
the index is unlocked properly.

Signed-off-by: Miklos Vajna <vmiklos@xxxxxxxxxxxxxx>
---

I'm no exactly sure if this should be included or not, I just wrote it
to make sure that a die() insure merge-recursive will not cause an
unlocked index at the end.

 t/t7607-merge-submodule.sh |   40 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)
 create mode 100755 t/t7607-merge-submodule.sh

diff --git a/t/t7607-merge-submodule.sh b/t/t7607-merge-submodule.sh
new file mode 100755
index 0000000..552930a
--- /dev/null
+++ b/t/t7607-merge-submodule.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+test_description='git-merge
+
+Testing if a directory / submodule conflict is handled properly.'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+	mkdir lib &&
+	cd lib &&
+	git init &&
+	echo c1 >c1.c &&
+	git add c1.c &&
+	git commit -m "submodule init" &&
+	mkdir ../main &&
+	cd ../main &&
+	git init &&
+	echo main >main.c &&
+	git add main.c &&
+	git commit -m "c0: main init" &&
+	git tag c0 &&
+	mkdir lib &&
+	echo lib >lib/c1.c &&
+	git add lib/c1.c &&
+	git commit -m "c1: lib init" &&
+	git tag c1 &&
+	git reset --hard c0 &&
+	git submodule add "`pwd`/../lib" lib &&
+	git commit -m "c2: add submodule" &&
+	git tag c2
+'
+
+test_expect_success 'dir/submodule conflict' '
+	git reset --hard c1 &&
+	test_must_fail git merge c2 &&
+	test ! -f .git/index.lock
+'
+
+test_done
-- 
1.6.0.rc0.14.g95f8.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux