| 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='Tests rebase performance' |
| 4 | . ./perf-lib.sh |
| 5 | |
| 6 | test_perf_default_repo |
| 7 | |
| 8 | test_expect_success 'setup rebasing on top of a lot of changes' ' |
| 9 | git checkout -f -B base && |
| 10 | git checkout -B to-rebase && |
| 11 | git checkout -B upstream && |
| 12 | test_seq 1000 >content_fwd && |
| 13 | sort -nr content_fwd >content_rev && |
| 14 | ( |
| 15 | for i in $(test_seq 100) |
| 16 | do |
| 17 | test_tick && |
| 18 | echo "commit refs/heads/upstream" && |
| 19 | echo "committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE" && |
| 20 | echo "data <<EOF" && |
| 21 | echo "commit$i" && |
| 22 | echo "EOF" && |
| 23 | |
| 24 | if test "$i" = 1; then |
| 25 | echo "from refs/heads/upstream^0" |
| 26 | fi && |
| 27 | |
| 28 | echo "M 100644 inline unrelated-file$i" && |
| 29 | echo "data <<EOF" && |
| 30 | echo "change$i" && |
| 31 | cat content_fwd && |
| 32 | echo "EOF" && |
| 33 | |
| 34 | echo "commit refs/heads/upstream" && |
| 35 | echo "committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE" && |
| 36 | echo "data <<EOF" && |
| 37 | echo "commit$i-reverse" && |
| 38 | echo "EOF" && |
| 39 | echo "M 100644 inline unrelated-file$i" && |
| 40 | echo "data <<EOF" && |
| 41 | echo "change$i" && |
| 42 | cat content_rev && |
| 43 | echo "EOF" || exit 1 |
| 44 | done |
| 45 | ) >fast_import_stream && |
| 46 | |
| 47 | git fast-import <fast_import_stream && |
| 48 | git repack -a -d && |
| 49 | git checkout -f upstream && |
| 50 | git checkout to-rebase && |
| 51 | test_commit our-patch interesting-file |
| 52 | ' |
| 53 | |
| 54 | test_perf 'rebase on top of a lot of unrelated changes' ' |
| 55 | git rebase --onto upstream HEAD^ && |
| 56 | git rebase --onto base HEAD^ |
| 57 | ' |
| 58 | |
| 59 | test_expect_success 'setup rebasing many changes without split-index' ' |
| 60 | git config core.splitIndex false && |
| 61 | git checkout -B upstream2 to-rebase && |
| 62 | git checkout -B to-rebase2 upstream |
| 63 | ' |
| 64 | |
| 65 | test_perf 'rebase a lot of unrelated changes without split-index' ' |
| 66 | git rebase --onto upstream2 base && |
| 67 | git rebase --onto base upstream2 |
| 68 | ' |
| 69 | |
| 70 | test_expect_success 'setup rebasing many changes with split-index' ' |
| 71 | git config core.splitIndex true |
| 72 | ' |
| 73 | |
| 74 | test_perf 'rebase a lot of unrelated changes with split-index' ' |
| 75 | git rebase --onto upstream2 base && |
| 76 | git rebase --onto base upstream2 |
| 77 | ' |
| 78 | |
| 79 | test_done |