#!/bin/sh
#
# tmux-git-peek - display a popup containing short git log
# and spanning 65% in width and height so one can easily "peek" at it
#
# popup window will close when user quits the log screen.
# should be invoked only from within a git working tree.

# shellcheck disable=SC2312

cd "$(tmux display-message -p -F '#{pane_current_path}')" || exit 1

[ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = true ] \
  || exec tmux display-message -d 1000 "Not in a Git repository!"

# tmux display-popup -E -w 65% -h 65% -d '#{pane_current_path}' \
tmux display-popup -w 65% -h 65% -d '#{pane_current_path}' \
  git log --oneline --color --graph --decorate || true
