diff options
author | Kent Overstreet <kmo@daterainc.com> | 2013-10-01 13:59:39 -0700 |
---|---|---|
committer | Kent Overstreet <kmo@daterainc.com> | 2013-10-01 13:59:39 -0700 |
commit | 8caf0ed8b6b5eded626945a7142f4d21add2fa09 (patch) | |
tree | c65b2a4b8542fa0bd4041503a653f874be24a0d4 |
Git scripts
-rwxr-xr-x | git-l | 15 | ||||
-rwxr-xr-x | git-lg | 15 |
2 files changed, 30 insertions, 0 deletions
@@ -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 @@ -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 |