threads / patch / 24961

patchAdd unit test for check_cherry_pick

Subject: [PATCH] Add unit test for check_cherry_pick

## tl;dr

4 messages between Sep 3, 2010 and Sep 3, 2010. Diffs are folded; open one to read it.

replies: 3people: 3as markdown or json

Steven Walter· Sep 3, 2010, 18:52 UTC · lore
Signed-off-by: Steven Walter <stevenrwalter@gmail.com>
---
 t/t9155-git-svn-fetch-merge.sh |   65 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 65 insertions(+), 0 deletions(-)
 create mode 100644 t/t9155-git-svn-fetch-merge.sh
Show changes to t/t9155-git-svn-fetch-merge.sh +65 −0
diff --git a/t/t9155-git-svn-fetch-merge.sh b/t/t9155-git-svn-fetch-merge.sh
new file mode 100644
index 0000000..1c87986
--- /dev/null
+++ b/t/t9155-git-svn-fetch-merge.sh
@@ -0,0 +1,65 @@
+#!/bin/sh
+#
+# Copyright (c) 2010 Steven Walter
+#
+
+test_description='git svn merge detection'
+
+GIT_SVN_LC_ALL=${LC_ALL:-$LANG}
+
+. ./lib-git-svn.sh
+
+say 'define NO_SVN_TESTS to skip git svn tests'
+
+case "$GIT_SVN_LC_ALL" in
+*.UTF-8)
+	test_set_prereq UTF8
+	;;
+*)
+	say "UTF-8 locale not set, some tests skipped ($GIT_SVN_LC_ALL)"
+	;;
+esac
+
+test_expect_success \
+    'initialize source svn repo' '
+        svn_cmd mkdir -m x "$svnrepo"/trunk &&
+        svn_cmd mkdir -m x "$svnrepo"/branches &&
+        svn_cmd co "$svnrepo"/trunk "$SVN_TREE" &&
+	cd "$SVN_TREE" &&
+	touch foo &&
+	svn add foo &&
+	svn commit -m "initial commit" &&
+	svn cp -m branch "$svnrepo"/trunk "$svnrepo"/branches/branch1 &&
+	touch bar &&
+	svn add bar &&
+	svn commit -m x &&
+	svn cp -m branch "$svnrepo"/trunk "$svnrepo"/branches/branch2 &&
+	svn switch "$svnrepo"/branches/branch1 &&
+	touch baz &&
+	svn add baz &&
+	svn commit -m x &&
+	svn switch "$svnrepo"/trunk &&
+	svn merge "$svnrepo"/branches/branch1 &&
+	svn commit -m "merge" &&
+	svn switch "$svnrepo"/branches/branch1 &&
+	svn commit -m x &&
+	svn switch "$svnrepo"/branches/branch2 &&
+	svn merge "$svnrepo"/branches/branch1 &&
+	svn commit -m "merge branch1" &&
+	svn switch "$svnrepo"/trunk &&
+	svn merge "$svnrepo"/branches/branch2 &&
+	svn resolved baz &&
+	svn commit -m "merge branch2" &&
+	cd .. &&
+	rm -rf "$SVN_TREE"'
+
+test_expect_success \
+    'clone svn repo' '
+        git svn init -s "$svnrepo" &&
+	git svn fetch'
+
+test_expect_success \
+    'verify merge commit' '
+        git rev-parse HEAD^2'
+
+test_done
-- 
1.7.0.5.gbc75a
Ævar Arnfjörð Bjarmason· Sep 3, 2010, 19:12 UTC · re: Steven Walter · lore

Re: [PATCH] Add unit test for check_cherry_pick

On Fri, Sep 3, 2010 at 18:52, Steven Walter <stevenrwalter@gmail.com> wrote:
> +GIT_SVN_LC_ALL=${LC_ALL:-$LANG}
What's this about?
Show 7 quoted lines
> +. ./lib-git-svn.sh
> +
> +say 'define NO_SVN_TESTS to skip git svn tests'
> +
> +case "$GIT_SVN_LC_ALL" in
> +*.UTF-8)
> +       test_set_prereq UTF8
You never use this prereq?
Steven Walter· Sep 3, 2010, 19:26 UTC · re: Ævar Arnfjörð Bjarmason · lore

Re: [PATCH] Add unit test for check_cherry_pick

On Fri, Sep 3, 2010 at 3:12 PM, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:

Show 15 quoted lines
> On Fri, Sep 3, 2010 at 18:52, Steven Walter <stevenrwalter@gmail.com> wrote:
>
>> +GIT_SVN_LC_ALL=${LC_ALL:-$LANG}
>
> What's this about?
>
>> +. ./lib-git-svn.sh
>> +
>> +say 'define NO_SVN_TESTS to skip git svn tests'
>> +
>> +case "$GIT_SVN_LC_ALL" in
>> +*.UTF-8)
>> +       test_set_prereq UTF8
>
> You never use this prereq?

I'll admit that I copied these from t9100. I assumed they were necessary for correct operation. If that's not the case, then they can be removed.

-- 
-Steven Walter <stevenrwalter@gmail.com>
Eric Wong· Sep 3, 2010, 20:48 UTC · re: Steven Walter · lore

Re: [PATCH] Add unit test for check_cherry_pick

Steven Walter <stevenrwalter@gmail.com> wrote:
Show 9 quoted lines
> On Fri, Sep 3, 2010 at 3:12 PM, Ævar Arnfjörð Bjarmason wrote:
> > On Fri, Sep 3, 2010 at 18:52, Steven Walter <stevenrwalter@gmail.com> wrote:
> >> +GIT_SVN_LC_ALL=${LC_ALL:-$LANG}
> >
> > What's this about?
> 
> I'll admit that I copied these from t9100.  I assumed they were
> necessary for correct operation.  If that's not the case, then they
> can be removed.

Hi Steven, I've squashed your test case along with the following change and pushed the original commit up to git://git.bogomips.org/git-svn

Here's the intermediate diff -w of changes I made (all space indentations were convert to tabs, too):

Show changes to t/t9157-git-svn-fetch-merge.sh +10 −25
diff --git a/t/t9157-git-svn-fetch-merge.sh b/t/t9157-git-svn-fetch-merge.sh
index 1c87986..da582c5 100644
--- a/t/t9157-git-svn-fetch-merge.sh
+++ b/t/t9157-git-svn-fetch-merge.sh
@@ -4,27 +4,13 @@
 #
 
 test_description='git svn merge detection'
-
-GIT_SVN_LC_ALL=${LC_ALL:-$LANG}
-
 . ./lib-git-svn.sh
 
-say 'define NO_SVN_TESTS to skip git svn tests'
-
-case "$GIT_SVN_LC_ALL" in
-*.UTF-8)
-	test_set_prereq UTF8
-	;;
-*)
-	say "UTF-8 locale not set, some tests skipped ($GIT_SVN_LC_ALL)"
-	;;
-esac
-
-test_expect_success \
-    'initialize source svn repo' '
+test_expect_success 'initialize source svn repo' '
         svn_cmd mkdir -m x "$svnrepo"/trunk &&
         svn_cmd mkdir -m x "$svnrepo"/branches &&
         svn_cmd co "$svnrepo"/trunk "$SVN_TREE" &&
+	(
 	cd "$SVN_TREE" &&
 	touch foo &&
 	svn add foo &&
@@ -49,17 +35,16 @@ test_expect_success \
 	svn switch "$svnrepo"/trunk &&
 	svn merge "$svnrepo"/branches/branch2 &&
 	svn resolved baz &&
-	svn commit -m "merge branch2" &&
-	cd .. &&
-	rm -rf "$SVN_TREE"'
+		svn commit -m "merge branch2"
+	) &&
+	rm -rf "$SVN_TREE"
+'
 
-test_expect_success \
-    'clone svn repo' '
+test_expect_success 'clone svn repo' '
         git svn init -s "$svnrepo" &&
-	git svn fetch'
+	git svn fetch
+'
 
-test_expect_success \
-    'verify merge commit' '
-        git rev-parse HEAD^2'
+test_expect_success 'verify merge commit' 'git rev-parse HEAD^2'
 
 test_done
-- 
Eric Wong

← back to recent threads