3

I have this idea that the more keystrokes expended to decorate a commit, the more likely it is that useful thoughts are embedded in that commit. How might I find these? A commit with a single line, merely a subject, is not worth seeking out:

ran updated format rules

Whereas a commit like this might be worth encountering:

changed fetch of base64 images

Changed the way we return base64 images when fetching for content because when we clear out the deleted image form s3 and update the content with a empty key it causes an exception trying fetch base64 images with an invalid key.

This is because the actual database delete happens after we have returned response to MSC. Ideally we could move the delete to project theseus and then no longer do the db call on the MSC side. For now this should work.

How could I retrieve a list of such commits from the git log?

djeikyb
  • 4,470
  • 3
  • 35
  • 42
  • Possibly a solution using [`git rebase -i --exec` or `git rev-list`](https://stackoverflow.com/q/26983700/3282436), though I bet it would take a while to run on large repos. – 0x5453 Jan 20 '22 at 18:40

2 Answers2

1
git rev-list --all | git cat-file --batch-check | sort -nk3

or instead of the sort you could do something like

git rev-list --all | git cat-file --batch-check \
| awk '$3 > 300 {print $1}' | git log --no-walk --stdin
jthill
  • 55,082
  • 5
  • 77
  • 137
0

Welp I finally broke down and wrote a thing, copied here:

#!/bin/sh

countWords() {
    commit="$1"
    word_count=$(git show --format='%B' --no-patch "$commit" | wc -w)
    auth="$(git show --format='%h %aN / %cN' --no-patch $commit)"
    echo "$word_count $auth"
    exit 0
}

[ -n "$2" ] && countWords "$2"

range="origin/master"
[ -n "$1" ] && range="origin/master~$1..origin/master" 

echo "$range"

git log --format='%H' "$range" | xargs -I{} -P 16 $0 --last "{}"

To get the word count of the last ten commits:

git wc 10

To get the word count of all commits:

git wc
djeikyb
  • 4,470
  • 3
  • 35
  • 42