updates per request of spacewander

This commit is contained in:
Bill Wood 2022-05-05 11:19:30 -04:00
parent 3ef09dac72
commit 41df8dc7f3
4 changed files with 13 additions and 11 deletions

View file

@ -1520,9 +1520,9 @@ $ git browse-ci upstream
## git utimes ## git utimes
Change files modification time to their last commit date. Does not touch files that are in the working tree or index. Change files modification time to their last commit date. Does not touch files that are in the working tree or index.
The `-n` or `--newer` flag preserves the original modification time of files that were committed from the local repo, by only touching files that are newer than their last commit date. The `--newer` flag preserves the original modification time of files that were committed from the local repo, by only touching files that are newer than their last commit date.
```bash ```bash
git-extras$ ls -l bin | head git-extras$ ls -l bin | head
@ -1536,6 +1536,7 @@ total 308
-rwxr-xr-x 1 vt vt 6282 Nov 8 13:56 git-bulk -rwxr-xr-x 1 vt vt 6282 Nov 8 13:56 git-bulk
-rwxr-xr-x 1 vt vt 18561 Nov 8 13:56 git-changelog -rwxr-xr-x 1 vt vt 18561 Nov 8 13:56 git-changelog
-rwxr-xr-x 1 vt vt 215 Nov 8 13:56 git-clear -rwxr-xr-x 1 vt vt 215 Nov 8 13:56 git-clear
git-extras$ git utimes --newer git-extras$ git utimes --newer
+ touch -d 2020-05-22T10:40:29+08:00 bin/git-archive-file + touch -d 2020-05-22T10:40:29+08:00 bin/git-archive-file
+ touch -d 2017-05-05T16:02:09+08:00 bin/git-authors + touch -d 2017-05-05T16:02:09+08:00 bin/git-authors
@ -1546,6 +1547,7 @@ git-extras$ git utimes --newer
+ touch -d 2019-09-05T12:41:38+08:00 bin/git-changelog + touch -d 2019-09-05T12:41:38+08:00 bin/git-changelog
+ touch -d 2016-11-19T16:41:19+00:00 bin/git-clear + touch -d 2016-11-19T16:41:19+00:00 bin/git-clear
[...] [...]
git-extras$ ls -l bin | head git-extras$ ls -l bin | head
total 308 total 308
-rwxr-xr-x 1 vt vt 489 Jul 28 2015 git-alias -rwxr-xr-x 1 vt vt 489 Jul 28 2015 git-alias
@ -1559,7 +1561,7 @@ total 308
-rwxr-xr-x 1 vt vt 215 Nov 19 2016 git-clear -rwxr-xr-x 1 vt vt 215 Nov 19 2016 git-clear
``` ```
Note above, `git-alias` was not touched because of the `--newer` flag. Note above, that because of the `--newer` flag, the file `git-alias` was not touched since its modified date is earlier than the commit date.
## git abort ## git abort

View file

@ -5,7 +5,7 @@
if [ "$1" = "--touch" ]; then if [ "$1" = "--touch" ]; then
# Internal use option only just to parallelize things. # Internal use option only just to parallelize things.
newer_flag="" newer_flag=""
[ "$2" = "--newer" ] || [ "$2" = "-n" ] && newer_flag="true" [ "$2" = "--newer" ] && newer_flag="true"
shift 2 shift 2
bsd=$(date -j > /dev/null 2>&1 && echo 'true') bsd=$(date -j > /dev/null 2>&1 && echo 'true')
if [ -n "$bsd" ]; then if [ -n "$bsd" ]; then
@ -36,7 +36,7 @@ else
# don't touch files that have been modified in the worktree or index # don't touch files that have been modified in the worktree or index
# bsd doesn't have `-z` option for `comm` and `cut`, so use `tr` as work around # bsd doesn't have `-z` option for `comm` and `cut`, so use `tr` as work around
prefix="$(git rev-parse --show-prefix) " prefix="$(git rev-parse --show-prefix) "
comm -23 <(git ls-tree -z -r --name-only --full-name @ | tr '\0' '\n') \ comm -23 <(git ls-tree -z -r --name-only --full-name @ | tr '\0' '\n' | sort) \
<(git status -z --porcelain | tr '\0' '\n' | cut -c 4- | sort) \ <(git status -z --porcelain | tr '\0' '\n' | cut -c 4- | sort) \
| cut -c ${#prefix}- \ | cut -c ${#prefix}- \
| tr '\n' '\0' \ | tr '\n' '\0' \

View file

@ -6,5 +6,5 @@ err() {
} }
if ! command -v column >/dev/null 2>&1; then if ! command -v column >/dev/null 2>&1; then
err "Need to install dependency 'column' before installation" err "Need to install dependency 'column' before installation (can be found in bsdmainutils)"
fi fi

View file

@ -3,15 +3,15 @@ git-utimes(1) -- Change files modification time to their last commit date
## SYNOPSIS ## SYNOPSIS
`git-utimes` [-n, --newer] `git-utimes` [--newer]
## DESCRIPTION ## DESCRIPTION
Change files modification time to their last commit date. Does not touch files that are in the working tree or index. Change files modification time to their last commit date. Does not touch files that are in the working tree or index.
## OPTIONS ## OPTIONS
-n, --newer --newer
Preserves the original modification time of files that were committed from the local repo, by only touching files that are newer than their last commit date. Preserves the original modification time of files that were committed from the local repo, by only touching files that are newer than their last commit date.
@ -23,11 +23,11 @@ git-utimes(1) -- Change files modification time to their last commit date
* As above, but preserve original modification time of files that were committed from local repo: * As above, but preserve original modification time of files that were committed from local repo:
$ git utimes -n $ git utimes --newer
## AUTHOR ## AUTHOR
Written by Vitaly Chikunov &lt;<vt@altlinux.org>&gt;, inspired by Stackexchange comments. Updated by Bill Wood to add --newer flag and ignore files in the working tree or index. Written by Vitaly Chikunov &lt;<vt@altlinux.org>&gt;, inspired by Stackexchange comments. Updated by Bill Wood &lt;<wpwoodjr@gmail.com>&gt; to add `--newer` flag and ignore files in the working tree or index.
## REPORTING BUGS ## REPORTING BUGS