summaryrefslogtreecommitdiff
path: root/t/t7003-filter-branch.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t7003-filter-branch.sh')
-rwxr-xr-xt/t7003-filter-branch.sh43
1 files changed, 23 insertions, 20 deletions
diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh
index 36477cb..1c55695 100755
--- a/t/t7003-filter-branch.sh
+++ b/t/t7003-filter-branch.sh
@@ -1,6 +1,9 @@
#!/bin/sh
test_description='git filter-branch'
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+
. ./test-lib.sh
. "$TEST_DIRECTORY/lib-gpg.sh"
@@ -13,7 +16,7 @@ test_expect_success 'setup' '
mkdir dir &&
test_commit dir/D &&
test_commit E &&
- git checkout master &&
+ git checkout main &&
test_commit C &&
git checkout branch &&
git merge C &&
@@ -25,7 +28,7 @@ test_expect_success 'setup' '
# * G
# * Merge commit 'C' into branch
# |\
-# | * (master) C
+# | * (main) C
# * | E
# * | dir/D
# * | D
@@ -162,15 +165,15 @@ test_expect_success 'subdirectory filter result looks okay' '
'
test_expect_success 'more setup' '
- git checkout master &&
+ git checkout main &&
mkdir subdir &&
echo A > subdir/new &&
git add subdir/new &&
test_tick &&
- git commit -m "subdir on master" subdir/new &&
+ git commit -m "subdir on main" subdir/new &&
git rm A.t &&
test_tick &&
- git commit -m "again subdir on master" &&
+ git commit -m "again subdir on main" &&
git merge branch
'
@@ -199,7 +202,7 @@ test_expect_success 'author information is preserved' '
git branch preserved-author &&
(sane_unset GIT_AUTHOR_NAME &&
git filter-branch -f --msg-filter "cat; \
- test \$GIT_COMMIT != $(git rev-parse master) || \
+ test \$GIT_COMMIT != $(git rev-parse main) || \
echo Hallo" \
preserved-author) &&
git rev-list --author="B V Uips" preserved-author >actual &&
@@ -218,7 +221,7 @@ test_expect_success "remove a certain author's commits" '
else\
git commit-tree \"\$@\";\
fi" removed-author &&
- cnt1=$(git rev-list master | wc -l) &&
+ cnt1=$(git rev-list main | wc -l) &&
cnt2=$(git rev-list removed-author | wc -l) &&
test $cnt1 -eq $(($cnt2 + 1)) &&
git rev-list --author="B V Uips" removed-author >actual &&
@@ -226,7 +229,7 @@ test_expect_success "remove a certain author's commits" '
'
test_expect_success 'barf on invalid name' '
- test_must_fail git filter-branch -f master xy-problem &&
+ test_must_fail git filter-branch -f main xy-problem &&
test_must_fail git filter-branch -f HEAD^
'
@@ -236,8 +239,8 @@ test_expect_success '"map" works in commit filter' '
mapped=\$(map \$parent) &&
actual=\$(echo \"\$@\" | sed \"s/^.*-p //\") &&
test \$mapped = \$actual &&
- git commit-tree \"\$@\";" master~2..master &&
- git rev-parse --verify master
+ git commit-tree \"\$@\";" main~2..main &&
+ git rev-parse --verify main
'
test_expect_success 'Name needing quotes' '
@@ -256,7 +259,7 @@ test_expect_success 'Name needing quotes' '
test_expect_success 'Subdirectory filter with disappearing trees' '
git reset --hard &&
- git checkout master &&
+ git checkout main &&
mkdir foo &&
touch foo/bar &&
@@ -275,7 +278,7 @@ test_expect_success 'Subdirectory filter with disappearing trees' '
git commit -m "Re-adding foo" &&
git filter-branch -f --subdirectory-filter foo &&
- git rev-list master >actual &&
+ git rev-list main >actual &&
test_line_count = 3 actual
'
@@ -332,7 +335,7 @@ test_expect_success 'Tag name filtering allows slashes in tag names' '
test_cmp expect actual
'
test_expect_success 'setup --prune-empty comparisons' '
- git checkout --orphan master-no-a &&
+ git checkout --orphan main-no-a &&
git rm -rf . &&
unset test_tick &&
test_tick &&
@@ -343,7 +346,7 @@ test_expect_success 'setup --prune-empty comparisons' '
mkdir dir &&
test_commit dir/D dir/D.t dir/D dir/Dx &&
test_commit E E.t E Ex &&
- git checkout master-no-a &&
+ git checkout main-no-a &&
test_commit C C.t C Cx &&
git checkout branch-no-a &&
git merge Cx -m "Merge tag '\''C'\'' into branch" &&
@@ -397,7 +400,7 @@ test_expect_success '--prune-empty is able to prune entire branch' '
'
test_expect_success '--remap-to-ancestor with filename filters' '
- git checkout master &&
+ git checkout main &&
git reset --hard A &&
test_commit add-foo foo 1 &&
git branch moved-foo &&
@@ -407,15 +410,15 @@ test_expect_success '--remap-to-ancestor with filename filters' '
git branch moved-bar &&
test_commit change-foo foo 2 &&
git filter-branch -f --remap-to-ancestor \
- moved-foo moved-bar A..master \
+ moved-foo moved-bar A..main \
-- -- foo &&
test $(git rev-parse moved-foo) = $(git rev-parse moved-bar) &&
- test $(git rev-parse moved-foo) = $(git rev-parse master^) &&
+ test $(git rev-parse moved-foo) = $(git rev-parse main^) &&
test $orig_invariant = $(git rev-parse invariant)
'
test_expect_success 'automatic remapping to ancestor with filename filters' '
- git checkout master &&
+ git checkout main &&
git reset --hard A &&
test_commit add-foo2 foo 1 &&
git branch moved-foo2 &&
@@ -425,10 +428,10 @@ test_expect_success 'automatic remapping to ancestor with filename filters' '
git branch moved-bar2 &&
test_commit change-foo2 foo 2 &&
git filter-branch -f \
- moved-foo2 moved-bar2 A..master \
+ moved-foo2 moved-bar2 A..main \
-- -- foo &&
test $(git rev-parse moved-foo2) = $(git rev-parse moved-bar2) &&
- test $(git rev-parse moved-foo2) = $(git rev-parse master^) &&
+ test $(git rev-parse moved-foo2) = $(git rev-parse main^) &&
test $orig_invariant = $(git rev-parse invariant2)
'