{"thread":{"id":"21743","subject":"[PATCH] t1200: fix a timing dependent error","startedAt":"2009-11-24T23:08:08Z","lastAt":"2009-11-25T01:14:33Z","messageCount":2,"participants":["Nanako Shiraishi","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"128266","messageId":"20091125080808.6117@nanako3.lavabit.com","threadId":"21743","inReplyTo":null,"subject":"[PATCH] t1200: fix a timing dependent error","fromName":"Nanako Shiraishi","fromEmail":"nanako3@lavabit.com","sentAt":"2009-11-24T23:08:08Z","receivedAt":"2009-11-24T23:08:08Z","isPatch":true,"sender":{"key":"nanako3@lavabit.com","avatar":"https://gravatar.com/avatar/3777b9e201c5883a62b1a6fdf7c53f2d712d1d80989146063ea861e33aad72a8?d=mp&s=160"},"body":"The fourth test of show-branch in t1200 test was failing but only \nsometimes. It only failed when two commits created in an earlier\ntest had different timestamps. When they were created within the\nsame second, the actual output matched the expected output.\n\nFix this by using test_tick to force reliable timestamps and update\nthe expected output so it does not to depend on the commits made in\nthe same sacond.\n\nSigned-off-by: Nanako Shiraishi <nanako3@lavabit.com>\n---\n\ndiff --git a/Documentation/gitcore-tutorial.txt b/Documentation/gitcore-tutorial.txt\nindex b7380b0..e237394 100644\n--- a/Documentation/gitcore-tutorial.txt\n+++ b/Documentation/gitcore-tutorial.txt\n@@ -1186,9 +1186,9 @@ $ git show-branch\n * [master] Some fun.\n  ! [mybranch] Some work.\n --\n- + [mybranch] Some work.\n *  [master] Some fun.\n-*+ [mybranch^] Initial commit\n+ + [mybranch] Some work.\n+*+ [master^] Initial commit\n ------------\n \n Now we are ready to experiment with the merge by hand.\ndiff --git a/t/t1200-tutorial.sh b/t/t1200-tutorial.sh\nindex 6bf8475..238c2f1 100755\n--- a/t/t1200-tutorial.sh\n+++ b/t/t1200-tutorial.sh\n@@ -47,7 +47,8 @@ test_expect_success 'tree' '\n '\n \n test_expect_success 'git diff-index -p HEAD' '\n-\ttree=$(git write-tree)\n+\ttest_tick &&\n+\ttree=$(git write-tree) &&\n \tcommit=$(echo \"Initial commit\" | git commit-tree $tree) &&\n \tgit update-ref HEAD $commit &&\n \tgit diff-index -p HEAD > diff.output &&\n@@ -113,12 +114,14 @@ test_expect_success 'git branch' '\n test_expect_success 'git resolve now fails' '\n \tgit checkout mybranch &&\n \techo \"Work, work, work\" >>hello &&\n+\ttest_tick &&\n \tgit commit -m \"Some work.\" -i hello &&\n \n \tgit checkout master &&\n \n \techo \"Play, play, play\" >>hello &&\n \techo \"Lots of fun\" >>example &&\n+\ttest_tick &&\n \tgit commit -m \"Some fun.\" -i hello example &&\n \n \ttest_must_fail git merge -m \"Merge work in mybranch\" mybranch\n@@ -141,6 +144,7 @@ cat > show-branch.expect << EOF\n EOF\n \n test_expect_success 'git show-branch' '\n+\ttest_tick &&\n \tgit commit -m \"Merge work in mybranch\" -i hello &&\n \tgit show-branch --topo-order --more=1 master mybranch \\\n \t\t> show-branch.output &&\n@@ -201,9 +205,9 @@ cat > show-branch4.expect << EOF\n * [master] Some fun.\n  ! [mybranch] Some work.\n --\n- + [mybranch] Some work.\n *  [master] Some fun.\n-*+ [mybranch^] Initial commit\n+ + [mybranch] Some work.\n+*+ [master^] Initial commit\n EOF\n \n test_expect_success 'git show-branch (part 4)' '\n\n\n-- \nNanako Shiraishi\nhttp://ivory.ap.teacup.com/nanako3/\n"},{"id":"128275","messageId":"7v7htf76di.fsf@alter.siamese.dyndns.org","threadId":"21743","inReplyTo":"20091125080808.6117@nanako3.lavabit.com","subject":"Re: [PATCH] t1200: fix a timing dependent error","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-11-25T01:14:33Z","receivedAt":"2009-11-25T01:14:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nanako Shiraishi <nanako3@lavabit.com> writes:\n\n> The fourth test of show-branch in t1200 test was failing but only \n> sometimes. It only failed when two commits created in an earlier\n> test had different timestamps. When they were created within the\n> same second, the actual output matched the expected output.\n\nAhh, I actually saw this breakage once, suspected it would be something\nlike that, but didn't have enough energy/time to dig into it myself.\n\nThanks.\n"}]}