Signed-off-by: Felipe Contreras <[email protected]>
---
 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 <[email protected]>' &&
+       echo two >> content &&
+       git commit -q -a -m one --author='Jon Stewart <[email protected]>' &&
+       echo three >> content &&
+       git commit -q -a -m three --author='John Doe <[email protected]>' &&
+       echo four >> content &&
+       git branch basic &&
+       git commit -q -a -F - --author='John Poppins <[email protected]>' <<-EOF &&
+       four
+
+       Reviewed-by: Jon Stewart <[email protected]>
+       EOF
+       echo five >> content &&
+       git commit -q -a -m five --author='Mary Poppins <[email protected]>'
+       git checkout -b next &&
+       echo six >> content &&
+       git commit -q -a -m six --author='Ocatio Paz <[email protected]>'
+}
+
+setup
+
+test_expect_success "basic" "
+       git format-patch --stdout -1 basic > patch &&
+       git related patch | sort > actual &&
+       cat > expected <<-EOF &&
+       Jon Stewart <[email protected]>
+       Pablo Escobar <[email protected]>
+       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 <[email protected]>
+       John Poppins <[email protected]>
+       Jon Stewart <[email protected]>
+       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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to