mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Make the git-commit hook script POSIX compliant.
On a lot of systems using bashisms in /bin/sh scripts will be fine, since /bin/sh is a symlink to /bin/bash, but some systems symlink it to the more lightweight (and more strictly POSIX) /bin/dash or some other shell. Safest thing is to not assume a bashism will work. What has been changed: 1) `[[ … ]]` is a bashism. Replaced with `[ … ]`. 2) `-eq` is for numeric operations. When a variable is quoted, it becomes a string and uses `=` for comparison. 3) `&&` is a shell thing, but does not exist in `test`'s syntax. (`[ … ]` is shorthand for `test …`.) `-a` is the "and" when talking `test`.
This commit is contained in:
@@ -12,7 +12,7 @@ sed -i 's|charset=CHARSET|charset=UTF-8|' resources/l10n/template.pot
|
||||
LINES_ADDED=$(git diff --numstat resources/l10n/template.pot | cut -f 1)
|
||||
LINES_REMOVED=$(git diff --numstat resources/l10n/template.pot | cut -f 2)
|
||||
|
||||
if [[ "$LINES_ADDED" -eq "$LINES_REMOVED" && "$LINES_ADDED" -eq 1 ]]; then
|
||||
if [ "$LINES_ADDED" = "$LINES_REMOVED" -a "$LINES_ADDED" = "1" ]; then
|
||||
git checkout -- resources/l10n/template.pot
|
||||
else
|
||||
git add resources/l10n/template.pot
|
||||
|
||||
Reference in New Issue
Block a user