]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tools/git-tp-sync: reuse git ls-files calls
authorKarel Zak <kzak@redhat.com>
Wed, 19 Feb 2025 11:41:12 +0000 (12:41 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 19 Feb 2025 17:59:48 +0000 (18:59 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
(cherry picked from commit 33972cc93941d7f42b522f60c4c4ffa15cfd2a46)

tools/git-tp-sync

index 1a3764c354420c2b8aeb7307c34c9ff1ce08cb42..f8a7d485e4672522506d35119a988c4633b5e2b9 100755 (executable)
@@ -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