From e0c78fa4b82f14fd1ebf85bd907b7b0e6e708c45 Mon Sep 17 00:00:00 2001 From: Rafael Fontenelle Date: Fri, 6 Sep 2024 00:50:43 -0300 Subject: [PATCH] commit: Do not print error message on zero untracked files --- scripts/commit.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/commit.sh b/scripts/commit.sh index af5532251..0b0c6cf3e 100755 --- a/scripts/commit.sh +++ b/scripts/commit.sh @@ -23,7 +23,10 @@ git status -s | grep '^ D ' | cut -d' ' -f3 | xargs -r git rm git diff -I'^"POT-Creation-Date: ' --numstat *.po **/*.po | cut -f3 | xargs -r git add -v # Add currently untracked PO files, and update other helper files -git add -v $(git ls-files -o --exclude-standard *.po **/*.po) +untracked_files=$(git ls-files -o --exclude-standard *.po **/*.po) +if [ -n "${untracked_files+x}" ]; then + git add -v $untracked_files +fi # Commit only if there is any cached file git diff-index --cached --quiet HEAD || { git add -v $extra_files; git commit -vm "Update translations"; }