peff
Joined 14 years ago
Karma
655
Submissions
80
Member since
Oct 22
Joined 14 years ago
https://www.reddit.com/r/comicbookcollecting/comments/15vvfj...
git blame --line-porcelain "$1" -L "$2,"$2" |
perl -MPOSIX=strftime -lne '/^author-time (\d+)/ and print strftime("%Y", localtime($1))'
I suppose it would be a little more convenient if you could ask `git blame` to format the whole line itself, but that wouldn't be part of the `--porcelain` output.All that said, that pipeline is quite slow on something like linux.git, as it runs a series of blames which will walk over the same history many times. I think:
git log -STODO --format=%ad --date=short
would be much faster (it's not _quite_ the same thing, as it counts TODOs which went away, but is a reasonable variant).However, if you're more comfortable using GitHub PRs, there's a gateway interface at https://gitgitgadget.github.io/.
This part implies that the index file is written via mmap, but that's not true. It is fully rewritten to a new tempfile/lockfile, and then atomically renamed into place.
Git does not ever mmap with anything but PROT_READ, because not all supported platforms can do writes (in particular, the compat fallback just pread()s into a heap buffer).
rename 's/foo/bar/' *.ext
Of course you have to know Perl...