test-forges/test-forges.sh

44 lines
1.2 KiB
Bash
Raw Permalink Normal View History

#!/bin/sh
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
set -e
# Settings
user=GNUtoo
create_repo()
{
path="$1"
mkdir "${path}"
git -C "${path}" init
echo "# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
" > "${path}/README"
git -C "${path}" add "README"
git -C "${path}" commit -sm "Add README"
}
test_forgejo()
{
repo_path="$1"
rm -rf "${repo_path}"
create_repo "${repo_path}"
git -C "${repo_path}" \
remote add origin git@forge.a-lec.org:${user}/$(basename ${repo_path}).git
git -C "${repo_path}" push origin HEAD:main
}
test_forgejo "test1"