git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: skillzero@gmail.com
Cc: git@vger.kernel.org
Subject: Re: git rev-list with --name-status?
Date: Wed, 24 Dec 2008 19:24:32 -0800	[thread overview]
Message-ID: <7vhc4tc4y7.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <2729632a0812241453x4ae50362g4bcd3317e5be0429@mail.gmail.com> (skillzero@gmail.com's message of "Wed, 24 Dec 2008 14:53:00 -0800")

skillzero@gmail.com writes:

> I'd like to also include the output of --name-status so the email
> shows which files were changed by each commit (rather than just a
> summary at the end since our pushes sometimes have a lot of commits in
> them).
>
> git rev-list doesn't seem to support --name-status and git log doesn't
> seem to support --stdin. Is there a better way to do what I want?

The plumbing rev-list never runs diff internally.

Depending on what you want, "git log --stat" or "git log --name-only" or
even "git log --name-status -B -C" may serve you nicely.

"Depending on what you want" is the key phrase that indicates that what
you are asking for would be most likely found in Porcelains, not plumbing.

Even though there is not much reason to _avoid_ using "log" these days,
you could do your own scripting for whatever reason; perhaps you feel like
it would be a more macho thing to do (which isn't), perhaps you want more
customization than options supported by the stock "log" Porcelain gives
you.

In olden days, people scripted around plumbing, partly because the
Porcelains were implemented that way, and partly because the choices the
Porcelains back then gave you was limited than what we have now.  Your
script may look like this:

    git-rev-list --parents $range |
    while read commit parents
    do
            ... do whatever you want with them ...
    done

or

    git-rev-list --pretty --parents $range |
    perl -e '
    	while (<>) {
        	if (/^commit /../^$/) {
			if (/^commit (\S+)(.*)?/) {
				... we have a new commit; flush what
                                ... you accumulated for the previous one.
				... and prepare for this commit.
				... $1 is the commit, $2 has parents you
                                ... can further split
                        }
			... do "header" things here ...
                        next;
                }
                s/^    //;
                ... do "log" things here ...
	}
        ... flush what you accumulated for the last commit.
    '                

  reply	other threads:[~2008-12-25  3:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-24 22:53 git rev-list with --name-status? skillzero
2008-12-25  3:24 ` Junio C Hamano [this message]
2008-12-25 18:24 ` demerphq
2008-12-25 18:59 ` Junio C Hamano
2008-12-25 20:13   ` skillzero

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=7vhc4tc4y7.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=skillzero@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).