Git development
 help / color / mirror / Atom feed
From: Nanako Shiraishi <nanako3@lavabit.com>
To: git@vger.kernel.org
Cc: Stephen Boyd <bebarino@gmail.com>, Junio C Hamano <gitster@pobox.com>
Subject: [PATCH] t1200: fix a timing dependent error
Date: Wed, 25 Nov 2009 08:08:08 +0900	[thread overview]
Message-ID: <20091125080808.6117@nanako3.lavabit.com> (raw)

The fourth test of show-branch in t1200 test was failing but only 
sometimes. It only failed when two commits created in an earlier
test had different timestamps. When they were created within the
same second, the actual output matched the expected output.

Fix this by using test_tick to force reliable timestamps and update
the expected output so it does not to depend on the commits made in
the same sacond.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
---

diff --git a/Documentation/gitcore-tutorial.txt b/Documentation/gitcore-tutorial.txt
index b7380b0..e237394 100644
--- a/Documentation/gitcore-tutorial.txt
+++ b/Documentation/gitcore-tutorial.txt
@@ -1186,9 +1186,9 @@ $ git show-branch
 * [master] Some fun.
  ! [mybranch] Some work.
 --
- + [mybranch] Some work.
 *  [master] Some fun.
-*+ [mybranch^] Initial commit
+ + [mybranch] Some work.
+*+ [master^] Initial commit
 ------------
 
 Now we are ready to experiment with the merge by hand.
diff --git a/t/t1200-tutorial.sh b/t/t1200-tutorial.sh
index 6bf8475..238c2f1 100755
--- a/t/t1200-tutorial.sh
+++ b/t/t1200-tutorial.sh
@@ -47,7 +47,8 @@ test_expect_success 'tree' '
 '
 
 test_expect_success 'git diff-index -p HEAD' '
-	tree=$(git write-tree)
+	test_tick &&
+	tree=$(git write-tree) &&
 	commit=$(echo "Initial commit" | git commit-tree $tree) &&
 	git update-ref HEAD $commit &&
 	git diff-index -p HEAD > diff.output &&
@@ -113,12 +114,14 @@ test_expect_success 'git branch' '
 test_expect_success 'git resolve now fails' '
 	git checkout mybranch &&
 	echo "Work, work, work" >>hello &&
+	test_tick &&
 	git commit -m "Some work." -i hello &&
 
 	git checkout master &&
 
 	echo "Play, play, play" >>hello &&
 	echo "Lots of fun" >>example &&
+	test_tick &&
 	git commit -m "Some fun." -i hello example &&
 
 	test_must_fail git merge -m "Merge work in mybranch" mybranch
@@ -141,6 +144,7 @@ cat > show-branch.expect << EOF
 EOF
 
 test_expect_success 'git show-branch' '
+	test_tick &&
 	git commit -m "Merge work in mybranch" -i hello &&
 	git show-branch --topo-order --more=1 master mybranch \
 		> show-branch.output &&
@@ -201,9 +205,9 @@ cat > show-branch4.expect << EOF
 * [master] Some fun.
  ! [mybranch] Some work.
 --
- + [mybranch] Some work.
 *  [master] Some fun.
-*+ [mybranch^] Initial commit
+ + [mybranch] Some work.
+*+ [master^] Initial commit
 EOF
 
 test_expect_success 'git show-branch (part 4)' '


-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/

             reply	other threads:[~2009-11-24 23:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-24 23:08 Nanako Shiraishi [this message]
2009-11-25  1:14 ` [PATCH] t1200: fix a timing dependent error Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091125080808.6117@nanako3.lavabit.com \
    --to=nanako3@lavabit.com \
    --cc=bebarino@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox