From 33972cc93941d7f42b522f60c4c4ffa15cfd2a46 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 19 Feb 2025 12:41:12 +0100 Subject: [PATCH] tools/git-tp-sync: reuse git ls-files calls Signed-off-by: Karel Zak --- tools/git-tp-sync | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/git-tp-sync b/tools/git-tp-sync index 1a3764c35..f8a7d485e 100755 --- a/tools/git-tp-sync +++ b/tools/git-tp-sync @@ -81,6 +81,15 @@ function try_lang { fi } +function git_files { + local MODE="$1" + local DIRNAME="$2" + + echo $(git ls-files $MODE -x '*~' "$DIRNAME" \ + | gawk '/[[:alpha:]_\-]*\.po/ { sub("po/", ""); print $0; }' \ + | sort) +} + # # Download # @@ -92,8 +101,8 @@ else done fi -PO_NEW=$(git ls-files -o -x '*~' po/ | gawk '/po\/[[:alpha:]_\-]*\.po/ { sub("po/", ""); print $0; }' | sort) -PO_MOD=$(git ls-files -m po/ | gawk '/po\/[[:alpha:]_\-]*\.po/ { sub("po/", ""); print $0; }' | sort) +PO_NEW=$(git_files -o po) +PO_MOD=$(git_files -m po) for f in $PO_MOD; do try_lang $f -- 2.47.3