From 9b11d48d0ae2f974c73436627528cae5f0506eac Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sun, 10 Aug 2014 17:28:59 +0400 Subject: [PATCH] Use head instead of awk --- hooks/post-checkout-touch | 2 +- hooks/post-checkout-touch-all | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 -- 2.39.5