Git development
 help / color / mirror / Atom feed
From: "Björn Steinbrink" <B.Steinbrink@gmx.de>
To: Pete Harlan <pgit@pcharlan.com>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Ian Hilt <ian.hilt@gmx.com>,
	sverre@rabbelier.nl, Git Mailing List <git@vger.kernel.org>
Subject: Re: git rev-list ordering
Date: Wed, 19 Nov 2008 09:26:38 +0100	[thread overview]
Message-ID: <20081119082638.GA3538@atjola.homenet> (raw)
In-Reply-To: <4923256B.3000807@pcharlan.com>

On 2008.11.18 12:28:27 -0800, Pete Harlan wrote:
> I have a script that runs periodically where I need to know the email
> address of who added $file to the system, for a handful of $files,
> because I'm moving them somewhere else and want to let them know.  The
> most recent commits aren't interesting, it's the first commit that matters.
> 
> I use:
> 
>   git rev-list --reverse --pretty=format:%ae HEAD -- $file
> 
> and the second line has the information I need.
> 
> Perhaps there's a more straightforward way to answer the question "who
> first put this file here".
> 
> (One can imagine that may be no "first", because $file merged from
> different paths, but in mine as in many real-world cases, it (a) won't
> happen and (b) whatever happens will be fine if it does.)
> 
> I don't need this to work differently than it does, but perhaps it
> constitutes an "interesting situation where you need to list the oldest
> n commits"?

What you're asking for are commits that added the file, and you can tell
git to find them, instead of using the --reverse work-around:

git log --diff-filter=A --pretty=format:%ae HEAD -- $file

If you're running that with a single file, you might want to add
--follow and maybe add R to the diff-filter as well (to get the renaming
commits).

Björn

      reply	other threads:[~2008-11-19  8:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-16  0:44 git rev-list ordering Ian Hilt
2008-11-16  1:27 ` Sverre Rabbelier
2008-11-16  1:44   ` Ian Hilt
2008-11-16 21:16     ` Johannes Schindelin
2008-11-17  1:21       ` Ian Hilt
2008-11-17  1:35         ` Johannes Schindelin
2008-11-18 20:28       ` Pete Harlan
2008-11-19  8:26         ` Björn Steinbrink [this message]

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=20081119082638.GA3538@atjola.homenet \
    --to=b.steinbrink@gmx.de \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=ian.hilt@gmx.com \
    --cc=pgit@pcharlan.com \
    --cc=sverre@rabbelier.nl \
    /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