Signed-off-by: Felipe Contreras <felipe.contre...@gmail.com>
---
 contrib/related/Makefile       | 17 +++++++++++++
 contrib/related/test-related.t | 54 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+)
 create mode 100644 contrib/related/Makefile
 create mode 100755 contrib/related/test-related.t

diff --git a/contrib/related/Makefile b/contrib/related/Makefile
new file mode 100644
index 0000000..1224fce
--- /dev/null
+++ b/contrib/related/Makefile
@@ -0,0 +1,17 @@
+TESTS := $(wildcard test-*.t)
+
+export T := $(addprefix $(CURDIR)/,$(TESTS))
+export MAKE := $(MAKE) -e
+export PATH := $(CURDIR):$(PATH)
+export TEST_LINT := test-lint-executable test-lint-shell-syntax
+export TEST_DIRECTORY := $(CURDIR)/../../t
+
+all:
+
+test:
+       $(MAKE) -C ../../t $@
+
+$(TESTS): all
+       $(MAKE) -C ../../t $(CURDIR)/$@
+
+.PHONY: all test $(TESTS)
diff --git a/contrib/related/test-related.t b/contrib/related/test-related.t
new file mode 100755
index 0000000..b69684d
--- /dev/null
+++ b/contrib/related/test-related.t
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+test_description="Test git related"
+
+test -z "$TEST_DIRECTORY" && TEST_DIRECTORY="$PWD/../../t"
+. "$TEST_DIRECTORY"/test-lib.sh
+
+setup() {
+       git init &&
+       echo one > content &&
+       git add content &&
+       git commit -q -m one --author='Pablo Escobar <pa...@escobar.com>' &&
+       echo two >> content &&
+       git commit -q -a -m one --author='Jon Stewart <j...@stewart.com>' &&
+       echo three >> content &&
+       git commit -q -a -m three --author='John Doe <j...@doe.com>' &&
+       echo four >> content &&
+       git branch basic &&
+       git commit -q -a -F - --author='John Poppins <j...@doe.com>' <<-EOF &&
+       four
+
+       Reviewed-by: Jon Stewart <j...@stewart.com>
+       EOF
+       echo five >> content &&
+       git commit -q -a -m five --author='Mary Poppins <m...@yahoo.com.uk>'
+       git checkout -b next &&
+       echo six >> content &&
+       git commit -q -a -m six --author='Ocatio Paz <octavio....@gmail.com>'
+}
+
+setup
+
+test_expect_success "basic" "
+       git format-patch --stdout -1 basic > patch &&
+       git related patch | sort > actual &&
+       cat > expected <<-EOF &&
+       Jon Stewart <j...@stewart.com>
+       Pablo Escobar <pa...@escobar.com>
+       EOF
+       test_cmp expected actual
+"
+
+test_expect_success "others" "
+       git format-patch --stdout -1 master > patch &&
+       git related patch | sort > actual &&
+       cat > expected <<-EOF &&
+       John Doe <j...@doe.com>
+       John Poppins <j...@doe.com>
+       Jon Stewart <j...@stewart.com>
+       EOF
+       test_cmp expected actual
+"
+
+test_done
-- 
1.8.4-fc

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

Reply via email to