mirror of
https://github.com/YunoHost/package_check.git
synced 2024-09-03 20:06:20 +02:00
Merge pull request #158 from YunoHost/main_branch
support main branch for app to test as git repository
This commit is contained in:
commit
77b3b4e9d5
1 changed files with 13 additions and 16 deletions
|
@ -322,7 +322,7 @@ function fetch_package_to_test() {
|
||||||
# If the url is on a specific branch, extract the branch
|
# If the url is on a specific branch, extract the branch
|
||||||
if echo "$path_to_package_to_test" | grep -Eq "https?:\/\/.*\/tree\/"
|
if echo "$path_to_package_to_test" | grep -Eq "https?:\/\/.*\/tree\/"
|
||||||
then
|
then
|
||||||
gitbranch="-b ${path_to_package_to_test##*/tree/}"
|
gitbranch="${path_to_package_to_test##*/tree/}"
|
||||||
path_to_package_to_test="${path_to_package_to_test%%/tree/*}"
|
path_to_package_to_test="${path_to_package_to_test%%/tree/*}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -331,28 +331,25 @@ function fetch_package_to_test() {
|
||||||
package_path="$TEST_CONTEXT/app_folder"
|
package_path="$TEST_CONTEXT/app_folder"
|
||||||
|
|
||||||
# If the package is in a git repository
|
# If the package is in a git repository
|
||||||
if echo "$path_to_package_to_test" | grep -Eq "https?:\/\/"
|
if echo "$path_to_package_to_test" | grep -Eq "https?:\/\/"; then
|
||||||
then
|
|
||||||
# Force the branch master if no branch is specified.
|
# Force the branch master if no branch is specified.
|
||||||
if [ -z "$gitbranch" ]
|
if [ -z "$gitbranch" ]; then
|
||||||
then
|
branches=(master main stable)
|
||||||
if git ls-remote --quiet --exit-code $path_to_package_to_test master >/dev/null
|
for branch in "${branches[@]}"; do
|
||||||
then
|
if git ls-remote --quiet --exit-code "$path_to_package_to_test" "$branch" >/dev/null; then
|
||||||
gitbranch="-b master"
|
gitbranch="$branch"
|
||||||
else
|
break
|
||||||
if git ls-remote --quiet --exit-code $path_to_package_to_test stable >/dev/null
|
|
||||||
then
|
|
||||||
gitbranch="-b stable"
|
|
||||||
else
|
|
||||||
log_critical "Unable to find a default branch to test (master or stable)"
|
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
|
if [ -z "$gitbranch" ]; then
|
||||||
|
log_critical "Unable to find a default branch to test (master or stable)"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log_info " on branch ${gitbranch##-b }"
|
log_info " on branch ${gitbranch}"
|
||||||
|
|
||||||
# Clone the repository
|
# Clone the repository
|
||||||
git clone --quiet $path_to_package_to_test $gitbranch "$package_path"
|
git clone --quiet $path_to_package_to_test -b "$gitbranch" "$package_path"
|
||||||
|
|
||||||
if [[ ! -e "$package_path" ]]
|
if [[ ! -e "$package_path" ]]
|
||||||
then
|
then
|
||||||
|
|
Loading…
Add table
Reference in a new issue