Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

BooK (2612)

  {book} {at} {}
Yahoo! ID: philippe_bruhat (Add User, Send Message)

Obfuscation []. Pink []. HTTP::Proxy []. YEF []. Fishnet []. Kapow []. Cog's [] bitch []. Invitation []. White [] Camel []. Nuff' said.

Journal of BooK (2612)

Monday November 23, 2009
07:41 AM


[ #39932 ]

Ever complained that on a checkout Git did not reset the mtime of your files to the date when they were commited?

My home page is generated with Template Toolkit but a script stored in the post-receive hook. On a checkout Git only updates the files that have changed, so normally I can trust template.modtime to be correct and use it to show a Last mofidied date.

But I'm a perfectionist, and I want to be extra sure. So I created this little utility, that I called git-mtime:

    git log --name-only --date=iso --reverse --pretty=format:%at "$@" \
    | perl -00ln -e '($d,@f)=split/\n/;$d{$_}=$d for grep{-e}@f' \
                 -e '}{utime undef,$d{$_},$_ for keys%d'

Note that it passes all parameters to git log, so you can apply it on a subdirectory (using --), or even use the dates from another branch (though I'm not sure what use this can have).

And for extra bonus points, it uses the secret eskimo greeting operator!

Now that I have a few gadgets based on Git, I thought I might as well publish them somewhere. A quick look on Github ruled out git-tools, git-utils and git-extras (come on people, most of these things could be done with Git aliases!). git-aid (especially the plural) didn't seem like a good name either. So after looking around for synonyms, I settled on git-gadgets.

Clone it from

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.