From: Clemens Buchacher <drizzd@aon.at>
To: git@vger.kernel.org
Cc: gitster@pobox.com, Clemens Buchacher <drizzd@aon.at>
Subject: [PATCH 1/3] add rebase patch id tests
Date: Sun, 19 Sep 2010 11:59:27 +0200 [thread overview]
Message-ID: <1284890369-4136-2-git-send-email-drizzd@aon.at> (raw)
In-Reply-To: <1284890369-4136-1-git-send-email-drizzd@aon.at>
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
---
t/t3419-rebase-patch-id.sh | 109 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 109 insertions(+), 0 deletions(-)
create mode 100755 t/t3419-rebase-patch-id.sh
diff --git a/t/t3419-rebase-patch-id.sh b/t/t3419-rebase-patch-id.sh
new file mode 100755
index 0000000..1aee483
--- /dev/null
+++ b/t/t3419-rebase-patch-id.sh
@@ -0,0 +1,109 @@
+#!/bin/bash
+
+test_description='git rebase - test patch id computation'
+
+. ./test-lib.sh
+
+test_set_prereq NOT_EXPENSIVE
+test -n "$GIT_PATCHID_TIMING_TESTS" && test_set_prereq EXPENSIVE
+test -x /usr/bin/time && test_set_prereq USR_BIN_TIME
+
+count()
+{
+ i=0
+ while test $i -lt $1
+ do
+ echo "$i"
+ i=$(($i+1))
+ done
+}
+
+scramble()
+{
+ i=0
+ while read x
+ do
+ if test $i -ne 0
+ then
+ echo "$x"
+ fi
+ i=$(((i+1) % 10))
+ done < "$1" > "$1.new"
+ mv -f "$1.new" "$1"
+}
+
+run()
+{
+ echo \$ "$@"
+ /usr/bin/time "$@" >/dev/null
+}
+
+test_expect_success 'setup' '
+ git commit --allow-empty -m initial
+ git tag root
+'
+
+do_tests()
+{
+ pr=$1
+ nlines=$2
+
+ test_expect_success $pr "setup: $nlines lines" "
+ rm -f .gitattributes &&
+ git checkout -q -f master &&
+ git reset --hard root &&
+ count $nlines >file &&
+ git add file &&
+ git commit -q -m initial &&
+ git branch -f other &&
+
+ scramble file &&
+ git add file &&
+ git commit -q -m 'change big file' &&
+
+ git checkout -q other &&
+ : >newfile &&
+ git add newfile &&
+ git commit -q -m 'add small file' &&
+
+ git cherry-pick master >/dev/null 2>&1
+ "
+
+ test_debug "
+ run git diff master^\!
+ "
+
+ test_expect_success $pr 'setup attributes' "
+ echo 'file binary' >.gitattributes
+ "
+
+ test_debug "
+ run git format-patch --stdout master &&
+ run git format-patch --stdout --ignore-if-in-upstream master
+ "
+
+ test_expect_success $pr 'detect upstream patch' "
+ git checkout -q master &&
+ scramble file &&
+ git add file &&
+ git commit -q -m 'change big file again' &&
+ git checkout -q other^{} &&
+ git rebase master &&
+ test_must_fail test -n \"\$(git rev-list master...HEAD~)\"
+ "
+
+ test_expect_success $pr 'do not drop patch' "
+ git branch -f squashed master &&
+ git checkout -q -f squashed &&
+ git reset -q --soft HEAD~2 &&
+ git commit -q -m squashed &&
+ git checkout -q other^{} &&
+ test_must_fail git rebase squashed &&
+ rm -rf .git/rebase-apply
+ "
+}
+
+do_tests NOT_EXPENSIVE 500
+do_tests EXPENSIVE 50000
+
+test_done
--
1.7.1.571.gba4d01
next prev parent reply other threads:[~2010-09-19 9:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-19 9:59 Patch id tests and diff performance optimization Clemens Buchacher
2010-09-19 9:59 ` Clemens Buchacher [this message]
2010-09-19 9:59 ` [PATCH 2/3] do not search functions for patch ID Clemens Buchacher
2010-09-19 9:59 ` [PATCH 3/3] use cache for function names in hunk headers Clemens Buchacher
2010-09-19 20:24 ` Sverre Rabbelier
2010-09-20 17:36 ` Clemens Buchacher
2010-09-20 19:15 ` Sverre Rabbelier
2010-09-23 7:04 ` [PATCH 3/3 v2] " Clemens Buchacher
2010-09-26 16:26 ` René Scharfe
2010-09-26 20:43 ` Clemens Buchacher
2010-09-26 22:17 ` René Scharfe
2010-09-27 17:52 ` Junio C Hamano
2010-09-30 18:33 ` 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=1284890369-4136-2-git-send-email-drizzd@aon.at \
--to=drizzd@aon.at \
--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;
as well as URLs for NNTP newsgroup(s).