git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: git@vger.kernel.org
Subject: Re: On blame/pickaxe
Date: Fri, 13 Oct 2006 00:54:24 -0700	[thread overview]
Message-ID: <7vu028d51r.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <7vr6xddm7h.fsf@assigned-by-dhcp.cox.net> (Junio C. Hamano's message of "Thu, 12 Oct 2006 18:43:46 -0700")

In an earlier message, I talked about pickaxe data structure
that has potential for blaming more than one paths in a single
revision.

I was talking about the future enhancements, but it turns out
that there is a corner case that the feature is already needed
using the classic blame algorithm, and running blame shows its
limitation through.

The scenario is like this:

 - initial has two files A and B
 - branch left renames A to C and adds stuff at the top.
 - branch right renames B to C and adds stuff at the bottom.
 - left and right is merged and leaves one file, C, by taking
   what both branches did.
 - annotate C from the top.

The parts that came from A and B in the initial revision should
be assigned to these files in the initial commit.  If you look
at the blame output, you will see it fails to do so.  pickaxe
gives what is expected.

-- >8 --
#!/bin/sh

if test -d .git
then
        echo 'please run this in a fresh empty directory'
	exit
fi

git init-db

for i in 1 2 3 4 5 6 7 8 9 ; do echo line line line $i ; done >A
for i in A B C D E F G H I ; do echo line line line $i ; done >B

git add A B
git commit --author='Initial <initial@author>' -m initial

git branch right
git branch left

# Left
git checkout left
for i in 1 2 3; do echo added by left; done >C
cat A >>C
rm -f A B
git update-index --add --remove A B C
git commit --author='Left <left@branch>' -m Left

# Right
git checkout right
cat B >C
for i in 1 2 3; do echo added by right; done >>C
rm -f A B
git update-index --add --remove A B C
git commit --author='Right <right@branch>' -m Right

# Merge them; this should fail which is expected
git pull . left
{
	git cat-file blob :3:C
	git cat-file blob :2:C
} >C
git update-index C
git commit --author='Merge <merge@branch>' -m 'Changes are merged.'
rm -f C~*

echo blame
git blame -f -n -t C

echo pickaxe
git pickaxe -f -n -t C

  reply	other threads:[~2006-10-13  7:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-13  1:43 On blame/pickaxe Junio C Hamano
2006-10-13  7:54 ` Junio C Hamano [this message]
2006-10-14 10:26 ` Junio C Hamano
2006-10-14 23:43   ` Junio C Hamano
2006-10-16  2:21     ` Petr Baudis
2006-10-16  6:43       ` Junio C Hamano
2006-10-16 14:02         ` Josef Weidendorfer
2006-10-16 14:15           ` Andy Whitcroft
2006-10-17  0:44             ` Petr Baudis
2006-10-21  3:20               ` Junio C Hamano
2006-10-16 23:45 ` Luben Tuikov
2006-10-17  9:03   ` Junio C Hamano

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=7vu028d51r.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    /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).