Skip to content

feat(git-utimes): add ability to update directory timestamp#1247

Open
Xenira wants to merge 2 commits intotj:mainfrom
Xenira:feat/utimes-directories
Open

feat(git-utimes): add ability to update directory timestamp#1247
Xenira wants to merge 2 commits intotj:mainfrom
Xenira:feat/utimes-directories

Conversation

@Xenira
Copy link
Copy Markdown

@Xenira Xenira commented Apr 22, 2026

New flag --touch-dirs or -d allows to update directory timestamp when using git utimes command.

Refs: #1246

I haven't done much with awk till now. Only tested under linux with git 2.53.0.

@Xenira Xenira force-pushed the feat/utimes-directories branch from 2d0d280 to 1d33f8b Compare April 22, 2026 14:28
New flag `--touch-dirs` or `-d` allows to update directory timestamp when using `git utimes` command.

Refs: #1249
@Xenira Xenira force-pushed the feat/utimes-directories branch from 1d33f8b to 80d9e2e Compare April 22, 2026 14:30
Comment thread bin/git-utimes Outdated
;;
esac

shift
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shift modifies $@ but has no effect on the for loop's iteration (it already has its own copy).

Comment thread bin/git-utimes Outdated
op=le
;;
--touch-dirs | -d)
log_opts+=(--dirstat=files,0)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--dirstat=files will override --diff-filter=d, so a directory will be touched with a timestamp from a deletion-only commit. Is this expected?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about it we might want to include deletes when touching directories.
That would mirror the unix behaviour where the directory timestamp is updated on file deletes as well.

Comment thread bin/git-utimes Outdated
op=eq

for arg in "$@"; do
case "$arg" in
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation

Comment thread man/git-utimes.1 Outdated
.TH "GIT\-UTIMES" "1" "May 2022" "" "Git Extras"
.\" generated with Ronn-NG/v0.10.1
.\" http://github.com/apjanke/ronn-ng/tree/0.10.1
.TH "GIT\-UTIMES" "1" "January 1980" "" "Git Extras"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why we are back to 1980

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didnt notice that. For some reason ronn can't get a valid date on my system. Fixed.

Comment thread bin/git-utimes
@@ -91,13 +105,17 @@ FILENAME==tmpfile {
}
# skip blank lines
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should update this comment

Comment thread bin/git-utimes
# dirstat line
if ($1 ~ /^.+% .+\/$/) {
# remove percentage before path
gsub(/^.+% /, "", $1)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When calling in a suddir, will a path be stripped twice? One in here, another in line 120

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants