utils/index: remove git config --system --add safe.directory call

Stop writing a global file when initializing projects. This can cause
permission issues. We instead pass the option manually for each Git
process call using:

    git -c safe.directory=...

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
This commit is contained in:
Théo Lebrun 2024-11-08 15:16:01 +01:00
parent d5ffe69f05
commit 7f9562a13f

View file

@ -18,14 +18,12 @@ project_init() {
mkdir -p $1/data $1/repo
git -C $1/repo -c init.defaultBranch=main init --bare
git config --system --add safe.directory $1/repo
}
# $1 is the project path (parent of data/ and repo/).
# $2 is the remote URL.
project_add_remote() {
git="git -C $1/repo"
git="git -C $1/repo -c safe.directory=$1/repo"
# Do nothing if remote already exists.
if $git remote | xargs -L1 -r $git remote get-url 2>/dev/null | grep -qxF "$2"; then
@ -44,7 +42,7 @@ project_add_remote() {
# $1 is the project path (parent of data/ and repo/).
project_fetch() {
git="git -C $1/repo"
git="git -C $1/repo -c safe.directory=$1/repo"
$git fetch --all --tags -j4