summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kmo@daterainc.com>2013-10-01 13:59:39 -0700
committerKent Overstreet <kmo@daterainc.com>2013-10-01 13:59:39 -0700
commit8caf0ed8b6b5eded626945a7142f4d21add2fa09 (patch)
treec65b2a4b8542fa0bd4041503a653f874be24a0d4
Git scripts
-rwxr-xr-xgit-l15
-rwxr-xr-xgit-lg15
2 files changed, 30 insertions, 0 deletions
diff --git a/git-l b/git-l
new file mode 100755
index 0000000..155f162
--- /dev/null
+++ b/git-l
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+width=$((`tput cols` - 10))
+width2=$(($width - 2))
+
+if tty -s <&1; then
+ PRETTY='--pretty=format:%Cred%h %Cgreen%cd %Creset %s%x00%C(bold black)%an%Creset%C(yellow)%d'
+else
+ PRETTY='--pretty=format:%h %cd %s%x00%an%d'
+fi
+
+exec git log --abbrev-commit --date=short "$PRETTY" "$@" \
+ |gawk --re-interval -F '\\0' \
+ '{ printf "%-'$width's%s\n", gensub(/^(.{'$width2'}).{2,}$/, "\\1… ", 1, $1), $2 }' \
+ |less -R
diff --git a/git-lg b/git-lg
new file mode 100755
index 0000000..a078a53
--- /dev/null
+++ b/git-lg
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+width=$((`tput cols` - 29))
+width2=$(($width - 2))
+
+if tty -s <&1; then
+ PRETTY='--pretty=format:%Cred%h %Creset %s%x00%Cgreen%cd%x00%C(bold black)%an%Creset%C(yellow)%d'
+else
+ PRETTY='--pretty=format:%h %s%x00%cd%x00%an%d'
+fi
+
+exec git log --abbrev-commit --date=relative --graph "$PRETTY" "$@" \
+ |gawk --re-interval -F '\\0' \
+ '{ printf "%-'$width's%18s %s\n", gensub(/^(.{'$width2'}).{2,}$/, "\\1… ", 1, $1), $2, $3 }' \
+ |less -R