#!/bin/sh -e
# like: cp new_generated_file old_committed_file
#   $1 new file
#   $2 old file (to be updated)
# normalize po as wrapped (safe side)
msgcat -o "$1.wrap" "$1"
msgcat -o "$2.wrap" "$2"
if diff -s --ignore-matching-lines='^"\(POT-Creation-Date:\|Project-Id-Version:\)' "$1.wrap" "$2.wrap" >/dev/null ; then
  echo "I: keep $2 as is (no change)"
else
  echo "I: update $2 with new $1 (changed)"
  cp -f "$1.wrap" "$2"
fi
rm -f "$1.wrap" "$2.wrap"
