The guards patches touch a lot of guilt, so make sure they don't muck anything up. Signed-off-by: Eric Lesh <eclesh@xxxxxxxx> --- regression/070-guards.sh | 184 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 184 insertions(+), 0 deletions(-) create mode 100755 regression/070-guards.sh diff --git a/regression/070-guards.sh b/regression/070-guards.sh new file mode 100755 index 0000000..d6917f2 --- /dev/null +++ b/regression/070-guards.sh @@ -0,0 +1,184 @@ +#!/bin/bash +# +# Test the commands that use get_*_series, while applying guards +# + +source scaffold +source generic_test_data + +function prepare_for_tests +{ + # generic_test_data's patches all depend on each other + # that's no good for guards testing + + echo "abc" > def + git-add def + git-commit -s -m "initial" 2> /dev/null > /dev/null + + cat << DONE > .git/patches/master/first +diff --git a/first b/first +new file mode 100644 +index 0000000..9c59e24 +--- /dev/null ++++ b/first +@@ -0,0 +1 @@ ++first +DONE + + cat << DONE > .git/patches/master/second +diff --git a/second b/second +new file mode 100644 +index 0000000..e019be0 +--- /dev/null ++++ b/second +@@ -0,0 +1 @@ ++second +DONE + + cat << DONE > .git/patches/master/third +diff --git a/third b/third +new file mode 100644 +index 0000000..234496b +--- /dev/null ++++ b/third +@@ -0,0 +1 @@ ++third +DONE + + cat << DONE > .git/patches/master/fourth +diff --git a/fourth b/fourth +new file mode 100644 +index 0000000..285a4e6 +--- /dev/null ++++ b/fourth +@@ -0,0 +1 @@ ++fourth +DONE + + cat << DONE > .git/patches/master/series +first +second +third +fourth +DONE + + touch -d "$GIT_COMMITTER_DATE" .git/patches/master/first + touch -d "$GIT_COMMITTER_DATE" .git/patches/master/second + touch -d "$GIT_COMMITTER_DATE" .git/patches/master/third + touch -d "$GIT_COMMITTER_DATE" .git/patches/master/fourth +} + +function expected_applied_none +{ + echo "first" + echo "second" + echo "third" + echo "fourth" +} + +function expected_applied_positive +{ + echo "second" + echo "third" + echo "fourth" +} + +function expected_applied_positive_selected +{ + echo "first" + echo "second" + echo "third" + echo "fourth" +} + +function expected_applied_negative +{ + echo "first" + echo "second" + echo "third" + echo "fourth" +} + +function expected_applied_negative_selected +{ + echo "second" + echo "third" + echo "fourth" +} + +function expected_next +{ + echo "second" +} + +function expected_unapplied +{ + echo "second" + echo "third" + echo "fourth" +} + +empty_repo +cd $REPODIR +guilt-init + +prepare_for_tests + +# test with no guarded patches and no guards selected +guilt-push -a > /dev/null +guilt-applied > /tmp/reg.$$ +expected_applied_none | diff -u - /tmp/reg.$$ +echo -n "[none] " + +# test with one positive guarded patch and no guards selected +guilt-pop -a > /dev/null +guilt-guard first +foo +guilt-push -a > /dev/null +guilt-applied > /tmp/reg.$$ +expected_applied_positive | diff -u - /tmp/reg.$$ +echo -n "[positive] " + +# test with one positive guarded patch with that guard selected +guilt-pop -a > /dev/null +guilt-select foo +guilt-push -a > /dev/null +guilt-applied > /tmp/reg.$$ +expected_applied_positive_selected | diff -u - /tmp/reg.$$ +echo -n "[positive selected] " + +# test with one negative guarded patch and no guards selected +guilt pop -a > /dev/null +guilt-select -n +guilt-guard first -foo +guilt-push -a > /dev/null +guilt-applied > /tmp/reg.$$ +expected_applied_negative | diff -u - /tmp/reg.$$ +echo -n "[negative] " + +# test with one negative guarded patch with that guard selected +guilt pop -a > /dev/null +guilt-select foo +guilt-push -a > /dev/null +guilt-applied > /tmp/reg.$$ +expected_applied_negative_selected | diff -u - /tmp/reg.$$ +echo -n "[negative selected] " + +# test that guilt-next works +guilt-pop -a > /dev/null +guilt-select -n +guilt-guard first +foo +guilt-next > /tmp/reg.$$ +expected_next | diff -u - /tmp/reg.$$ +echo -n "[next] " + +# test that guilt-unapplied works +guilt-pop -a > /dev/null +guilt-select -n +guilt-guard first +foo +guilt-unapplied > /tmp/reg.$$ +expected_unapplied | diff -u - /tmp/reg.$$ +echo -n "[unapplied] " + +rm -f /tmp/reg.$$ + +complete_test -- 1.5.2 - 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