From b5aa87edac87adf51c018b8e91be7856317e082b Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Thu, 10 Jun 2021 11:12:47 +0200 Subject: [PATCH] config/git: improve log viewing experience --- .config/doom/config.el | 1 - .config/git/config | 1 + .local/bin/scripts/git-lno | 6 +++--- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.config/doom/config.el b/.config/doom/config.el index e314ed5..9ef2527 100644 --- a/.config/doom/config.el +++ b/.config/doom/config.el @@ -296,7 +296,6 @@ Version 2019-11-04 2021-02-16" ;; Org startup - https://orgmode.org/manual/In_002dbuffer-Settings.html (setq org-startup-folded 'show2levels - org-startup-with-inline-images t org-display-remote-inline-images 'cache) ;; Fix xdg-open & pdfs - https://depp.brause.cc/dotemacs/#orgd97f08c diff --git a/.config/git/config b/.config/git/config index 0cbd8d5..228760d 100644 --- a/.config/git/config +++ b/.config/git/config @@ -94,6 +94,7 @@ #dir = !git root | sed 's/$/\\/.git/' | grep --color=never "/" # grep ensures a proper exit status on fail lg = log --pretty=tformat:'%C(auto)%h%d %s %Cgreen(%cd) %Cblue<%an>%Creset' --date=human --graph + lgo = lg HEAD @{push} lo = log --pretty=tformat:'%C(auto)%h%d %s %Cgreen(%cd) %Cblue<%an>%Creset' --date=human --no-merges lp = log -p --date=local ln = !git --no-pager lo "-$(a=$(git rev-list --count HEAD...@{push} 2>/dev/null); expr $a + 3 \\& ${a:-0} \\> 4 \\| 7)" --color=always --graph HEAD @{u} 2>/dev/null | head -9 || git --no-pager lo -7 diff --git a/.local/bin/scripts/git-lno b/.local/bin/scripts/git-lno index bc41f23..bc793ff 100755 --- a/.local/bin/scripts/git-lno +++ b/.local/bin/scripts/git-lno @@ -1,12 +1,12 @@ #!/bin/zsh # Log local and upstream commits side by side # Useful when the history has been manipulated -loc="$(git ln --color=always "$@")" -upstream="$(git ln --color=always @{push} "$@")" +loc="$(git lo --color=always "$@")" +upstream="$(git lo --color=always @{push} "$@")" a=$(echo $loc | wc -l) b=$(echo $upstream | wc -l) halfcols="$(expr $(tput cols) / 2)" for i in $(seq 1 $(test $a -le $b && echo "$a" || echo "$b")); do printf "%-${halfcols}s $(test $halfcols -lt 100 && echo '\\n')%s\n" "$(echo $loc | head -n $i | tail -1)" "$(echo $upstream | head -n $i | tail -1)" # use columns instead? - need to interleave! -done +done | ${PAGER:-less}