Forked from phpdude/Git hook sync modification time to last commit time
Last active
August 29, 2015 14:02
Revisions
-
tdurand revised this gist
Jul 21, 2014 . 1 changed file with 6 additions and 2 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,26 +1,30 @@ #!/bin/sh OS=${OS:-`uname`} if [ "$OS" = 'Linux' ] then update_file_timestamp() { file_time=`git log --no-merges --format=%ai "$1" | head -n 1` echo "change timestamp file $file_time $1" touch -d "$file_time" "$1" } elif [ "$OS" = 'FreeBSD' ] || [ "$OS" = 'Darwin' ]; then update_file_timestamp() { file_time=`date -r "$(git log --no-merges --format=%at "$1" | head -n 1)" '+%Y%m%d%H%M.%S'` echo "change timestamp file $file_time $1" touch -h -t "$file_time" "$1" } else echo "timestamp changing not implemented" >&2 exit 1 fi #List all the files of the git repository for file in `git ls-tree -r --name-only HEAD` do if [ -f "$file" ]; then #For each file update the file timestamp with the timestamp of the last commit on this file update_file_timestamp "$file" fi done -
tdurand renamed this gist
Jun 10, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
tdurand renamed this gist
Jun 10, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
tdurand revised this gist
Jun 10, 2014 . 3 changed files with 1 addition and 35 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,13 +0,0 @@ This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,20 +0,0 @@ This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,8 +18,7 @@ else exit 1 fi for file in `git log --no-merges --no-commit-id --pretty="format:" --name-only` do if [ -f "$file" ]; then update_file_timestamp "$file" -
Alexandr Shurigin revised this gist
Mar 10, 2014 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,5 +21,7 @@ fi LIMIT="-${GIT_MERGE_LIMIT:-1}" for file in `git log --no-merges --no-commit-id --pretty="format:" --name-only $LIMIT` do if [ -f "$file" ]; then update_file_timestamp "$file" fi done -
Alexandr Shurigin revised this gist
Mar 10, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,7 @@ else exit 1 fi LIMIT="-${GIT_MERGE_LIMIT:-1}" for file in `git log --no-merges --no-commit-id --pretty="format:" --name-only $LIMIT` do update_file_timestamp "$file" -
Alexandr Shurigin revised this gist
Mar 10, 2014 . 2 changed files with 9 additions and 2 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,4 +4,10 @@ You can download scripts manually and install them yourself, or you can install > curl -s https://gist.githubusercontent.com/phpdude/9464925/raw/install | sh This command will download post-merge script, chmod it, and create post-checkout symlink to post-merge hook. You can also start this script manually with environment variable $GIT_MERGE_LIMIT=100 to updated timestamp of last 100 commits for example. export GIT_MERGE_LIMIT=100 /path/to/my/project/.git/hooks/post-merge This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,8 @@ else exit 1 fi LIMIT=${GIT_MERGE_LIMIT:--1} for file in `git log --no-merges --no-commit-id --pretty="format:" --name-only $LIMIT` do update_file_timestamp "$file" done -
Alexandr Shurigin revised this gist
Mar 10, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,7 @@ else exit 1 fi for file in `git log --no-merges --no-commit-id --pretty="format:" --name-only -1` do update_file_timestamp "$file" done -
Alexandr Shurigin revised this gist
Mar 10, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,7 @@ else exit 1 fi for file in `git show --no-commit-id --no-merges --name-only --pretty="format:" -1` do update_file_timestamp "$file" done -
Alexandr Shurigin revised this gist
Mar 10, 2014 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,21 +4,21 @@ OS=${OS:-`uname`} if [ "$OS" = 'Linux' ] then update_file_timestamp() { file_time=`git log --no-merges --format=%ai "$1" | head -n 1` touch -d "$file_time" "$1" } elif [ "$OS" = 'FreeBSD' ] || [ "$OS" = 'Darwin' ]; then update_file_timestamp() { file_time=`date -r "$(git log --no-merges --format=%at "$1" | head -n 1)" '+%Y%m%d%H%M.%S'` touch -h -t "$file_time" "$1" } else echo "timestamp changing not implemented" >&2 exit 1 fi for file in `git show --no-commit-id --no-merges --name-only --pretty="format:" -2` do update_file_timestamp "$file" done -
Alexandr Shurigin revised this gist
Mar 10, 2014 . 1 changed file with 6 additions and 3 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,11 +3,14 @@ GIT="/usr/bin/env git" CURL="/usr/bin/env curl" SCRIPT="https://gist.githubusercontent.com/phpdude/9464925/raw/post-merge" GITHOME=`$GIT rev-parse --show-toplevel` if [ -z "$GITHOME" ]; then exit fi echo "Changind current dir to Git hooks folder" cd "$GITHOME"/.git/hooks/ || exit echo "Downloading post-merge hook" ($CURL $SCRIPT -s > post-merge) || exit -
Alexandr Shurigin revised this gist
Mar 10, 2014 . 1 changed file with 0 additions and 4 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,10 +5,6 @@ CURL="/usr/bin/env curl" SCRIPT="https://gist.githubusercontent.com/phpdude/9464925/raw/post-merge" GITHOME=`$GIT rev-parse --show-cdup | exit` echo "Changind current dir to Git hooks folder" cd "$GITHOME" || exit cd .git/hooks/ || exit -
Alexandr Shurigin revised this gist
Mar 10, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ GIT="/usr/bin/env git" CURL="/usr/bin/env curl" SCRIPT="https://gist.githubusercontent.com/phpdude/9464925/raw/post-merge" GITHOME=`$GIT rev-parse --show-cdup | exit` if [ -z "$GITHOME" ]; then exit -
Alexandr Shurigin revised this gist
Mar 10, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ CURL="/usr/bin/env curl" SCRIPT="https://gist.githubusercontent.com/phpdude/9464925/raw/post-merge" GITHOME=`$GIT rev-parse --show-cdup` if [ -z "$GITHOME" ]; then exit fi -
Alexandr Shurigin revised this gist
Mar 10, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ if [ !-n "$GITHOME" ]; then fi echo "Changind current dir to Git hooks folder" cd "$GITHOME" || exit cd .git/hooks/ || exit echo "Downloading post-merge hook" -
Alexandr Shurigin revised this gist
Mar 10, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ CURL="/usr/bin/env curl" SCRIPT="https://gist.githubusercontent.com/phpdude/9464925/raw/post-merge" GITHOME=`$GIT rev-parse --show-cdup` if [ !-n "$GITHOME" ]; then exit fi -
Alexandr Shurigin revised this gist
Mar 10, 2014 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,9 +3,14 @@ GIT="/usr/bin/env git" CURL="/usr/bin/env curl" SCRIPT="https://gist.githubusercontent.com/phpdude/9464925/raw/post-merge" GITHOME=`$GIT rev-parse --show-cdup` if [ -n "$GITHOME" ]; then exit fi echo "Changind current dir to Git hooks folder" cd $($GIT rev-parse --show-cdup) || exit cd .git/hooks/ || exit echo "Downloading post-merge hook" -
Alexandr Shurigin revised this gist
Mar 10, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ CURL="/usr/bin/env curl" SCRIPT="https://gist.githubusercontent.com/phpdude/9464925/raw/post-merge" echo "Changind current dir to Git hooks folder" cd $($GIT rev-parse --show-cdup || exit) || exit cd .git/hooks/ || exit echo "Downloading post-merge hook" -
Alexandr Shurigin revised this gist
Mar 10, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,8 +5,8 @@ CURL="/usr/bin/env curl" SCRIPT="https://gist.githubusercontent.com/phpdude/9464925/raw/post-merge" echo "Changind current dir to Git hooks folder" cd $($GIT rev-parse --show-cdup) || exit cd .git/hooks/ || exit echo "Downloading post-merge hook" ($CURL $SCRIPT -s > post-merge) || exit -
Alexandr Shurigin revised this gist
Mar 10, 2014 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,8 @@ CURL="/usr/bin/env curl" SCRIPT="https://gist.githubusercontent.com/phpdude/9464925/raw/post-merge" echo "Changind current dir to Git hooks folder" cd $($GIT rev-parse --show-cdup) cd .git/hooks/ echo "Downloading post-merge hook" ($CURL $SCRIPT -s > post-merge) || exit -
Alexandr Shurigin renamed this gist
Mar 10, 2014 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ Git hook post-merge and post-checkout for sync modification time to last commit time. You can download scripts manually and install them yourself, or you can install it with command > curl -s https://gist.githubusercontent.com/phpdude/9464925/raw/install | sh -
Alexandr Shurigin renamed this gist
Mar 10, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Alexandr Shurigin revised this gist
Mar 10, 2014 . 2 changed files with 6 additions and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ You can download scripts manually and install them yourself, or you can install it with command > curl -s https://gist.githubusercontent.com/phpdude/9464925/raw/install | sh This command will download post-merge script, chmod it, and create post-checkout symlink to post-merge hook. This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,4 +12,4 @@ echo "Downloading post-merge hook" echo "Installing post-merge hook and post-checkout" chmod +x post-merge ln -fs post-merge post-checkout -
Alexandr Shurigin revised this gist
Mar 10, 2014 . No changes.There are no files selected for viewing
-
Alexandr Shurigin revised this gist
Mar 10, 2014 . 1 changed file with 15 additions and 0 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ #!/bin/sh GIT="/usr/bin/env git" CURL="/usr/bin/env curl" SCRIPT="https://gist.githubusercontent.com/phpdude/9464925/raw/post-merge" echo "Changind current dir to Git hooks folder" cd $($GIT rev-parse --show-cdup)/.git/hooks/ echo "Downloading post-merge hook" ($CURL $SCRIPT -s > post-merge) || exit echo "Installing post-merge hook and post-checkout" chmod +x post-merge ln -is post-merge post-checkout -
Alexandr Shurigin revised this gist
Mar 10, 2014 . 1 changed file with 0 additions and 3 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +0,0 @@ -
Alexandr Shurigin created this gist
Mar 10, 2014 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ You can download scripts from git and install it manually into .git/hooks/ folder. Or make it with automatic installer. This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ #!/bin/sh OS=${OS:-`uname`} if [ "$OS" = 'Linux' ] then update_file_timestamp() { file_time=`git log --format=%ai "$1" | head -n 1` touch -d "$file_time" "$1" } elif [ "$OS" = 'FreeBSD' ] || [ "$OS" = 'Darwin' ]; then update_file_timestamp() { file_time=`date -r "$(git log --format=%at "$1" | head -n 1)" '+%Y%m%d%H%M.%S'` touch -h -t "$file_time" "$1" } else echo "timestamp changing not implemented" >&2 exit 1 fi for file in `git show --no-commit-id --name-only --pretty="format:" -2` do update_file_timestamp "$file" done