Skip to content

Commit 41df8dc

Browse files
author
Bill Wood
committed
updates per request of spacewander
1 parent 3ef09da commit 41df8dc

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

Commands.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,9 +1520,9 @@ $ git browse-ci upstream
15201520
15211521
## git utimes
15221522
1523-
Change files modification time to their last commit date. Does not touch files that are in the working tree or index.
1523+
Change files modification time to their last commit date. Does not touch files that are in the working tree or index.
15241524
1525-
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.
1525+
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.
15261526
15271527
```bash
15281528
git-extras$ ls -l bin | head
@@ -1536,6 +1536,7 @@ total 308
15361536
-rwxr-xr-x 1 vt vt 6282 Nov 8 13:56 git-bulk
15371537
-rwxr-xr-x 1 vt vt 18561 Nov 8 13:56 git-changelog
15381538
-rwxr-xr-x 1 vt vt 215 Nov 8 13:56 git-clear
1539+
15391540
git-extras$ git utimes --newer
15401541
+ touch -d 2020-05-22T10:40:29+08:00 bin/git-archive-file
15411542
+ touch -d 2017-05-05T16:02:09+08:00 bin/git-authors
@@ -1546,6 +1547,7 @@ git-extras$ git utimes --newer
15461547
+ touch -d 2019-09-05T12:41:38+08:00 bin/git-changelog
15471548
+ touch -d 2016-11-19T16:41:19+00:00 bin/git-clear
15481549
[...]
1550+
15491551
git-extras$ ls -l bin | head
15501552
total 308
15511553
-rwxr-xr-x 1 vt vt 489 Jul 28 2015 git-alias
@@ -1559,7 +1561,7 @@ total 308
15591561
-rwxr-xr-x 1 vt vt 215 Nov 19 2016 git-clear
15601562
```
15611563
1562-
Note above, `git-alias` was not touched because of the `--newer` flag.
1564+
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.
15631565
15641566
## git abort
15651567

bin/git-utimes

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
if [ "$1" = "--touch" ]; then
66
# Internal use option only just to parallelize things.
77
newer_flag=""
8-
[ "$2" = "--newer" ] || [ "$2" = "-n" ] && newer_flag="true"
8+
[ "$2" = "--newer" ] && newer_flag="true"
99
shift 2
1010
bsd=$(date -j > /dev/null 2>&1 && echo 'true')
1111
if [ -n "$bsd" ]; then
@@ -36,7 +36,7 @@ else
3636
# don't touch files that have been modified in the worktree or index
3737
# bsd doesn't have `-z` option for `comm` and `cut`, so use `tr` as work around
3838
prefix="$(git rev-parse --show-prefix) "
39-
comm -23 <(git ls-tree -z -r --name-only --full-name @ | tr '\0' '\n') \
39+
comm -23 <(git ls-tree -z -r --name-only --full-name @ | tr '\0' '\n' | sort) \
4040
<(git status -z --porcelain | tr '\0' '\n' | cut -c 4- | sort) \
4141
| cut -c ${#prefix}- \
4242
| tr '\n' '\0' \

check_dependencies.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ err() {
66
}
77

88
if ! command -v column >/dev/null 2>&1; then
9-
err "Need to install dependency 'column' before installation"
9+
err "Need to install dependency 'column' before installation (can be found in bsdmainutils)"
1010
fi

man/git-utimes.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ git-utimes(1) -- Change files modification time to their last commit date
33

44
## SYNOPSIS
55

6-
`git-utimes` [-n, --newer]
6+
`git-utimes` [--newer]
77

88
## DESCRIPTION
99

10-
Change files modification time to their last commit date. Does not touch files that are in the working tree or index.
10+
Change files modification time to their last commit date. Does not touch files that are in the working tree or index.
1111

1212
## OPTIONS
1313

14-
-n, --newer
14+
--newer
1515

1616
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.
1717

@@ -23,11 +23,11 @@ git-utimes(1) -- Change files modification time to their last commit date
2323

2424
* As above, but preserve original modification time of files that were committed from local repo:
2525

26-
$ git utimes -n
26+
$ git utimes --newer
2727

2828
## AUTHOR
2929

30-
Written by Vitaly Chikunov &lt;<[email protected]>&gt;, inspired by Stackexchange comments. Updated by Bill Wood to add --newer flag and ignore files in the working tree or index.
30+
Written by Vitaly Chikunov &lt;<[email protected]>&gt;, inspired by Stackexchange comments. Updated by Bill Wood &lt;<[email protected]>&gt; to add `--newer` flag and ignore files in the working tree or index.
3131

3232
## REPORTING BUGS
3333

0 commit comments

Comments
 (0)