Skip to content

Commit

Permalink
test: use master branch explicit
Browse files Browse the repository at this point in the history
Make tests work on machines where the git init.defaultBranch is set to
something different than master.
  • Loading branch information
rhubert committed Dec 31, 2024
1 parent 2545fdb commit 08f9fb0
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/black-box/buildid-change/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ popd
D="$(mktemp -d)"
pushd "$D"
git init .
git checkout -b master
git config user.email "[email protected]"
git config user.name test
echo "first" > first.txt
Expand Down
1 change: 1 addition & 0 deletions test/black-box/clean/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ rm -rf default.yaml
gitDir=$(mktemp -d)
pushd "${gitDir}"
git init
git checkout -b master
git config user.email "[email protected]"
git config user.name test
echo "git" > test.dat
Expand Down
1 change: 1 addition & 0 deletions test/black-box/git-alternatives/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ repo=$dir/repo.git
init_repo() {
mkdir "$1"
git init "$1"
git -C "$1" checkout -b master
git -C "$1" config user.email "[email protected]"
git -C "$1" config user.name test

Expand Down
1 change: 1 addition & 0 deletions test/black-box/git-scm-retry/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ cp t.yaml "$bob/recipes"
work=$dir/_work
mkdir "$work"
git init "$work"
git -C "$work" checkout -b master
git -C "$work" config user.email "[email protected]"
git -C "$work" config user.name test

Expand Down
3 changes: 3 additions & 0 deletions test/black-box/git-scm-switch/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pushd "$git_submod"
git init .
git config user.email "[email protected]"
git config user.name test
git checkout -b master
echo sub > sub.txt
git add sub.txt
git commit -m import
Expand All @@ -26,6 +27,7 @@ pushd "$git_dir1"
git init .
git config user.email "[email protected]"
git config user.name test
git checkout -b master
echo "hello world" > test.txt
git add test.txt
git commit -m "initial commit"
Expand All @@ -46,6 +48,7 @@ pushd "$git_dir2"
git init .
git config user.email "[email protected]"
git config user.name test
git checkout -b master
echo "hello bob" > bob.txt
git add bob.txt
git commit -m "first commit"
Expand Down
1 change: 1 addition & 0 deletions test/black-box/git-scm/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ cp recipe1.yaml "$bob/recipes/t.yaml"
work=$dir/work
mkdir "$work"
git init "$work"
git -C "$work" checkout -b master
git -C "$work" config user.email "[email protected]"
git -C "$work" config user.name test

Expand Down
2 changes: 2 additions & 0 deletions test/black-box/nested-scms/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pushd "$git_dir1"
git init .
git config user.email "[email protected]"
git config user.name test
git checkout -b master
echo "commit-1" > git1.txt
git add git1.txt
git commit -m "initial commit"
Expand All @@ -28,6 +29,7 @@ pushd "$git_dir2"
git init .
git config user.email "[email protected]"
git config user.name test
git checkout -b master
echo "commit-1" > git2.txt
git add git2.txt
git commit -m "first commit"
Expand Down
1 change: 1 addition & 0 deletions test/black-box/status/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pushd ${gitDir}
git init
git config user.email "[email protected]"
git config user.name test
git checkout -b master
echo "git" > test.dat
git add test.dat
git commit -m "added test"
Expand Down
1 change: 1 addition & 0 deletions test/integration/jenkins/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ def testGitModule(jc):
subprocess.run(["git", "init", gitDir], check=True)
subprocess.run(["git", "config", "user.email", "bob@test"], check=True, cwd=gitDir)
subprocess.run(["git", "config", "user.name", "bob"], check=True, cwd=gitDir)
subprocess.run(["git", "checkout", "-b", "master"], check=True, cwd=gitDir)
subprocess.run(["git", "add", "result.txt"], check=True, cwd=gitDir)
subprocess.run(["git", "commit", "-m", "init"], check=True, cwd=gitDir)

Expand Down
7 changes: 7 additions & 0 deletions test/unit/test_input_gitscm.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ def setUpClass(cls):
'git init .',
'git config user.email "[email protected]"',
'git config user.name test',
'git checkout -b master',
'echo "hello world" > test.txt',
'git add test.txt',
'git commit -m "first commit"',
Expand Down Expand Up @@ -416,6 +417,7 @@ def setUpClass(cls):
git init .
git config user.email "[email protected]"
git config user.name test
git checkout -b master
for i in $(seq 3) ; do
echo "#$i" > test.txt
Expand Down Expand Up @@ -520,6 +522,7 @@ def setUp(self):
git init .
git config user.email "[email protected]"
git config user.name test
git checkout -b master
echo subsub > subsub.txt
git add subsub.txt
git commit -m import
Expand All @@ -530,6 +533,7 @@ def setUp(self):
git init .
git config user.email "[email protected]"
git config user.name test
git checkout -b master
echo 1 > test.txt
git add test.txt
mkdir -p some/deep
Expand All @@ -542,6 +546,7 @@ def setUp(self):
# setup main module and add first submodule
cd main
git init .
git checkout -b master
git config user.email "[email protected]"
git config user.name test
echo 1 > test.txt
Expand Down Expand Up @@ -619,6 +624,7 @@ def addSub2(self):
cmds = """\
cd sub2
git init .
git checkout -b master
git config user.email "[email protected]"
git config user.name test
echo 2 > test.txt
Expand Down Expand Up @@ -882,6 +888,7 @@ def setUp(self):

cmds = """\
git init .
git checkout -b master
git config user.email "[email protected]"
git config user.name test
echo -n "hello world" > test.txt
Expand Down
6 changes: 6 additions & 0 deletions test/unit/test_input_gitscm_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def setUp(self):
self.callGit('git config user.email "[email protected]"', cwd=self.repodir)
self.callGit('git config user.name test', cwd=self.repodir)

self.callGit('git checkout -b master', cwd=self.repodir)

f = open(os.path.join(self.repodir, "test.txt"), "w")
f.write("hello world")
f.close()
Expand Down Expand Up @@ -169,6 +171,7 @@ def setUpClass(cls):
# make sub-submodule
cd subsub
git init .
git checkout -b master
git config user.email "[email protected]"
git config user.name test
echo subsub > test.txt
Expand All @@ -179,6 +182,7 @@ def setUpClass(cls):
# setup first submodule
cd sub
git init .
git checkout -b master
git config user.email "[email protected]"
git config user.name test
echo sub > test.txt
Expand All @@ -191,6 +195,7 @@ def setUpClass(cls):
# setup second submodule
cd sub2
git init .
git checkout -b master
git config user.email "[email protected]"
git config user.name test
echo sub2 > test.txt
Expand All @@ -201,6 +206,7 @@ def setUpClass(cls):
# setup main module
cd main
git init .
git checkout -b master
git config user.email "[email protected]"
git config user.name test
echo main > test.txt
Expand Down

0 comments on commit 08f9fb0

Please sign in to comment.