You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
git-filter-repo/t/t9391-filter-repo-lib-usage.sh

133 lines
3.4 KiB
Bash

#!/bin/bash
test_description='Usage of git-filter-repo as a library'
. ./test-lib.sh
# for git_filter_repo.py import
export PYTHONPATH=$(dirname $TEST_DIRECTORY):$PYTHONPATH
# Avoid writing git_filter_repo.pyc file
export PYTHONDONTWRITEBYTECODE=1
setup()
{
git init $1 &&
(
cd $1 &&
echo hello > world &&
git add world &&
test_tick &&
git commit -m initial &&
printf "The launch code is 1-2-3-4." > secret &&
git add secret &&
test_tick &&
git commit -m "Sssh. Dont tell no one" &&
echo A file that you cant trust > file.doc &&
echo there >> world &&
git add file.doc world &&
test_tick &&
printf "Random useless changes\n\nLet us be like the marketing group. Marketing is staffed with pansies" | git commit -F - &&
echo Do not use a preposition to end a setence with > advice &&
git add advice &&
test_tick &&
GIT_AUTHOR_NAME="Copy N. Paste" git commit -m "hypocrisy is fun" &&
echo Avoid cliches like the plague >> advice &&
test_tick &&
GIT_AUTHOR_EMAIL="foo@my.crp" git commit -m "it is still fun" advice &&
echo " \$Id: A bunch of junk$" > foobar.c &&
git add foobar.c &&
test_tick &&
git commit -m "Brain damage"
)
}
test_expect_success 'commit_info.py' '
setup commit_info &&
(
cd commit_info &&
$TEST_DIRECTORY/t9391/commit_info.py &&
test 0e5a1029 = $(git rev-parse --short=8 --verify refs/heads/master)
)
'
test_expect_success 'file_filter.py' '
setup file_filter &&
(
cd file_filter &&
$TEST_DIRECTORY/t9391/file_filter.py &&
test ee59e2b4 = $(git rev-parse --short=8 --verify refs/heads/master)
)
'
test_expect_success 'print_progress.py' '
setup print_progress &&
(
cd print_progress &&
MASTER=$(git rev-parse --verify master) &&
$TEST_DIRECTORY/t9391/print_progress.py . new &&
test $MASTER = $(git rev-parse --verify refs/heads/master)
)
'
test_expect_success 'rename-master-to-develop.py' '
setup rename_master_to_develop &&
(
cd rename_master_to_develop &&
MASTER=$(git rev-parse --verify master) &&
$TEST_DIRECTORY/t9391/rename-master-to-develop.py &&
test $MASTER = $(git rev-parse --verify refs/heads/develop)
)
'
test_expect_success 'strip-cvs-keywords.py' '
setup strip_cvs_keywords &&
(
cd strip_cvs_keywords &&
$TEST_DIRECTORY/t9391/strip-cvs-keywords.py
test 2306fc7c = $(git rev-parse --short=8 --verify refs/heads/master)
)
'
test_expect_success 'setup two extra repositories' '
mkdir repo1 &&
cd repo1 &&
git init &&
echo hello > world &&
git add world &&
test_tick &&
git commit -m "Commit A" &&
echo goodbye > world &&
git add world &&
test_tick &&
git commit -m "Commit C" &&
cd .. &&
mkdir repo2 &&
cd repo2 &&
git init &&
echo foo > bar &&
git add bar &&
test_tick &&
git commit -m "Commit B" &&
echo fooey > bar &&
git add bar &&
test_tick &&
git commit -m "Commit D" &&
cd ..
'
test_expect_success 'splice_repos.py' '
git init splice_repos &&
$TEST_DIRECTORY/t9391/splice_repos.py repo1 repo2 splice_repos &&
test 4 = $(git -C splice_repos rev-list master | wc -l)
'
test_expect_success 'create_fast_export_output.py' '
git init create_fast_export_output &&
(cd create_fast_export_output &&
$TEST_DIRECTORY/t9391/create_fast_export_output.py &&
test e5e0569b = $(git rev-parse --short=8 --verify refs/heads/master) &&
test 122ead00 = $(git rev-parse --short=8 --verify refs/heads/devel) &&
test f36143f9 = $(git rev-parse --short=8 --verify refs/tags/v1.0))
'
test_done