From 226cc4744c4d99032d54b055a47fd09ebf6294e7 Mon Sep 17 00:00:00 2001 From: Daniel Scharrer Date: Fri, 30 Aug 2019 00:17:38 +0200 Subject: [PATCH] update-copyright-years: Fix running from arbitrary working directories --- doc/update-copyright-years | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/update-copyright-years b/doc/update-copyright-years index 0d80a0a..3bf1363 100755 --- a/doc/update-copyright-years +++ b/doc/update-copyright-years @@ -34,7 +34,7 @@ for file ; do continue ;; esac - c="$(grep -P "(^|[^a-zA-Z0-9_])Copyright( \\([cC]\\))? (\\d{4}\\-)?\\d{4} $copyright" "$file")" + c="$(grep -P "(^|[^a-zA-Z0-9_])Copyright( \\([cC]\\))? (\\d{4}\\-)?\\d{4} $copyright" "$path")" if [ -z "$c" ] ; then case "$file" in @@ -42,7 +42,7 @@ for file ; do # These files don't have to contain copyright information ;; *.*|scripts/*) - c="$(grep -P "(^|[^a-zA-Z0-9_])Copyright( \([cC]\))?[ \:].*public domain" "$file")" + c="$(grep -P "(^|[^a-zA-Z0-9_])Copyright( \([cC]\))?[ \:].*public domain" "$path")" [ -z "$c" ] && printf 'No copyright info found in %s, skipping\n' "$file" ;; esac continue @@ -64,7 +64,7 @@ for file ; do COPYING|LICENSE) new_year="$(git --git-dir="$repo/.git" log -1 --format=%cd --date=short)" ;; *) - new_year="$(git --git-dir="$repo/.git" log -1 --format=%cd --date=short -- "$path")" + new_year="$(git --git-dir="$repo/.git" log -1 --format=%cd --date=short -- "$file")" esac new_year="${new_year%%-*}" if [ -z "$new_year" ] || printf '%s\n' "$new_year" | grep -P '[^0-9]' > /dev/null ; then