#!/bin/sh # Use csplit(1) to split a git log into one commit per file, then run the # pager on the split files. . $(git --exec-path)/git-sh-setup SPLIT_DIR="$GIT_DIR/split-$$" CSPLIT="csplit -s -k" if csplit --help 2>/dev/null | sane_grep -- "-z" >/dev/null; then CSPLIT="$CSPLIT -z" fi _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]' _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40" _infty=1000000 mkdir "$SPLIT_DIR" && cd "$SPLIT_DIR" || exit 1 trap 'rm -rf "$SPLIT_DIR"' 0 1 2 3 15 git log "$@" | $CSPLIT - "/^commit $_x40/" "{$_infty}" 2>/dev/null git_pager "$SPLIT_DIR"/xx*