🐛 Add the safe.directory entry only when missing

Every run of manage.sh executes

    git config --global --add safe.directory /home/penpot/penpot

and --add appends unconditionally, so N invocations leave N copies of
the entry in the developer's global git config: after a few months of
daily devenv use, my ~/.config/git/config held 22 duplicates. Ask git
first and add the entry only when it is missing, so the devenv behaves
exactly as before and the host-side global config stops growing.

AI-assisted-by: glm-5.3-flash
Signed-off-by: Álvaro Tejero Cantero <alvorithm@teje.ro>
This commit is contained in:
Álvaro Tejero Cantero 2026-10-28 07:54:56 +01:00
parent f6f9df9a1a
commit e5ef75bc36
No known key found for this signature in database

View File

@ -71,8 +71,10 @@ export CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD);
export IMAGEMAGICK_VERSION=7.1.2-32
# Safe directory to avoid ownership errors with Git
git config --global --add safe.directory /home/penpot/penpot || true
# Safe directory to avoid ownership errors with Git. --add appends on every
# run, so only add it when missing, or ~/.config/git/config grows a
# duplicate line per invocation.
git config --global --get-all safe.directory | grep -qxF '/home/penpot/penpot' || git config --global --add safe.directory /home/penpot/penpot || true
# Set default java options
export JAVA_OPTS=${JAVA_OPTS:-"-Xmx1000m -Xms50m"};