From: Thomas Rast <trast@student.ethz.ch>
To: Phil Hord <phil.hord@gmail.com>
Cc: <git@vger.kernel.org>
Subject: Re: Blaming differences
Date: Tue, 19 Jun 2012 09:07:08 +0200 [thread overview]
Message-ID: <87hau76aqr.fsf@thomas.inf.ethz.ch> (raw)
In-Reply-To: <CABURp0omoLoNaOhD3Vx734aVtm5sbk0E7_2uaZJWrWs=_g84iA@mail.gmail.com> (Phil Hord's message of "Mon, 18 Jun 2012 18:56:55 -0400")
Phil Hord <phil.hord@gmail.com> writes:
> I want something like a product of diff and blame. I want to see some
> kind of "blame" output for each line of "diff -U0".
>
> I tried something like this:
> git blame $changed_files
>
> Is there such a command already?
Perhaps the WIP 'log -L' feature can help:
http://thread.gmane.org/gmane.comp.version-control.git/199385
> I'd also like to do something of the inverse operation: I want to
> find commits within a range whose changes are NOT in some other
> commit. So, say I have these four commits
> A---B---C---D
>
> Where D was created by 'git revert B'.
> I'd like to find out somehow that this is equivalent to
> A--C
>
> So that if I remove B and D completely, the with just A and C will get
> me to the same end result.
>
> Something like 'git list-contributors HEAD' which would show me A and
> C, since these are the only commits that appear in any 'git blame
> $any_file'.
I wonder if these are really equivalent. The first one is perhaps not
feasible: If it can only detect exact reverts, that's not incredibly
helpful; the commit message will probably tell you that it's a revert
anyway. I suspect that distinguishing conflicted reverts from true
changes is AI-complete. You're free to go and try, though :-)
The second one, "find all commits which appear in blame output", is
different: it would only list commits which have surviving lines. For
example,
$ git blame --incremental commit.h | grep -E -o '^[0-9a-f]{40}' | sort -u | wc -l
77
$ git rev-list --no-merges HEAD -- commit.h | wc -l
110
tells me that there are 33 commits changing commit.h without any
surviving lines. However there were no reverts:
$ git log --grep=Revert -- commit.h
comes up empty.
--
Thomas Rast
trast@{inf,student}.ethz.ch
next prev parent reply other threads:[~2012-06-19 7:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-18 22:56 Blaming differences Phil Hord
2012-06-19 7:07 ` Thomas Rast [this message]
2012-06-20 0:35 ` Chris Packham
2012-06-20 2:45 ` Chris Packham
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=87hau76aqr.fsf@thomas.inf.ethz.ch \
--to=trast@student.ethz.ch \
--cc=git@vger.kernel.org \
--cc=phil.hord@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).