]> git.phdru.name Git - git-scripts.git/commitdiff
Refactor: `git show --format=` -> `git show --pretty=format:`
authorOleg Broytman <phd@phdru.name>
Thu, 9 Jan 2025 11:44:06 +0000 (14:44 +0300)
committerOleg Broytman <phd@phdru.name>
Thu, 9 Jan 2025 22:28:47 +0000 (01:28 +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
set-commit-date
set-commit-date.py

index 1c87fba880ac9542878fc21be9e876a4d451b87a..4cceb0f059fec41616ad05d098cb77ca0b7bb728 100755 (executable)
@@ -8,7 +8,7 @@ new_HEAD="$2"
 new_branch="$3"
 
 if [ "$new_branch" = 1 ]; then
-   commit_date="`git show --format='%cD' -s`" &&
+   commit_date="`git show --pretty=tformat:'%cD' -s`" &&
    find . \( -name .git -type d -prune \) -o \
       -exec touch --date="$commit_date" '{}' \+
 fi
index 1a6b0ac550a8e77ae1e76e3bed20575d16af6a61..267711e078c4428e0ba45d856c618f9f8ae56e22 100755 (executable)
@@ -8,7 +8,7 @@ new_HEAD="$2"
 new_branch="$3"
 
 if [ "$new_branch" = 1 ]; then
-   commit_date="`git show --format='%cD' -s`" &&
+   commit_date="`git show --pretty=tformat:'%cD' -s`" &&
    touch --date="$commit_date" `git diff --name-only HEAD~`
 fi
 
index 1e889749eaa036a2e58b9c7bd02c0648c1991c7e..f55ea778d3cd772bfdc181b8e8b54c67fbdb5c5c 100755 (executable)
@@ -8,7 +8,7 @@ new_HEAD="$2"
 new_branch="$3"
 
 if [ "$new_branch" = 1 ]; then
-   commit_date="`git show --format='%cD' -s`" &&
+   commit_date="`git show --pretty=tformat:'%cD' -s`" &&
    touch --date="$commit_date" `git ls-files --cached`
 fi
 
index fcc75397acf92ebc1138c78360189bc6638bd549..db48c597b0f303cb44fab56f11fa209713fac538 100755 (executable)
@@ -4,5 +4,5 @@
 # and set the file's modification time to that date/time.
 
 git ls-tree -r --name-only HEAD | while read filename; do
-  touch --date="`git log -1 --format=\"%cD\" -- \"$filename\"`" "$filename"
+  touch --date="`git log -1 --pretty=tformat:\"%cD\" -- \"$filename\"`" "$filename"
 done
index c0aaa8cf999bae085a6ab0c484a7cc23edc7f5bf..67d2c4f98aa069c786ad857c68c37bf9daa89eda 100755 (executable)
@@ -34,7 +34,8 @@ separator = '----- GIT LOG SEPARATOR -----'
 
 git_log = subprocess.Popen(['git', 'log', '-m', '--first-parent',
                             '--name-status', '--no-color',
-                            '--format=%s%%n%%%st' % (separator, date_format)],
+                            '--pretty=tformat:%s%%n%%%st' % (
+                                separator, date_format)],
                            stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
                            universal_newlines=True)
 changed_files = set()