提交 7b02771b 编写于 作者: J Junio C Hamano

Merge branch 'js/perf-rebase-i'

Add perf test for "rebase -i"

* js/perf-rebase-i:
  perf: run "rebase -i" under perf
  perf: make the tests work in worktrees
  perf: let's disable symlinks when they are not available
#!/bin/sh
test_description='Tests rebase -i performance'
. ./perf-lib.sh
test_perf_default_repo
# This commit merges a sufficiently long topic branch for reasonable
# performance testing
branch_merge=ba5312da19c6fdb6c6747d479f58932aae6e900c^{commit}
export branch_merge
git rev-parse --verify $branch_merge >/dev/null 2>&1 || {
skip_all='skipping because $branch_merge was not found'
test_done
}
write_script swap-first-two.sh <<\EOF
case "$1" in
*/COMMIT_EDITMSG)
mv "$1" "$1".bak &&
sed -e '1{h;d}' -e 2G <"$1".bak >"$1"
;;
esac
EOF
test_expect_success 'setup' '
git config core.editor "\"$PWD"/swap-first-two.sh\" &&
git checkout -f $branch_merge^2
'
test_perf 'rebase -i' '
git rebase -i $branch_merge^
'
test_done
......@@ -80,23 +80,26 @@ test_perf_create_repo_from () {
error "bug in the test script: not 2 parameters to test-create-repo"
repo="$1"
source="$2"
source_git=$source/$(cd "$source" && git rev-parse --git-dir)
source_git="$(git -C "$source" rev-parse --git-dir)"
objects_dir="$(git -C "$source" rev-parse --git-path objects)"
mkdir -p "$repo/.git"
(
cd "$repo/.git" &&
{ cp -Rl "$source_git/objects" . 2>/dev/null ||
cp -R "$source_git/objects" .; } &&
{ cp -Rl "$objects_dir" "$repo/.git/" 2>/dev/null ||
cp -R "$objects_dir" "$repo/.git/"; } &&
for stuff in "$source_git"/*; do
case "$stuff" in
*/objects|*/hooks|*/config)
*/objects|*/hooks|*/config|*/commondir)
;;
*)
cp -R "$stuff" . || exit 1
cp -R "$stuff" "$repo/.git/" || exit 1
;;
esac
done &&
cd .. &&
git init -q &&
cd "$repo" &&
git init -q && {
test_have_prereq SYMLINKS ||
git config core.symlinks false
} &&
mv .git/hooks .git/hooks-disabled 2>/dev/null
) || error "failed to copy repository '$source' to '$repo'"
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册