commit 5aa30478a76e81de36d13aaa98df095caeca6502
parent b096f9499dd38e6e00b62807442a14d74b8102ab
Author: hhvn <dev@hhvn.uk>
Date: Thu, 29 Apr 2021 19:11:57 +0100
.c/g/effort .c/g/config .c/g/m/m/git-ef.1: add git-ef
Diffstat:
3 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/.config/git/config b/.config/git/config
@@ -13,6 +13,7 @@
re = !sh ~/.config/git/remote
pu = !sh ~/.config/git/push
pa = !sh ~/.config/git/push --all
+ ef = !sh ~/.config/git/effort
br = branch
se = send-email
ad = add
diff --git a/.config/git/effort b/.config/git/effort
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# idea:
+# https://gist.github.com/Xeoncross/4020489
+
+git log --shortstat --author "$1" | awk '
+ /file[s]* changed.*insert/ {
+ files+=$1; inserted+=$4; deleted+=$6
+ next
+ }
+
+ /file[s]* changed/ {
+ files+=$1; deleted+=$4
+ }
+
+ END {
+ printf("Files changed:\t%s\nInsertions:\t%s\nDeletions:\t%s\n", files, inserted, deleted);
+ }'
diff --git a/.config/git/man/man1/git-ef.1 b/.config/git/man/man1/git-ef.1
@@ -0,0 +1,14 @@
+.Dd 27 Apr 2021
+.Dt git-ef 1
+.Os hhvn-git(7)
+.Sh Name
+.Nm git-ef
+.Nd calculate changes ("effort") in git repo
+.Sh SYNOPSIS
+.Nm git ef
+.Op Ar author
+.Sh DESCRIPTION
+.Nm
+traverses history to count the total number of changes, insertions and deletions.
+.Sh AUTHOR
+.An hhvn Aq Mt dev@hhvn.uk .