]> git.phdru.name Git - git-scripts.git/blob - hooks/post-checkout/touch-all
2f5e80cc0086e01330ef58ce61d721f47d67f6f1
[git-scripts.git] / hooks / post-checkout / touch-all
1 #!/bin/sh
2
3 # post-checkout hook that changes timestamps on files to that one of the commit
4 # if branch was changed
5
6 prev_HEAD="$1"
7 new_HEAD="$2"
8 new_branch="$3"
9
10 if [ "$new_branch" = 1 ]; then
11    commit_date="`git show --format='%cD' | head -1`" &&
12    find . \( -name .git -type d -prune \) -o -exec touch --date="$commit_date" '{}' \+
13 fi
14
15 exit 0