]> git.phdru.name Git - git-scripts.git/commitdiff
Rename touch-all -> set-commit-date
authorOleg Broytman <phd@phdru.name>
Mon, 15 Jun 2015 03:15:38 +0000 (06:15 +0300)
committerOleg Broytman <phd@phdru.name>
Mon, 15 Jun 2015 03:15:38 +0000 (06:15 +0300)
hooks/post-checkout/set-last-commit-date [moved from hooks/post-checkout/touch with 63% similarity]
hooks/post-checkout/set-last-commit-date-all [new file with mode: 0755]
hooks/post-checkout/touch-all [deleted file]
set-commit-date [moved from touch-all with 73% similarity]
set-commit-date-repos [new file with mode: 0755]
touch-ALL-repos [deleted file]

similarity index 63%
rename from hooks/post-checkout/touch
rename to hooks/post-checkout/set-last-commit-date
index 2c5e625330c5d18b0ce0a50dccb408df4cddc640..a39bca468b5fc4e250cd2c20e541971d6447b3bf 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
-# post-checkout hook that changes timestamps on files to that one of the commit
-# if branch was changed
+# post-checkout hook that changes timestamps on known files
+# to that one of the last commit (head) if branch was changed
 
 prev_HEAD="$1"
 new_HEAD="$2"
diff --git a/hooks/post-checkout/set-last-commit-date-all b/hooks/post-checkout/set-last-commit-date-all
new file mode 100755 (executable)
index 0000000..e950e4c
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+# post-checkout hook that changes timestamps on all files
+# to that one of the last commit (head) if branch was changed
+
+prev_HEAD="$1"
+new_HEAD="$2"
+new_branch="$3"
+
+if [ "$new_branch" = 1 ]; then
+   commit_date="`git show --format='%cD' | head -1`" &&
+   find . \( -name .git -type d -prune \) -o \
+      -exec touch --date="$commit_date" '{}' \+
+fi
+
+exit 0
diff --git a/hooks/post-checkout/touch-all b/hooks/post-checkout/touch-all
deleted file mode 100755 (executable)
index 2f5e80c..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-# post-checkout hook that changes timestamps on files to that one of the commit
-# if branch was changed
-
-prev_HEAD="$1"
-new_HEAD="$2"
-new_branch="$3"
-
-if [ "$new_branch" = 1 ]; then
-   commit_date="`git show --format='%cD' | head -1`" &&
-   find . \( -name .git -type d -prune \) -o -exec touch --date="$commit_date" '{}' \+
-fi
-
-exit 0
similarity index 73%
rename from touch-all
rename to set-commit-date
index 3c2b213864d43607afab396d30480aa44e4e1c41..fcc75397acf92ebc1138c78360189bc6638bd549 100755 (executable)
--- a/touch-all
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# Recursively find commit date/time for every file in the current directory
+# Recursively find commit date/time for every known file in the repository
 # and set the file's modification time to that date/time.
 
 git ls-tree -r --name-only HEAD | while read filename; do
diff --git a/set-commit-date-repos b/set-commit-date-repos
new file mode 100755 (executable)
index 0000000..99e04ce
--- /dev/null
@@ -0,0 +1,11 @@
+#! /bin/sh
+
+# Call set-commit-date on all repositories.
+
+cd "`dirname \"$0\"`" &&
+prog_dir="`pwd`" &&
+
+exec "$prog_dir"/do-all \
+   'test "$g" = "$d/.git" || continue &&' \
+   'cd "$d"; echo "$d"; "$prog_dir"/set-commit-date &&' \
+   'git submodule foreach "$prog_dir"/set-commit-date'
diff --git a/touch-ALL-repos b/touch-ALL-repos
deleted file mode 100755 (executable)
index 3454a6e..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#! /bin/sh
-
-cd "`dirname \"$0\"`" &&
-prog_dir="`pwd`" &&
-
-exec "$prog_dir"/do-all \
-   'test "$g" = "$d/.git" || continue; cd "$d" &&' \
-   'echo "$d" && "$prog_dir"/touch-all &&' \
-   'git submodule foreach "$prog_dir"/touch-all'