git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Fastest way to set files date and time to latest commit time of each one
@ 2020-08-29  1:36 Ivan Baldo
  2020-08-29  3:20 ` Junio C Hamano
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Ivan Baldo @ 2020-08-29  1:36 UTC (permalink / raw)
  To: git

  Hello.
  I know this is not standard usage of git, but I need a way to have
more stable dates and times in the files in order to avoid rsync
checksumming.
  So I found this
https://stackoverflow.com/questions/2179722/checking-out-old-file-with-original-create-modified-timestamps/2179876#2179876
and modified it a bit to run in CentOS 7:

IFS="
"
for FILE in $(git ls-files -z | tr '\0' '\n')
do
    TIME=$(git log --pretty=format:%cd -n 1 --date=iso -- "$FILE")
    touch -c -m -d "$TIME" "$FILE"
done

  Unfortunately it takes ages for a 84k files repo.
  I see the CPU usage is dominated by the git log command.
  I know a way I could use to split the work for all the CPU threads
but anyway, I would like to know if you guys and girls know of a
faster way to do this.
  Also I know of other utilities that store the metadata in Git, but I
am trying to avoid that for the moment.
  Thanks a lot in advance!
  Have a nice day.
P.s.: please Cc replies to me.

-- 
Ivan Baldo - ibaldo@gmail.com - http://ibaldo.codigolibre.net/
Freelance C++/PHP programmer and GNU/Linux systems administrator.
The sky isn't the limit!

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-09-02 19:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-29  1:36 Fastest way to set files date and time to latest commit time of each one Ivan Baldo
2020-08-29  3:20 ` Junio C Hamano
2020-08-29  4:59   ` Raymond E. Pasco
2020-08-29  4:48 ` Eric Wong
2020-09-02 19:28   ` Ivan Baldo
2020-08-29  6:46 ` Andreas Schwab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).