From c2404728b623588aa89920ae435b48af0fef011e Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 22 Jun 2023 15:49:05 +0300 Subject: Add branch sub-option for git project vcs in bdep-new Also fix tests which failed if for the initial branch git-init defaults to the name other than 'master'. --- tests/ci.testscript | 6 +++--- tests/init.testscript | 1 + tests/project.testscript | 5 ++++- tests/publish.testscript | 4 ++-- tests/release.testscript | 7 ++++--- 5 files changed, 14 insertions(+), 9 deletions(-) (limited to 'tests') diff --git a/tests/ci.testscript b/tests/ci.testscript index cff198b..d604aa7 100644 --- a/tests/ci.testscript +++ b/tests/ci.testscript @@ -20,7 +20,7 @@ end # Create the remote repository. # +mkdir --no-cleanup prj.git -+git -C prj.git init --bare --quiet &prj.git/*** ++git -C prj.git -c init.defaultBranch=master init --bare --quiet &prj.git/*** # Adjust the local repository and push it to the remote one. # @@ -53,7 +53,7 @@ test.arguments += --yes --repository "$repository" --server "$server" \ config_cxx = [cmdline] cc config.cxx=$quote($recall($cxx.path) $cxx.config.mode, true) -new += 2>! +new += --vcs git,branch=master 2>! init += $config_cxx -d prj 2>! &prj/**/bootstrap/*** windows = ($cxx.target.class == 'windows') @@ -663,7 +663,7 @@ windows = ($cxx.target.class == 'windows') # Create the remote repository. # +mkdir --no-cleanup prj.git - +git -C prj.git init --bare --quiet &prj.git/*** + +git -C prj.git -c init.defaultBranch=master init --bare --quiet &prj.git/*** # Create the local repository and push it to the remote one. # diff --git a/tests/init.testscript b/tests/init.testscript index 2a4f686..2e66721 100644 --- a/tests/init.testscript +++ b/tests/init.testscript @@ -8,6 +8,7 @@ config_cxx = [cmdline] cc config.cxx=$quote($recall($cxx.path) $cxx.config.mode, true) +new += --vcs git,branch=master status += -d prj : create-cfg diff --git a/tests/project.testscript b/tests/project.testscript index b40f7da..a675081 100644 --- a/tests/project.testscript +++ b/tests/project.testscript @@ -9,7 +9,10 @@ # project can not be shared between multiple bdep processes. Also we need to # make sure that projects are not cloned while being used by bdep. # -+$new prj 2>- &prj/*** # By default: -t exe -l c++. +# Make sure that the initial branch is named as 'master', since tests may rely +# on that. +# ++$new --vcs git,branch=master prj 2>! &prj/*** # By default: -t exe -l c++. # The most commonly used project cloning command that copies it from the # parent scope working directory. diff --git a/tests/publish.testscript b/tests/publish.testscript index 1fd8d38..41b5eed 100644 --- a/tests/publish.testscript +++ b/tests/publish.testscript @@ -22,7 +22,7 @@ test.arguments += --repository "$repository" --yes \ config_cxx = [cmdline] cc config.cxx=$quote($recall($cxx.path) $cxx.config.mode, true) -new += 2>! +new += --vcs git,branch=master 2>! init += $config_cxx -d prj 2>! &prj/**/bootstrap/*** windows = ($cxx.target.class == 'windows') @@ -438,7 +438,7 @@ g = [cmdline] git -C prj >! 2>! # Create the remote repository. # +mkdir --no-cleanup prj.git - +git -C prj.git init --bare --quiet &prj.git/*** + +git -C prj.git -c init.defaultBranch=master init --bare --quiet &prj.git/*** +$clone_prj diff --git a/tests/release.testscript b/tests/release.testscript index 1140161..2b86964 100644 --- a/tests/release.testscript +++ b/tests/release.testscript @@ -16,7 +16,7 @@ g = [cmdline] git 2>! >&2 # Create the remote repository. # +mkdir --no-cleanup prj.git -+$g -C prj.git init --bare &prj.git/*** ++$g -C prj.git -c init.defaultBranch=master init --bare &prj.git/*** clone_rep = [cmdline] cp --no-cleanup -pr ../prj.git ./ &prj.git/*** clone_root_rep = [cmdline] cp --no-cleanup -pr $~/prj.git ./ &prj.git/*** @@ -54,6 +54,8 @@ pull2 = [cmdline] $gp2 pull --ff-only fetch2 = [cmdline] $gp2 fetch log2 = [cmdline] $gp2 log '--pretty=format:"%d %s"' +new += --vcs git,branch=master 2>- + : single-pkg : { @@ -1103,11 +1105,10 @@ log2 = [cmdline] $gp2 log '--pretty=format:"%d %s"' # Create the remote repository. # +mkdir --no-cleanup prj.git - +git -C prj.git init --bare --quiet &prj.git/*** + +git -C prj.git -c init.defaultBranch=master init --bare --quiet &prj.git/*** # Create the local repository. # - new += 2>- +$new -t empty prj &prj/*** +$new -t exe --package prj -d prj +$new -t lib --package libprj -d prj -- cgit v1.1