From: Oleg Broytman Date: Sun, 10 Aug 2014 13:28:59 +0000 (+0400) Subject: Use head instead of awk X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=9b11d48d0ae2f974c73436627528cae5f0506eac;p=git-scripts.git Use head instead of awk --- diff --git a/hooks/post-checkout-touch b/hooks/post-checkout-touch index 713395f..aa90936 100755 --- a/hooks/post-checkout-touch +++ b/hooks/post-checkout-touch @@ -8,7 +8,7 @@ new_HEAD="$2" new_branch="$3" if [ "$new_branch" = 1 ]; then - commit_date="`git show --format='%cD' \"$new_HEAD\" | awk '{if (NR==1) print}'`" && + commit_date="`git show --format='%cD' \"$new_HEAD\" | head -1`" && touch --date="$commit_date" `git ls-files --cached` fi diff --git a/hooks/post-checkout-touch-all b/hooks/post-checkout-touch-all index b91425a..56ca2f4 100755 --- a/hooks/post-checkout-touch-all +++ b/hooks/post-checkout-touch-all @@ -8,7 +8,7 @@ new_HEAD="$2" new_branch="$3" if [ "$new_branch" = 1 ]; then - commit_date="`git show --format='%cD' \"$new_HEAD\" | awk '{if (NR==1) print}'`" && + commit_date="`git show --format='%cD' \"$new_HEAD\" | head -1`" && find . \( -name .git -type d -prune \) -o -exec touch --date="$commit_date" '{}' \+ fi