{"thread":{"id":"17324","subject":"[PATCH 5/7] replace_object: add a test case","startedAt":"2009-01-23T09:07:18Z","lastAt":"2009-01-23T09:07:18Z","messageCount":1,"participants":["Christian Couder"],"isPatch":true,"patchVersion":1,"patchTotal":7},"messages":[{"id":"101641","messageId":"20090123100718.b6613f76.chriscool@tuxfamily.org","threadId":"17324","inReplyTo":null,"subject":"[PATCH 5/7] replace_object: add a test case","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2009-01-23T09:07:18Z","receivedAt":"2009-01-23T09:07:18Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"In this patch the setup code is very big, but this will be used in\ntest cases that will be added later.\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n t/t6050-replace.sh |   75 ++++++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 75 insertions(+), 0 deletions(-)\n create mode 100755 t/t6050-replace.sh\n\ndiff --git a/t/t6050-replace.sh b/t/t6050-replace.sh\nnew file mode 100755\nindex 0000000..0a585ec\n--- /dev/null\n+++ b/t/t6050-replace.sh\n@@ -0,0 +1,75 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2008 Christian Couder\n+#\n+test_description='Tests replace refs 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+HASH7=\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+     echo \"line 14\" >> hello &&\n+     echo \"line 15\" >> hello &&\n+     echo \"line 16\" >> hello &&\n+     add_and_commit_file hello \"again 3 more lines\" &&\n+     HASH7=$(git rev-parse --verify HEAD)\n+'\n+\n+test_expect_success 'replace the author' '\n+     git cat-file commit $HASH2 | grep \"author A U Thor\" &&\n+     R=$(git cat-file commit $HASH2 | sed -e \"s/A U/O/\" | git hash-object -t commit --stdin -w) &&\n+     git cat-file commit $R | grep \"author O Thor\" &&\n+     git update-ref refs/replace/$HASH2 $R &&\n+     git show HEAD~5 | grep \"O Thor\" &&\n+     git show $HASH2 | grep \"O Thor\"\n+'\n+\n+#\n+#\n+test_done\n-- \n1.6.1.231.g9c286\n"}]}