updated git_set_dir_safe.sh

pull/16/head
Hari Sekhon 2 years ago
parent 80c3620fba
commit 7d4293d81a

@ -24,7 +24,7 @@ srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
usage_description="
Sets the current or given git directory and submodules to be marked as safe
Necessary for some CI/CD systems which have wacky permissions triggering this error:
Necessary for some CI/CD systems like Azure DevOps Pipelines which have incorrect ownership on the git checkout dir triggering this error:
fatal: detected dubious ownership in repository at '/code/sql'
"
@ -37,17 +37,5 @@ help_usage "$@"
#min_args 1 "$@"
dir="${1:-.}"
cd "$dir"
echo "Setting directory as safe: $PWD"
git config --global --add safe.directory "$PWD"
while read -r submodule_dir; do
dir="$PWD/$submodule_dir"
echo "Setting directory as safe: $dir"
git config --global --add safe.directory "$dir"
done < <(git submodule | awk '{print $2}')
echo "Done"
# this script is standalone without lib dependency so can be called directly from bootstrapped CI before submodules, since that is the exact problem that needs to be solved to allow CI/CD systems with incorrect ownership of the checkout directory to be able to checkout the necessary git submodules
"$srcdir/setup/ci_git_set_dir_safe.sh" "${1:-.}"

Loading…
Cancel
Save