From 11d28be70b2911af2c1f197be5ba83c0ca5cdfa2 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Mon, 22 Jan 2024 19:02:50 +0300 Subject: [PATCH] Fix(set-last-commit-date): Use `git show -s` --- hooks/post-checkout/set-last-commit-date-all | 2 +- hooks/post-checkout/set-last-commit-date-changed | 2 +- hooks/post-checkout/set-last-commit-date-committed | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hooks/post-checkout/set-last-commit-date-all b/hooks/post-checkout/set-last-commit-date-all index e950e4c..1c87fba 100755 --- a/hooks/post-checkout/set-last-commit-date-all +++ b/hooks/post-checkout/set-last-commit-date-all @@ -8,7 +8,7 @@ new_HEAD="$2" new_branch="$3" if [ "$new_branch" = 1 ]; then - commit_date="`git show --format='%cD' | head -1`" && + commit_date="`git show --format='%cD' -s`" && find . \( -name .git -type d -prune \) -o \ -exec touch --date="$commit_date" '{}' \+ fi diff --git a/hooks/post-checkout/set-last-commit-date-changed b/hooks/post-checkout/set-last-commit-date-changed index 4074707..1a6b0ac 100755 --- a/hooks/post-checkout/set-last-commit-date-changed +++ b/hooks/post-checkout/set-last-commit-date-changed @@ -8,7 +8,7 @@ new_HEAD="$2" new_branch="$3" if [ "$new_branch" = 1 ]; then - commit_date="`git show --format='%cD' | head -1`" && + commit_date="`git show --format='%cD' -s`" && touch --date="$commit_date" `git diff --name-only HEAD~` fi diff --git a/hooks/post-checkout/set-last-commit-date-committed b/hooks/post-checkout/set-last-commit-date-committed index a39bca4..1e88974 100755 --- a/hooks/post-checkout/set-last-commit-date-committed +++ b/hooks/post-checkout/set-last-commit-date-committed @@ -8,7 +8,7 @@ new_HEAD="$2" new_branch="$3" if [ "$new_branch" = 1 ]; then - commit_date="`git show --format='%cD' | head -1`" && + commit_date="`git show --format='%cD' -s`" && touch --date="$commit_date" `git ls-files --cached` fi -- 2.39.5