{"thread":{"id":"16127","subject":"[RFC/PATCH 2/2] bisect: add test case for \"git bisect replace\"","startedAt":"2008-11-02T01:20:16Z","lastAt":"2008-11-02T01:20:16Z","messageCount":1,"participants":["Christian Couder"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"94612","messageId":"20081102022016.99b7771e.chriscool@tuxfamily.org","threadId":"16127","inReplyTo":null,"subject":"[RFC/PATCH 2/2] bisect: add test case for \"git bisect replace\"","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2008-11-02T01:20:16Z","receivedAt":"2008-11-02T01:20:16Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"---\n t/t6035-bisect-replace.sh |   89 +++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 89 insertions(+), 0 deletions(-)\n create mode 100755 t/t6035-bisect-replace.sh\n\ndiff --git a/t/t6035-bisect-replace.sh b/t/t6035-bisect-replace.sh\nnew file mode 100755\nindex 0000000..ed2061e\n--- /dev/null\n+++ b/t/t6035-bisect-replace.sh\n@@ -0,0 +1,89 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2008 Christian Couder\n+#\n+test_description='Test git bisect replace functionality'\n+\n+exec </dev/null\n+\n+. ./test-lib.sh\n+\n+add_and_commit_file()\n+{\n+    _file=\"$1\"\n+    _msg=\"$2\"\n+\n+    git add $_file || return $?\n+    test_tick || return $?\n+    git commit --quiet -m \"$_file: $_msg\"\n+}\n+\n+HASH1=\n+HASH2=\n+HASH3=\n+HASH4=\n+HASH5=\n+HASH6=\n+\n+test_expect_success 'set up buggy branch' '\n+     echo \"line 1\" >> hello &&\n+     echo \"line 2\" >> hello &&\n+     echo \"line 3\" >> hello &&\n+     echo \"line 4\" >> hello &&\n+     add_and_commit_file hello \"4 lines\" &&\n+     HASH1=$(git rev-parse --verify HEAD) &&\n+     echo \"line BUG\" >> hello &&\n+     echo \"line 6\" >> hello &&\n+     echo \"line 7\" >> hello &&\n+     echo \"line 8\" >> hello &&\n+     add_and_commit_file hello \"4 more lines with a BUG\" &&\n+     HASH2=$(git rev-parse --verify HEAD) &&\n+     echo \"line 9\" >> hello &&\n+     echo \"line 10\" >> hello &&\n+     add_and_commit_file hello \"2 more lines\" &&\n+     HASH3=$(git rev-parse --verify HEAD) &&\n+     echo \"line 11\" >> hello &&\n+     add_and_commit_file hello \"1 more line\" &&\n+     HASH4=$(git rev-parse --verify HEAD) &&\n+     sed -e \"s/BUG/5/\" hello > hello.new &&\n+     mv hello.new hello &&\n+     add_and_commit_file hello \"BUG fixed\" &&\n+     HASH5=$(git rev-parse --verify HEAD) &&\n+     echo \"line 12\" >> hello &&\n+     echo \"line 13\" >> hello &&\n+     add_and_commit_file hello \"2 more lines\" &&\n+     HASH6=$(git rev-parse --verify HEAD)\n+'\n+\n+HASHFIX2=\n+HASHFIX3=\n+HASHFIX4=\n+\n+test_expect_success 'set up fixed branch' '\n+     git checkout $HASH1 &&\n+     echo \"line 5\" >> hello &&\n+     echo \"line 6\" >> hello &&\n+     echo \"line 7\" >> hello &&\n+     echo \"line 8\" >> hello &&\n+     add_and_commit_file hello \"4 more lines with no BUG\" &&\n+     HASHFIX2=$(git rev-parse --verify HEAD) &&\n+     git cherry-pick $HASH3 &&\n+     HASHFIX3=$(git rev-parse --verify HEAD) &&\n+     git cherry-pick $HASH4 &&\n+     HASHFIX4=$(git rev-parse --verify HEAD)\n+'\n+\n+test_expect_success '\"git bisect replace\" buggy branch with fixed one' '\n+     git bisect replace $HASH5 HEAD &&\n+     git rev-list --bisect-all $HASH6 > rev_list.txt &&\n+     grep $HASHFIX2 rev_list.txt &&\n+     grep $HASHFIX3 rev_list.txt &&\n+     grep $HASHFIX4 rev_list.txt &&\n+     test_must_fail grep $HASH2 rev_list.txt &&\n+     test_must_fail grep $HASH3 rev_list.txt &&\n+     test_must_fail grep $HASH4 rev_list.txt\n+'\n+\n+#\n+#\n+test_done\n-- \n1.6.0.3.531.gd12eb.dirty\n"}]}