Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

refactor: rename default branch to main #51

Merged
merged 2 commits into from
Oct 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backport.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ push() {

set +e

git -c user.name="${user_name}" -c user.email="${user_email}" -c "http.https://github.mirror.nvdadr.com.extraheader=Authorization: basic ${auth}" push -q --set-upstream origin "${backport_branch}" || fail "Unable to push the backported branch, did you try to backport the same PR twice without deleting the \`${backport_branch}\` branch?"
git -c user.name="${user_name}" -c user.email="${user_email}" -c "http.https://github.mirror.nvdadr.com.extraheader=Authorization: basic ${auth}" push -q --set-upstream origin "${backport_branch}" > /dev/null || fail "Unable to push the backported branch, did you try to backport the same PR twice without deleting the \`${backport_branch}\` branch?"

set -e
)
Expand Down
17 changes: 10 additions & 7 deletions spec/backport_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ http_post invoked with: comments-url {"body":"message\n\n<details><summary>Error
Describe 'Cherry pick succeeds'
setup_repo() {
cd "${git_repository}" || exit
git init -q
git init -q -b main
git config user.name testuser
git config user.email test@example.com
git config init.defaultBranch main
echo initial > file
git add file
git commit -q -m initial file
Expand All @@ -70,7 +71,7 @@ http_post invoked with: comments-url {"body":"message\n\n<details><summary>Error
echo modified > file
git commit -q -m change file
commit="$(git rev-parse HEAD)"
git checkout -q master
git checkout -q main
git merge -q --no-ff --commit "${commit}"
merge_commit_sha="$(git rev-parse HEAD)"
}
Expand All @@ -92,21 +93,22 @@ http_post invoked with: comments-url {"body":"message\n\n<details><summary>Error

setup_repo() {
cd "${git_repository}" || exit
git init -q
git init -q -b main
git config user.name testuser
git config user.email test@example.com
git config init.defaultBranch main
echo initial > file
git add file
git commit -q -m initial file
git checkout -q -b branch
echo conflict > file
git add file
git commit -q -m conflict
git checkout -q -b feature master
git checkout -q -b feature main
echo modified > file
git commit -q -m change file
commit="$(git rev-parse HEAD)"
git checkout -q master
git checkout -q main
git merge -q --no-ff --commit "${commit}"
merge_commit_sha="$(git rev-parse HEAD)"
}
Expand Down Expand Up @@ -184,16 +186,18 @@ http_post invoked with:comments-url {\"body\":\"Unable to cherry-pick commit * o
Describe 'push'
setup_repo() {
cd "${git_repository}" || exit
git init -q
git init -q -b main
git config user.name testuser
git config user.email test@example.com
git config init.defaultBranch main
echo initial > file
git add file
git commit -q -m initial file
cd "${GITHUB_WORKSPACE}" || exit
git clone -q "${git_repository}" .
git config user.name otheruser
git config user.email other@example.com
git config init.defaultBranch main
git checkout -q -b backport-branch
echo modified > file
git commit -q -m change file
Expand All @@ -203,7 +207,6 @@ http_post invoked with:comments-url {\"body\":\"Unable to cherry-pick commit * o
It 'Pushes'
When call push 'backport-branch'
The value "$(cd "${git_repository}" && git show backport-branch:file)" should equal "modified"
The output should start with "Branch 'backport-branch' set up to track remote branch 'backport-branch' from 'origin'"
End
End

Expand Down