Re: hot to get file sizes in git log output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 20 Oct 2017, Eric Sunshine wrote:

I'm not exactly sure what you mean by size, but if you want to show
how many lines were added and removed by a given commit for each file,
you can use the "--stat" option to produce a diffstat. The "size" of
the files in each commit isn't very meaningful to the commit itself,
but a stat of how much was removed might be more accurate to what
you're looking for.

That's a good suggestion, and hopefully could help David answer his
original question.

I took the request to mean "walk through history, and for each file that
a commit touches, show its size". Which is a bit harder to do, and I
think you need to script a little:

David's mention of "a particular file", suggests to me that something
"bad" happened to one file, and he wants to know in which commit that
"badness" happened. If so, then it sounds like a job for git-bisect.

In this case, I have git store a copy of the state file for chromium (and do a similar thing for firefox), so that if something bad happens and it crashes and looses all 200-400 tabs in a way that it's recovery doesn't work, I can go back to a prior version.

This is done by having the following crontab entries, along with smudge filters that change the one-line json to pretty printed json before the commit.

0 * * * * dlang cd /home/dlang/.config/chromium/Default; git add *Session *Tabs Bookmarks History ; git commit -mupdate > /dev/null 2>&1

0 0 3 * * dlang cd /home/dlang/.config/chromium/Default; git gc --aggressive > /dev/null 2>&1

0 * * * * dlang cd /home/dlang/.mozilla/firefox/bux6mwl1.default/sessionstore-backups; git add *.js ; git commit -mupdate > /dev/null 2>&1

0 0 3 * * dlang cd /home/dlang/.mozilla/firefox/bux6mwl1.default/sessionstore-backups; git gc --aggressive > /dev/null 2>&1

This has saved me many times in the past. But this time I didn't recognize when the problem happened because instead of a crash, it just closed all the tabs except the one that was open. Once I realized all my other tabs were gone, I didn't have time to mess with it for a few days. So the problem could have happened anytime in the last week or two.

I'm sure that when this happened, the files shrunk drastically (from several hundred tabs to a dozen or so will be very obvious).

But I don't have any specific line I can look at, the lines that are there change pretty regularly, and/or would not have changed at the transition.

git whatchanged shows commits like:

commit fb7e54c12ddc7c87c4862806d583f5c6abf3e731
Author: David Lang <david@xxxxxxx>
Date:   Fri Oct 20 11:00:01 2017 -0700

    update

:100644 100644 1a842ca... 290e9dd... M  Default/Bookmarks
:100644 100644 1cd745c... 388a455... M  Default/Current Session
:100644 100644 51074ad... c4dce40... M  Default/Current Tabs

If there was a way to add file size to this output, it would be perfect for what I'm needing.

David Lang



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux