]> git.phdru.name Git - git-scripts.git/commitdiff
Fix(set-last-commit-date): Use `git show -s`
authorOleg Broytman <phd@phdru.name>
Mon, 22 Jan 2024 16:02:50 +0000 (19:02 +0300)
committerOleg Broytman <phd@phdru.name>
Mon, 22 Jan 2024 16:02:50 +0000 (19:02 +0300)
hooks/post-checkout/set-last-commit-date-all
hooks/post-checkout/set-last-commit-date-changed
hooks/post-checkout/set-last-commit-date-committed

index e950e4cbad05c10027c7374f0beb139ff9b8a8a6..1c87fba880ac9542878fc21be9e876a4d451b87a 100755 (executable)
@@ -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
index 4074707e4d5bc84e5dd7f00921a71c959e1b4b95..1a6b0ac550a8e77ae1e76e3bed20575d16af6a61 100755 (executable)
@@ -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
 
index a39bca468b5fc4e250cd2c20e541971d6447b3bf..1e889749eaa036a2e58b9c7bd02c0648c1991c7e 100755 (executable)
@@ -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