]> git.phdru.name Git - git-scripts.git/commitdiff
Use head instead of awk
authorOleg Broytman <phd@phdru.name>
Sun, 10 Aug 2014 13:28:59 +0000 (17:28 +0400)
committerOleg Broytman <phd@phdru.name>
Sun, 10 Aug 2014 13:28:59 +0000 (17:28 +0400)
hooks/post-checkout-touch
hooks/post-checkout-touch-all

index 713395f2fb7eb54db24e2def67e0962b73bc450e..aa90936fdd514f9b853657399cb3da603617105c 100755 (executable)
@@ -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
 
index b91425a4260505325ca8970317ae6b657e3cf5d5..56ca2f4c22c5a46a783e4bed7ed011d2a89e378d 100755 (executable)
@@ -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