All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Plotnick <shrike@netaxs.com>
To: git@vger.kernel.org
Subject: Re: [PATCH v0 0/2] git-less: a specialized pager for git-log
Date: Fri, 23 Mar 2012 16:44:10 -0400	[thread overview]
Message-ID: <87obrn6o9x.fsf@sol.localdomain> (raw)
In-Reply-To: 4F6C4B59.8060102@op5.se

[-- Attachment #1: Type: text/plain, Size: 394 bytes --]

I have on occasion also wished to view log messages (especially with
patches) one at a time. And although I agree that a dedicated pager is
overkill, perhaps a small script wouldn't be.

The attached script will eventually run afoul of argument length limits,
but seems to work well otherwise. If you're using less(1), you can step
through the files using :n, :p, and :x.

Cheers,

    -- Alex

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: View git log as one file per commit --]
[-- Type: text/x-shellscript, Size: 584 bytes --]

#!/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*

  parent reply	other threads:[~2012-03-23 20:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-22 18:42 [PATCH v0 0/2] git-less: a specialized pager for git-log Hitoshi Mitake
2012-03-22 18:42 ` [PATCH v0 1/2] " Hitoshi Mitake
2012-03-22 18:42 ` [PATCH v0 2/2] git-less: git side support for git-less Hitoshi Mitake
2012-03-22 19:00 ` [PATCH v0 0/2] git-less: a specialized pager for git-log Junio C Hamano
2012-03-23 10:07   ` Andreas Ericsson
2012-03-23 17:18     ` Hitoshi Mitake
2012-03-23 20:44     ` Alex Plotnick [this message]
2012-03-30 14:23       ` Jeff Epler
2012-03-23 17:15   ` Hitoshi Mitake
2012-03-24  4:43 ` Nguyen Thai Ngoc Duy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87obrn6o9x.fsf@sol.localdomain \
    --to=shrike@netaxs.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.