git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Piotr Krukowiecki <piotr.krukowiecki@gmail.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [RFC] git blame-tree
Date: Wed, 2 Mar 2011 19:39:20 +0100	[thread overview]
Message-ID: <AANLkTi=m_WTohMfJZxTqObRT3rhhtxo=QfnDJCHO=U0K@mail.gmail.com> (raw)
In-Reply-To: <20110302180722.GA20287@sigill.intra.peff.net>

On Wed, Mar 2, 2011 at 7:07 PM, Jeff King <peff@peff.net> wrote:
> On Wed, Mar 02, 2011 at 06:51:57PM +0100, Piotr Krukowiecki wrote:
>
>> On Wed, Mar 2, 2011 at 6:16 PM, Jeff King <peff@peff.net> wrote:
>> > I considered making it a special mode of "git blame" when blame is fed a
>> > directory instead of a file. But the implementations aren't shared at
>> > all (nor do I think they need to be; blame-tree is _way_ simpler). And I
>>
>> git blame dir/file.c
>>   "Show what revision and author last modified each line of a file"
>>
>> git blame dir/
>>   "Show what revision and author last modified each file"
>
> Right, I think we are agreeing.
>
>> This makes sense to me (the user).  I don't understand the
>> implementation thing. I don't see a difference between those two
>> commands. Even more, if I'm educated  Unix user I might know
>> directories are also files.
>
> I mean the implementations are very different, so there was not much
> point in putting the code into builtin/blame.c.

Ah, ok.


>> > didn't want to steal that concept in case somebody can think of a more
>> > content-level way of blaming a whole tree that makes sense (obviously
>> > just showing the concatenation of the blames of each file is one way,
>> > but I don't know how useful that would be). If we want to go that way,
>> > we can always catch the special case in blame and just exec blame-tree.
>>
>> Still can be in git-blame command, no?
>
> Right. What I meant was that we don't have to make the decision now. If
> people like blame-tree, we can later magically turn:
>
>  git blame dir
>
> into "git blame-tree dir". So I think we are just agreeing.

I hope nobody likes "blame-dir" :)


>> > The initial set of interesting files we come up with is gotten by
>> > looking at the tree of the first pending object after parsing the rev
>> > options (defaulting to HEAD). Which sounds a little flaky to me, but
>> > does what you want in practice. I'd be curious if somebody can come up
>> > with a counterexample where the ability to manually specify the source
>> > tree would be more useful.
>>
>> Same argument as for normal blame: I want to know who modified files at
>> the state of commit X (if I understand the question correctly).
>
> Yeah, that's what it does now. Specifically I was wondering about more
> elaborate examples, like:
>
>  git blame-tree dir branch1 branch2
>
> It will traverse using both branch1 and branch2, but get the initial
> list of files from branch1. I guess we could also union those trees or
> something.

I'd expect this to be something like union. Currently I can only think about
following case:

Some files were changed in branch1, some in branch2, some in both.
Show me how the files are changed. For example:
  file1 changed in branch1 in commit1
  file2 changed in branch2 in commit2
  file3 changed in branch1 in commit3 and in branch2 in commit4

If file was not changed since branch creation then don't show it (optionally).

But maybe this is more like a diff or log than a blame. Maybe there's already
such mode - I could not find it.


$ git init
Initialized empty Git repository in /tmp/a/.git/
$ echo a > a
$ echo b > b
$ echo c > c
$ git add .
$ git commit -a -m new
[master (root-commit) af5d319] new
 3 files changed, 3 insertions(+), 0 deletions(-)
 create mode 100644 a
 create mode 100644 b
 create mode 100644 c
$ git branch branch1
$ echo trunk1 > a
$ git commit -a -m trunk1
[master 2dc7f47] trunk1
 1 files changed, 1 insertions(+), 1 deletions(-)
$ echo trunk2 > b
$ git commit -a -m trunk1
[master 736fcd2] trunk1
 1 files changed, 1 insertions(+), 1 deletions(-)
$ git checkout branch1
Switched to branch 'branch1'
$ echo branch1 > c
$ git commit -a -m branch1
[branch1 52e371d] branch1
 1 files changed, 1 insertions(+), 1 deletions(-)
$ echo branch2 > b
$ git commit -a -m branch2
[branch1 9fed07c] branch2
 1 files changed, 1 insertions(+), 1 deletions(-)
$ git diff --stat branch1 master
 a |    2 +-
 b |    2 +-
 c |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)


I would like to see output like this:
 a   2dc7f47  (master)
 b   736fcd2  (master)
 b   9fed07c  (branch1)
 c   52e371d  (branch1)


Not sure how useful it would be. Just an idea.


> But I expect most calls to be:
>
>  git blame-tree dir commit
>
> and that's it.

Me too.


-- 
Piotrek

  reply	other threads:[~2011-03-02 18:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-02 16:40 [RFC] git blame-tree Jeff King
2011-03-02 17:16 ` Jeff King
2011-03-02 17:51   ` Piotr Krukowiecki
2011-03-02 18:07     ` Jeff King
2011-03-02 18:39       ` Piotr Krukowiecki [this message]
2011-03-02 21:10         ` Jeff King
2011-03-02 21:24           ` Piotr Krukowiecki
2011-03-02 21:41             ` Jeff King
2011-03-02 18:31   ` Junio C Hamano
2011-03-02 21:04     ` Jeff King
2011-03-02 23:22       ` Junio C Hamano
2011-03-03 15:36         ` Jeff King
2011-03-05  5:41     ` Ryan Tomayko
2011-03-03 20:20   ` Jakub Narebski
2011-03-02 17:40 ` Jeff King
2011-03-04 14:40 ` Will Palmer
2011-03-04 14:53   ` Jeff King

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to='AANLkTi=m_WTohMfJZxTqObRT3rhhtxo=QfnDJCHO=U0K@mail.gmail.com' \
    --to=piotr.krukowiecki@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).