mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2025-01-09 11:44:18 +00:00
Follow-up I93275d8a: Fix updateSubmodule.sh when i18n lists empty
We need to allow for the grep commands to return empty strings like we do in the lines above. This error was previously suppressed because we incorrectly prepending "- " unconditionally. Change-Id: I3a80e8790d879cbce021bf06eeb6746862bfdd1a
This commit is contained in:
parent
ad0041f6c7
commit
3b6c81d224
|
@ -50,14 +50,16 @@ TASKS=$(git log ..$TARGET --no-merges --format=format:%B | grep "Bug: T" | sort
|
|||
|
||||
# Ensure script continues if grep "fails" (returns nothing) with || : (due to -e flag in bash)
|
||||
|
||||
# Addede/removed i18n keys
|
||||
# Added/removed i18n keys
|
||||
ADDED_I18N_KEYS=$(git diff HEAD..$TARGET -- i18n/en.json | grep -E '^\+' | grep --color=never -vE '^\+\+\+' | sed -E 's/^\+\s*"([^"]+)":.*/\1/' | sed 's/^/- /' || :)
|
||||
DELETED_I18N_KEYS=$(git diff HEAD..$TARGET -- i18n/en.json | grep -E '^\-' | grep --color=never -vE '^\-\-\-' | sed -E 's/^\-\s*"([^"]+)":.*/\1/' | sed 's/^/- /' || :)
|
||||
|
||||
# Find common keys (modified keys)
|
||||
MODIFIED_KEYS=$(echo -e "$ADDED_I18N_KEYS\n$DELETED_I18N_KEYS" | sort | uniq -d)
|
||||
|
||||
# Remove modified keys from the added and removed lists
|
||||
ADDED_I18N_KEYS=$(echo "$ADDED_I18N_KEYS" | grep -vxF -f <(echo "$MODIFIED_KEYS"))
|
||||
DELETED_I18N_KEYS=$(echo "$DELETED_I18N_KEYS" | grep -vxF -f <(echo "$MODIFIED_KEYS"))
|
||||
ADDED_I18N_KEYS=$(echo "$ADDED_I18N_KEYS" | grep -vxF -f <(echo "$MODIFIED_KEYS") || :)
|
||||
DELETED_I18N_KEYS=$(echo "$DELETED_I18N_KEYS" | grep -vxF -f <(echo "$MODIFIED_KEYS") || :)
|
||||
|
||||
# Added/removed files
|
||||
ADDED_FILES=$(git diff HEAD..$TARGET --name-only --diff-filter=A | grep --color=never -E "\.(js|css|less)$" | sed 's/^/- /' || :)
|
||||
|
|
Loading…
Reference in a new issue