{"thread":{"id":"13158","subject":"[StGit PATCH 2/5] Use hardcoded author and committer names in tests","startedAt":"2008-04-17T21:12:40Z","lastAt":"2008-04-17T21:14:33Z","messageCount":7,"participants":["Karl Hasselström"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"74680","messageId":"20080417210137.12809.88457.stgit@yoghurt","threadId":"13158","inReplyTo":null,"subject":"[StGit PATCH 0/5] test suite update","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2008-04-17T21:12:40Z","receivedAt":"2008-04-17T21:12:40Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"This patch series pulls in updates to test-lib.sh from git (we now get\ncolored output!), and does some other assorted test suite updates.\n\n---\n\nKarl Hasselström (5):\n      Use test_cmp instead of diff -u in the test suite\n      Get rid of backticks in test-lib.sh\n      Steal more test-lib.sh updates from git\n      Use hardcoded author and committer names in tests\n      If a patch is not changed when pushing, reuse the same commit object\n\n\n stgit/lib/transaction.py |   11 ++-\n t/t0002-status.sh        |   32 ++++----\n t/t1201-pull-trailing.sh |    2 \n t/t2700-refresh.sh       |   12 +--\n t/t2800-goto-subdir.sh   |    8 +-\n t/test-lib.sh            |  189 +++++++++++++++++++++++++++++++++++-----------\n 6 files changed, 179 insertions(+), 75 deletions(-)\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"74676","messageId":"20080417211247.12809.90469.stgit@yoghurt","threadId":"13158","inReplyTo":"20080417210137.12809.88457.stgit@yoghurt","subject":"[StGit PATCH 1/5] If a patch is not changed when pushing, reuse the same commit object","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2008-04-17T21:12:47Z","receivedAt":"2008-04-17T21:12:47Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"It should be marginally faster since we don't have to create a new\ncommit object, but mostly it's a cleanliness issue: rewriting history\nwhen we don't have to is bad.\n\nSigned-off-by: Karl Hasselström <kha@treskal.com>\n\n---\n\n stgit/lib/transaction.py |   11 ++++++++---\n 1 files changed, 8 insertions(+), 3 deletions(-)\n\n\ndiff --git a/stgit/lib/transaction.py b/stgit/lib/transaction.py\nindex 2946a67..1ece01e 100644\n--- a/stgit/lib/transaction.py\n+++ b/stgit/lib/transaction.py\n@@ -1,4 +1,5 @@\n from stgit import exception, utils\n+from stgit.utils import any, all\n from stgit.out import *\n from stgit.lib import git\n \n@@ -175,8 +176,8 @@ class StackTransaction(object):\n         \"\"\"Attempt to push the named patch. If this results in conflicts,\n         halts the transaction. If index+worktree are given, spill any\n         conflicts to them.\"\"\"\n-        cd = self.patches[pn].data\n-        cd = cd.set_committer(None)\n+        orig_cd = self.patches[pn].data\n+        cd = orig_cd.set_committer(None)\n         s = ['', ' (empty)'][cd.is_nochange()]\n         oldparent = cd.parent\n         cd = cd.set_parent(self.__head)\n@@ -204,7 +205,11 @@ class StackTransaction(object):\n             except git.MergeException, e:\n                 self.__halt(str(e))\n         cd = cd.set_tree(tree)\n-        self.patches[pn] = self.__stack.repository.commit(cd)\n+        if any(getattr(cd, a) != getattr(orig_cd, a) for a in\n+               ['parent', 'tree', 'author', 'message']):\n+            self.patches[pn] = self.__stack.repository.commit(cd)\n+        else:\n+            s = ' (unmodified)'\n         del self.unapplied[self.unapplied.index(pn)]\n         self.applied.append(pn)\n         out.info('Pushed %s%s' % (pn, s))\n"},{"id":"74674","messageId":"20080417211253.12809.71209.stgit@yoghurt","threadId":"13158","inReplyTo":"20080417210137.12809.88457.stgit@yoghurt","subject":"[StGit PATCH 2/5] Use hardcoded author and committer names in tests","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2008-04-17T21:12:53Z","receivedAt":"2008-04-17T21:12:53Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"There seems to be no reason for these to stay commented out -- in\nfact, commit v0.12-4-g5cd9e87 which introduced these lines seems to\nhave left them commented out by mistake.\n\nSigned-off-by: Karl Hasselström <kha@treskal.com>\n\n---\n\n t/test-lib.sh |    8 ++++----\n 1 files changed, 4 insertions(+), 4 deletions(-)\n\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 2d12f1b..5e4c7a1 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -20,11 +20,11 @@ unset COMMIT_AUTHOR_NAME\n unset EMAIL\n unset GIT_ALTERNATE_OBJECT_DIRECTORIES\n unset GIT_AUTHOR_DATE\n-#GIT_AUTHOR_EMAIL=author@example.com\n-#GIT_AUTHOR_NAME='A U Thor'\n+GIT_AUTHOR_EMAIL=author@example.com\n+GIT_AUTHOR_NAME='A U Thor'\n unset GIT_COMMITTER_DATE\n-#GIT_COMMITTER_EMAIL=committer@example.com\n-#GIT_COMMITTER_NAME='C O Mitter'\n+GIT_COMMITTER_EMAIL=committer@example.com\n+GIT_COMMITTER_NAME='C O Mitter'\n unset GIT_DIFF_OPTS\n unset GIT_DIR\n unset GIT_EXTERNAL_DIFF\n"},{"id":"74679","messageId":"20080417211258.12809.75008.stgit@yoghurt","threadId":"13158","inReplyTo":"20080417210137.12809.88457.stgit@yoghurt","subject":"[StGit PATCH 3/5] Steal more test-lib.sh updates from git","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2008-04-17T21:12:58Z","receivedAt":"2008-04-17T21:12:58Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"This patch incorporates the updates that were made to git's\ntest-lib.sh from revision v1.2.2-66-g6643688 up to revision\nv1.5.5-67-g9a49e00. A few manual adjustments had to be made -- for\nexample, the StGit tests assume that the repository starts out with an\ninitial commit, and there's no need to try to get hold of a git binary\nother than the one reachable via $PATH. And the test_must_fail helper\nfunction is not that useful to us, since a crashing Python program\nwon't kill the entire Python interpreter.\n\nThe main improvement is that the test script output is now in color!\n\nShortlog of the imported changes:\n\n  Alex Riesen (2):\n        Fix permissions on test scripts\n        Do no colorify test output if stdout is not a terminal\n\n  Christian Couder (1):\n        Trace into a file or an open fd and refactor tracing code.\n\n  Clemens Buchacher (1):\n        http-push: add regression tests\n\n  Eric Wong (3):\n        tests: Set EDITOR=: and VISUAL=: globally\n        test-lib: quiet down init-db output for tests\n        Update tests to use test-chmtime\n\n  Gerrit Pape (1):\n        Set $HOME for selftests\n\n  Jeff King (3):\n        fix config reading in tests\n        use build-time SHELL_PATH in test scripts\n        add test_cmp function for test scripts\n\n  Johannes Schindelin (2):\n        Introduce GIT_TEMPLATE_DIR\n        Make tests independent of global config files\n\n  Johannes Sixt (1):\n        test-lib.sh: A command dying due to a signal is an unexpected failure.\n\n  Josh Triplett (1):\n        Fall back to $EMAIL for missing GIT_AUTHOR_EMAIL and GIT_COMMITTER_EMAIL\n\n  Junio C Hamano (26):\n        Perl interface: make testsuite work again.\n        Perly Git: make sure we do test the freshly built one.\n        test-lib: unset GIT_TRACE\n        Merge branch 'ml/trace'\n        Merge branch 'master' into pb/gitpm\n        Deprecate merge-recursive.py\n        Merge branch 'jc/gitpm'\n        remove merge-recursive-old\n        fix testsuite: make sure they use templates freshly built from the source\n        Revert \"fix testsuite: make sure they use templates freshly built from the source\"\n        GIT_SKIP_TESTS: allow users to omit tests that are known to break\n        t5400 send-pack test: try a bit more nontrivial transfer.\n        Fix timestamp for test-tick\n        t/test-lib.sh: Protect ourselves from common misconfiguration\n        War on whitespace\n        Merge branch 'ei/worktree+filter'\n        Unset GIT_EDITOR while running tests.\n        Sane use of test_expect_failure\n        test: reword the final message of tests with known breakages\n        tests: introduce test_must_fail\n        Merge branch 'cb/http-test'\n        tests: introduce test_must_fail\n        test-lib: fix TERM to dumb for test repeatability\n        Merge branch 'maint'\n        Test: catch if trash cannot be removed\n        test_must_fail: 129 is a valid error code from usage()\n\n  Martin Waitz (1):\n        test-lib: separate individual test better in verbose mode.\n\n  Matthias Lederhofer (1):\n        introduce GIT_WORK_TREE to specify the work tree\n\n  Michele Ballabio (2):\n        test-lib.sh: move error line after error() declaration\n        Fix typo in a comment in t/test-lib.sh\n\n  Nicolas Pitre (1):\n        use 'init' instead of 'init-db' for shipped docs and tools\n\n  Petr Baudis (1):\n        Use $GITPERLLIB instead of $RUNNING_GIT_TESTS and centralize @INC munging\n\n  Pierre Habouzit (2):\n        Add some fancy colors in the test library when terminal supports it.\n        Support a --quiet option in the test-suite.\n\n  Robin Rosenberg (1):\n        Quote arguments to tr in test-lib\n\n  Shawn O. Pearce (1):\n        Default GIT_MERGE_VERBOSITY to 5 during tests.\n\nSigned-off-by: Karl Hasselström <kha@treskal.com>\n\n---\n\n t/test-lib.sh |  179 ++++++++++++++++++++++++++++++++++++++++++++-------------\n 1 files changed, 139 insertions(+), 40 deletions(-)\n\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 5e4c7a1..87c143a 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -4,14 +4,19 @@\n # Copyright (c) 2006 Yann Dirson - tuning for stgit\n #\n \n+# Keep the original TERM for say_color\n+ORIGINAL_TERM=$TERM\n+\n # For repeatability, reset the environment to known value.\n LANG=C\n LC_ALL=C\n PAGER=cat\n TZ=UTC\n-export LANG LC_ALL PAGER TZ\n+TERM=dumb\n+export LANG LC_ALL PAGER TERM TZ\n EDITOR=:\n VISUAL=:\n+unset GIT_EDITOR\n unset AUTHOR_DATE\n unset AUTHOR_EMAIL\n unset AUTHOR_NAME\n@@ -27,6 +32,7 @@ GIT_COMMITTER_EMAIL=committer@example.com\n GIT_COMMITTER_NAME='C O Mitter'\n unset GIT_DIFF_OPTS\n unset GIT_DIR\n+unset GIT_WORK_TREE\n unset GIT_EXTERNAL_DIFF\n unset GIT_INDEX_FILE\n unset GIT_OBJECT_DIRECTORY\n@@ -37,6 +43,7 @@ export GIT_MERGE_VERBOSITY\n export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME\n export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME\n export EDITOR VISUAL\n+GIT_TEST_CMP=${GIT_TEST_CMP:-diff -u}\n \n # Protect ourselves from common misconfiguration to export\n # CDPATH into the environment\n@@ -57,19 +64,15 @@ esac\n # This test checks if command xyzzy does the right thing...\n # '\n # . ./test-lib.sh\n-\n-error () {\n-\techo \"* error: $*\"\n-\ttrap - exit\n-\texit 1\n-}\n-\n-say () {\n-\techo \"* $*\"\n-}\n-\n-test \"${test_description}\" != \"\" ||\n-error \"Test script did not set test_description.\"\n+[ \"x$ORIGINAL_TERM\" != \"xdumb\" ] && (\n+\t\tTERM=$ORIGINAL_TERM &&\n+\t\texport TERM &&\n+\t\t[ -t 1 ] &&\n+\t\ttput bold >/dev/null 2>&1 &&\n+\t\ttput setaf 1 >/dev/null 2>&1 &&\n+\t\ttput sgr0 >/dev/null 2>&1\n+\t) &&\n+\tcolor=t\n \n while test \"$#\" -ne 0\n do\n@@ -79,16 +82,63 @@ do\n \t-i|--i|--im|--imm|--imme|--immed|--immedi|--immedia|--immediat|--immediate)\n \t\timmediate=t; shift ;;\n \t-h|--h|--he|--hel|--help)\n-\t\techo \"$test_description\"\n-\t\texit 0 ;;\n+\t\thelp=t; shift ;;\n \t-v|--v|--ve|--ver|--verb|--verbo|--verbos|--verbose)\n \t\texport STGIT_DEBUG_LEVEL=\"-1\"\n \t\tverbose=t; shift ;;\n+\t-q|--q|--qu|--qui|--quie|--quiet)\n+\t\tquiet=t; shift ;;\n+\t--no-color)\n+\t\tcolor=; shift ;;\n \t*)\n \t\tbreak ;;\n \tesac\n done\n \n+if test -n \"$color\"; then\n+\tsay_color () {\n+\t\t(\n+\t\tTERM=$ORIGINAL_TERM\n+\t\texport TERM\n+\t\tcase \"$1\" in\n+\t\t\terror) tput bold; tput setaf 1;; # bold red\n+\t\t\tskip)  tput bold; tput setaf 2;; # bold green\n+\t\t\tpass)  tput setaf 2;;            # green\n+\t\t\tinfo)  tput setaf 3;;            # brown\n+\t\t\t*) test -n \"$quiet\" && return;;\n+\t\tesac\n+\t\tshift\n+\t\techo \"* $*\"\n+\t\ttput sgr0\n+\t\t)\n+\t}\n+else\n+\tsay_color() {\n+\t\ttest -z \"$1\" && test -n \"$quiet\" && return\n+\t\tshift\n+\t\techo \"* $*\"\n+\t}\n+fi\n+\n+error () {\n+\tsay_color error \"error: $*\"\n+\ttrap - exit\n+\texit 1\n+}\n+\n+say () {\n+\tsay_color info \"$*\"\n+}\n+\n+test \"${test_description}\" != \"\" ||\n+error \"Test script did not set test_description.\"\n+\n+if test \"$help\" = \"t\"\n+then\n+\techo \"$test_description\"\n+\texit 0\n+fi\n+\n exec 5>&1\n if test \"$verbose\" = \"t\"\n then\n@@ -99,8 +149,15 @@ fi\n \n test_failure=0\n test_count=0\n+test_fixed=0\n+test_broken=0\n+\n+die () {\n+\techo >&5 \"FATAL: Unexpected exit with code $?\"\n+\texit 1\n+}\n \n-trap 'echo >&5 \"FATAL: Unexpected exit with code $?\"; exit 1' exit\n+trap 'die' exit\n \n test_tick () {\n \tif test -z \"${test_tick+set}\"\n@@ -119,18 +176,29 @@ test_tick () {\n \n test_ok_ () {\n \ttest_count=$(expr \"$test_count\" + 1)\n-\tsay \"  ok $test_count: $@\"\n+\tsay_color \"\" \"  ok $test_count: $@\"\n }\n \n test_failure_ () {\n \ttest_count=$(expr \"$test_count\" + 1)\n \ttest_failure=$(expr \"$test_failure\" + 1);\n-\tsay \"FAIL $test_count: $1\"\n+\tsay_color error \"FAIL $test_count: $1\"\n \tshift\n \techo \"$@\" | sed -e 's/^/\t/'\n \ttest \"$immediate\" = \"\" || { trap - exit; exit 1; }\n }\n \n+test_known_broken_ok_ () {\n+\ttest_count=$(expr \"$test_count\" + 1)\n+\ttest_fixed=$(($test_fixed+1))\n+\tsay_color \"\" \"  FIXED $test_count: $@\"\n+}\n+\n+test_known_broken_failure_ () {\n+\ttest_count=$(expr \"$test_count\" + 1)\n+\ttest_broken=$(($test_broken+1))\n+\tsay_color skip \"  still broken $test_count: $@\"\n+}\n \n test_debug () {\n \ttest \"$debug\" = \"\" || eval \"$1\"\n@@ -155,9 +223,9 @@ test_skip () {\n \tdone\n \tcase \"$to_skip\" in\n \tt)\n-\t\tsay >&3 \"skipping test: $@\"\n+\t\tsay_color skip >&3 \"skipping test: $@\"\n \t\ttest_count=$(expr \"$test_count\" + 1)\n-\t\tsay \"skip $test_count: $1\"\n+\t\tsay_color skip \"skip $test_count: $1\"\n \t\t: true\n \t\t;;\n \t*)\n@@ -171,13 +239,13 @@ test_expect_failure () {\n \terror \"bug in the test script: not 2 parameters to test-expect-failure\"\n \tif ! test_skip \"$@\"\n \tthen\n-\t\tsay >&3 \"expecting failure: $2\"\n+\t\tsay >&3 \"checking known breakage: $2\"\n \t\ttest_run_ \"$2\"\n-\t\tif [ \"$?\" = 0 -a \"$eval_ret\" != 0 -a \"$eval_ret\" -lt 129 ]\n+\t\tif [ \"$?\" = 0 -a \"$eval_ret\" = 0 ]\n \t\tthen\n-\t\t\ttest_ok_ \"$1\"\n+\t\t\ttest_known_broken_ok_ \"$1\"\n \t\telse\n-\t\t\ttest_failure_ \"$@\"\n+\t\t    test_known_broken_failure_ \"$1\"\n \t\tfi\n \tfi\n \techo >&3 \"\"\n@@ -217,7 +285,24 @@ test_expect_code () {\n \techo >&3 \"\"\n }\n \n-# Most tests can use the created repository, but some amy need to create more.\n+# test_cmp is a helper function to compare actual and expected output.\n+# You can use it like:\n+#\n+#\ttest_expect_success 'foo works' '\n+#\t\techo expected >expected &&\n+#\t\tfoo >actual &&\n+#\t\ttest_cmp expected actual\n+#\t'\n+#\n+# This could be written as either \"cmp\" or \"diff -u\", but:\n+# - cmp's output is not nearly as easy to read as diff -u\n+# - not all diff versions understand \"-u\"\n+\n+test_cmp() {\n+\t$GIT_TEST_CMP \"$@\"\n+}\n+\n+# Most tests can use the created repository, but some may need to create more.\n # Usage: test_create_repo <directory>\n test_create_repo () {\n \ttest \"$#\" = 1 ||\n@@ -226,17 +311,28 @@ test_create_repo () {\n \trepo=\"$1\"\n \tmkdir \"$repo\"\n \tcd \"$repo\" || error \"Cannot setup test environment\"\n-\tgit-init >/dev/null 2>&1 ||\n-\terror \"cannot run git-init -- have you installed git-core?\"\n-\tmkdir .git/info\n-\techo \"empty start\" |\n-\tgit-commit-tree `git-write-tree` >.git/refs/heads/master 2>&4 ||\n-\terror \"cannot run git-commit -- is your git-core functioning?\"\n+\tgit init >/dev/null 2>&1 || error \"cannot run git init\"\n+\techo \"empty start\" | \\\n+\t    git commit-tree `git write-tree` >.git/refs/heads/master 2>&4 || \\\n+\t    error \"cannot run git commit\"\n+\tmv .git/hooks .git/hooks-disabled\n \tcd \"$owd\"\n }\n \n test_done () {\n \ttrap - exit\n+\n+\tif test \"$test_fixed\" != 0\n+\tthen\n+\t\tsay_color pass \"fixed $test_fixed known breakage(s)\"\n+\tfi\n+\tif test \"$test_broken\" != 0\n+\tthen\n+\t\tsay_color error \"still have $test_broken known breakage(s)\"\n+\t\tmsg=\"remaining $(($test_count-$test_broken)) test(s)\"\n+\telse\n+\t\tmsg=\"$test_count test(s)\"\n+\tfi\n \tcase \"$test_failure\" in\n \t0)\n \t\t# We could:\n@@ -247,11 +343,11 @@ test_done () {\n \t\t# The Makefile provided will clean this test area so\n \t\t# we will leave things as they are.\n \n-\t\tsay \"passed all $test_count test(s)\"\n+\t\tsay_color pass \"passed all $msg\"\n \t\texit 0 ;;\n \n \t*)\n-\t\tsay \"failed $test_failure among $test_count test(s)\"\n+\t\tsay_color error \"failed $test_failure among $msg\"\n \t\texit 1 ;;\n \n \tesac\n@@ -261,14 +357,17 @@ test_done () {\n # t/ subdirectory and are run in trash subdirectory.\n PATH=$(pwd)/..:$PATH\n HOME=$(pwd)/trash\n-GIT_TEMPLATE_DIR=$(pwd)/../templates\n GIT_CONFIG=.git/config\n-export PATH HOME GIT_TEMPLATE_DIR GIT_CONFIG\n-\n+export PATH HOME GIT_CONFIG\n \n # Test repository\n test=trash\n-rm -fr \"$test\"\n+rm -fr \"$test\" || {\n+\ttrap - exit\n+\techo >&5 \"FATAL: Cannot prepare test area\"\n+\texit 1\n+}\n+\n test_create_repo $test\n cd \"$test\"\n \n@@ -285,8 +384,8 @@ do\n \tdone\n \tcase \"$to_skip\" in\n \tt)\n-\t\tsay >&3 \"skipping test $this_test altogether\"\n-\t\tsay \"skip all tests in $this_test\"\n+\t\tsay_color skip >&3 \"skipping test $this_test altogether\"\n+\t\tsay_color skip \"skip all tests in $this_test\"\n \t\ttest_done\n \tesac\n done\n"},{"id":"74677","messageId":"20080417211304.12809.55533.stgit@yoghurt","threadId":"13158","inReplyTo":"20080417210137.12809.88457.stgit@yoghurt","subject":"[StGit PATCH 4/5] Get rid of backticks in test-lib.sh","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2008-04-17T21:13:04Z","receivedAt":"2008-04-17T21:13:04Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"The $(...) notation is just plain nicer.\n\nSigned-off-by: Karl Hasselström <kha@treskal.com>\n\n---\n\n t/test-lib.sh |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 87c143a..95e322e 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -307,13 +307,13 @@ test_cmp() {\n test_create_repo () {\n \ttest \"$#\" = 1 ||\n \terror \"bug in the test script: not 1 parameter to test-create-repo\"\n-\towd=`pwd`\n+\towd=$(pwd)\n \trepo=\"$1\"\n \tmkdir \"$repo\"\n \tcd \"$repo\" || error \"Cannot setup test environment\"\n \tgit init >/dev/null 2>&1 || error \"cannot run git init\"\n \techo \"empty start\" | \\\n-\t    git commit-tree `git write-tree` >.git/refs/heads/master 2>&4 || \\\n+\t    git commit-tree $(git write-tree) >.git/refs/heads/master 2>&4 || \\\n \t    error \"cannot run git commit\"\n \tmv .git/hooks .git/hooks-disabled\n \tcd \"$owd\"\n"},{"id":"74675","messageId":"20080417211310.12809.2112.stgit@yoghurt","threadId":"13158","inReplyTo":"20080417210137.12809.88457.stgit@yoghurt","subject":"[StGit PATCH 5/5] Use test_cmp instead of diff -u in the test suite","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2008-04-17T21:13:10Z","receivedAt":"2008-04-17T21:13:10Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"Since diff -u isn't available everywhere, and the user might want to\nuse something else.\n\nSigned-off-by: Karl Hasselström <kha@treskal.com>\n\n---\n\n t/t0002-status.sh        |   32 ++++++++++++++++----------------\n t/t1201-pull-trailing.sh |    2 +-\n t/t2700-refresh.sh       |   12 ++++++------\n t/t2800-goto-subdir.sh   |    8 ++++----\n 4 files changed, 27 insertions(+), 27 deletions(-)\n\n\ndiff --git a/t/t0002-status.sh b/t/t0002-status.sh\nindex 0a70f15..4364709 100755\n--- a/t/t0002-status.sh\n+++ b/t/t0002-status.sh\n@@ -20,7 +20,7 @@ cat > expected.txt <<EOF\n EOF\n test_expect_success 'Run status on empty' '\n     stg status > output.txt &&\n-    diff -u expected.txt output.txt\n+    test_cmp expected.txt output.txt\n '\n \n cat > expected.txt <<EOF\n@@ -29,7 +29,7 @@ EOF\n test_expect_success 'Status with an untracked file' '\n     touch foo &&\n     stg status > output.txt &&\n-    diff -u expected.txt output.txt\n+    test_cmp expected.txt output.txt\n '\n rm -f foo\n \n@@ -38,7 +38,7 @@ EOF\n test_expect_success 'Status with an empty directory' '\n     mkdir foo &&\n     stg status > output.txt &&\n-    diff -u expected.txt output.txt\n+    test_cmp expected.txt output.txt\n '\n \n cat > expected.txt <<EOF\n@@ -47,7 +47,7 @@ EOF\n test_expect_success 'Status with an untracked file in a subdir' '\n     touch foo/bar &&\n     stg status > output.txt &&\n-    diff -u expected.txt output.txt\n+    test_cmp expected.txt output.txt\n '\n \n cat > expected.txt <<EOF\n@@ -56,7 +56,7 @@ EOF\n test_expect_success 'Status with an added file' '\n     git add foo &&\n     stg status > output.txt &&\n-    diff -u expected.txt output.txt\n+    test_cmp expected.txt output.txt\n '\n \n cat > expected.txt <<EOF\n@@ -64,7 +64,7 @@ foo/bar\n EOF\n test_expect_success 'Status with an added file and -n option' '\n     stg status -n > output.txt &&\n-    diff -u expected.txt output.txt\n+    test_cmp expected.txt output.txt\n '\n \n cat > expected.txt <<EOF\n@@ -73,7 +73,7 @@ test_expect_success 'Status after refresh' '\n     stg new -m \"first patch\" &&\n     stg refresh &&\n     stg status > output.txt &&\n-    diff -u expected.txt output.txt\n+    test_cmp expected.txt output.txt\n '\n \n cat > expected.txt <<EOF\n@@ -82,7 +82,7 @@ EOF\n test_expect_success 'Status after modification' '\n     echo \"wee\" >> foo/bar &&\n     stg status > output.txt &&\n-    diff -u expected.txt output.txt\n+    test_cmp expected.txt output.txt\n '\n \n cat > expected.txt <<EOF\n@@ -90,7 +90,7 @@ EOF\n test_expect_success 'Status after refresh' '\n     stg new -m \"second patch\" && stg refresh &&\n     stg status > output.txt &&\n-    diff -u expected.txt output.txt\n+    test_cmp expected.txt output.txt\n '\n \n test_expect_success 'Add another file' '\n@@ -116,7 +116,7 @@ EOF\n test_expect_success 'Status after conflicting push' '\n     ! stg push &&\n     stg status > output.txt &&\n-    diff -u expected.txt output.txt\n+    test_cmp expected.txt output.txt\n '\n \n cat > expected.txt <<EOF\n@@ -124,7 +124,7 @@ C foo/bar\n EOF\n test_expect_success 'Status of file' '\n     stg status foo/bar > output.txt &&\n-    diff -u expected.txt output.txt\n+    test_cmp expected.txt output.txt\n '\n \n cat > expected.txt <<EOF\n@@ -132,7 +132,7 @@ C foo/bar\n EOF\n test_expect_success 'Status of dir' '\n     stg status foo > output.txt &&\n-    diff -u expected.txt output.txt\n+    test_cmp expected.txt output.txt\n '\n \n cat > expected.txt <<EOF\n@@ -140,7 +140,7 @@ A fie\n EOF\n test_expect_success 'Status of other file' '\n     stg status fie > output.txt &&\n-    diff -u expected.txt output.txt\n+    test_cmp expected.txt output.txt\n '\n \n cat > expected.txt <<EOF\n@@ -150,7 +150,7 @@ EOF\n test_expect_success 'Status after resolving the push' '\n     stg resolved -a &&\n     stg status > output.txt &&\n-    diff -u expected.txt output.txt\n+    test_cmp expected.txt output.txt\n '\n \n cat > expected.txt <<EOF\n@@ -160,7 +160,7 @@ EOF\n test_expect_success 'Status after deleting a file' '\n     rm foo/bar &&\n     stg status > output.txt &&\n-    diff -u expected.txt output.txt\n+    test_cmp expected.txt output.txt\n '\n \n cat > expected.txt <<EOF\n@@ -172,7 +172,7 @@ test_expect_success 'Status of disappeared newborn' '\n     git add foo/bar &&\n     rm foo/bar &&\n     stg status > output.txt &&\n-    diff -u expected.txt output.txt\n+    test_cmp expected.txt output.txt\n '\n \n test_done\ndiff --git a/t/t1201-pull-trailing.sh b/t/t1201-pull-trailing.sh\nindex 46d9f82..9d70fe0 100755\n--- a/t/t1201-pull-trailing.sh\n+++ b/t/t1201-pull-trailing.sh\n@@ -55,7 +55,7 @@ test_expect_success \\\n \n test_expect_success \\\n     'Check that all went well' \\\n-    \"diff -u foo/file bar/file\n+    \"test_cmp foo/file bar/file\n \"\n \n test_done\ndiff --git a/t/t2700-refresh.sh b/t/t2700-refresh.sh\nindex 9eae85d..3759d0e 100755\n--- a/t/t2700-refresh.sh\n+++ b/t/t2700-refresh.sh\n@@ -33,7 +33,7 @@ test_expect_success 'Refresh top patch' '\n     stg status &&\n     test -z \"$(stg status)\" &&\n     stg patches foo3.txt > patches.txt &&\n-    diff -u expected.txt patches.txt\n+    test_cmp expected.txt patches.txt\n '\n \n cat > expected.txt <<EOF\n@@ -47,7 +47,7 @@ test_expect_success 'Refresh middle patch' '\n     stg status &&\n     test -z \"$(stg status)\" &&\n     stg patches foo2.txt > patches.txt &&\n-    diff -u expected.txt patches.txt\n+    test_cmp expected.txt patches.txt\n '\n \n cat > expected.txt <<EOF\n@@ -61,7 +61,7 @@ test_expect_success 'Refresh bottom patch' '\n     stg status &&\n     test -z \"$(stg status)\" &&\n     stg patches foo1.txt > patches.txt &&\n-    diff -u expected.txt patches.txt\n+    test_cmp expected.txt patches.txt\n '\n \n cat > expected.txt <<EOF\n@@ -111,9 +111,9 @@ test_expect_success 'Refresh --index' '\n     stg patches foo1.txt > patches.txt &&\n     git diff HEAD^..HEAD > show.txt &&\n     stg diff > diff.txt &&\n-    diff -u expected.txt patches.txt &&\n-    diff -u expected2.txt show.txt &&\n-    diff -u expected3.txt diff.txt &&\n+    test_cmp expected.txt patches.txt &&\n+    test_cmp expected2.txt show.txt &&\n+    test_cmp expected3.txt diff.txt &&\n     stg new p5 -m \"cleanup again\" &&\n     stg refresh\n '\ndiff --git a/t/t2800-goto-subdir.sh b/t/t2800-goto-subdir.sh\nindex fcad7da..28b8292 100755\n--- a/t/t2800-goto-subdir.sh\n+++ b/t/t2800-goto-subdir.sh\n@@ -27,9 +27,9 @@ EOF\n test_expect_success 'Goto in subdirectory (just pop)' '\n     (cd foo && stg goto p1) &&\n     cat foo/bar > actual.txt &&\n-    diff -u expected1.txt actual.txt &&\n+    test_cmp expected1.txt actual.txt &&\n     ls foo > actual.txt &&\n-    diff -u expected2.txt actual.txt\n+    test_cmp expected2.txt actual.txt\n '\n \n test_expect_success 'Prepare conflicting goto' '\n@@ -51,9 +51,9 @@ test_expect_success 'Goto in subdirectory (conflicting push)' '\n     (cd foo && stg goto p3) ;\n     [ $? -eq 3 ] &&\n     cat foo/bar > actual.txt &&\n-    diff -u expected1.txt actual.txt &&\n+    test_cmp expected1.txt actual.txt &&\n     ls foo > actual.txt &&\n-    diff -u expected2.txt actual.txt\n+    test_cmp expected2.txt actual.txt\n '\n \n test_done\n"},{"id":"74678","messageId":"20080417211433.GA13398@diana.vm.bytemark.co.uk","threadId":"13158","inReplyTo":"20080417210137.12809.88457.stgit@yoghurt","subject":"Re: [StGit PATCH 0/5] test suite update","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2008-04-17T21:14:33Z","receivedAt":"2008-04-17T21:14:33Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2008-04-17 23:12:40 +0200, Karl Hasselström wrote:\n\n>       If a patch is not changed when pushing, reuse the same commit\n>       object\n\nDuh. This patch got included in this series by mistake. It doesn't\nreally belong there.\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"}]}