Files
autogits/common/test_repo_setup.sh
Adam Majer 444959540a submodule conflict resolution
If merging a ProjectGit with submodules,
  * removed submodules are to be removed always
  * modified/added submodules are to be present
  * submodules modified in base project and PR should conflict
2025-10-28 19:43:03 +01:00

142 lines
2.6 KiB
Bash
Executable File

#!/usr/bin/bash
set -x
export GIT_CONFIG_COUNT=2
export GIT_CONFIG_KEY_0=protocol.file.allow
export GIT_CONFIG_VALUE_0=always
export GIT_CONFIG_KEY_1=init.defaultBranch
export GIT_CONFIG_VALUE_1=main
export GIT_AUTHOR_NAME=testname
export GIT_AUTHOR_EMAIL=test@suse.com
export GIT_AUTHOR_DATE='2005-04-07T22:13:13'
export GIT_COMMITTER_NAME=testname
export GIT_COMMITTER_EMAIL=test@suse.com
export GIT_COMMITTER_DATE='2005-04-07T22:13:13'
create_prjgit_sample() {
mkdir prjgit
pushd prjgit
git init -q --object-format=sha256 -b main
echo Project git is here > README.md
git add README.md
git config receive.denyCurrentBranch ignore
git submodule init
git submodule -q add ../pkgA pkgA
git submodule -q add ../pkgB pkgB
git submodule -q add ../pkgC pkgC
git commit -q -m 'first commit'
git checkout -b base_add_b1 main
git submodule -q add ../pkgB1 pkgB1
git commit -q -m "pkgB1 added"
git checkout -b base_add_b2 main
git clean -ffxd
git submodule -q add ../pkgB2 pkgB2
git commit -q -m "pkgB2 added"
git checkout -b base_rm_c main
git clean -ffxd
git rm pkgC
git commit -q -m 'pkgC removed'
git checkout -b base_modify_c main
git submodule update --init pkgC
pushd pkgC
echo "mofieid" >> README.md
git commit -q -m "modified" README.md
popd
git commit pkgC -m "modifiedC"
git submodule deinit -f pkgC
# git checkout main
# git clean -ffxd
# git submodule -q add -f ../pkgB1 pkgB1
# git commit -q -m "main adding pkgB1"
popd
}
create_pkgA() {
mkdir pkgA
pushd pkgA
git init -q --object-format=sha256
git config receive.denyCurrentBranch ignore
echo "Package A" > README.md
git add README.md
git commit -q -m 'Something base here'
popd
}
create_pkgB() {
mkdir pkgB
pushd pkgB
git init -q --object-format=sha256
git config receive.denyCurrentBranch ignore
echo "Package B" > README.md
git add README.md
git commit -q -m 'Something also base here'
popd
}
create_pkgB1() {
mkdir pkgB1
pushd pkgB1
git init -q --object-format=sha256
git config receive.denyCurrentBranch ignore
echo "Package B1" > README.md
git add README.md
git commit -q -m 'Something also base here'
popd
}
create_pkgB2() {
mkdir pkgB2
pushd pkgB2
git init -q --object-format=sha256
git config receive.denyCurrentBranch ignore
echo "Package B2" > README.md
git add README.md
git commit -q -m 'Something also base here'
popd
}
create_pkgC() {
mkdir pkgC
pushd pkgC
git init -q --object-format=sha256
git config receive.denyCurrentBranch ignore
echo "Package C" > README.md
git add README.md
git commit -q -m 'Something another base here'
popd
}
create_pkgA
create_pkgB
create_pkgB1
create_pkgB2
create_pkgC
create_prjgit_sample