git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git rev-list with --name-status?

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 25, 2008, 03:24 UTC
Message-ID
<7vhc4tc4y7.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<2729632a0812241453x4ae50362g4bcd3317e5be0429@mail.gmail.com>
skillzero@gmail.com writes:
Show 7 quoted lines
> 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.
    '                
Previous: skillzero@gmail.comNext: demerphq
Message 2 of 5 in “git rev-list with --name-status?”
  1. skillzero@gmail.comDec 24, 2008
  2. Junio C HamanoDec 25, 2008
  3. demerphqDec 25, 2008
  4. Junio C HamanoDec 25, 2008
  5. skillzero@gmail.comDec 25, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.