git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Proper tracking of copies in git log and others
@ 2009-07-04 16:24 Lasse Kärkkäinen
  2009-07-04 18:31 ` Sean Estabrooks
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Lasse Kärkkäinen @ 2009-07-04 16:24 UTC (permalink / raw)
  To: git

Getting full history of a file, including that beyond copies, is rather 
important and apparently not currently supported by git tools.

An example use case:

# Create repository
mkdir courses
cd courses
git init
# Course 2007
mkdir -p 2007/exercise1
echo Hello > 2007/exercise1/description.txt
mkdir 2007/exercise2
echo World > 2007/exercise2/description.txt
git add 2007
git commit -m "Course 2007"
# Course 2008
mkdir -p 2008/exercise1
echo New one > 2008/exercise1/description.txt
git add 2008
git commit -m "Course 2008 exercise 1 (new)"
cp -R 2007/exercise1 2008/exercise2
git add 2008/exercise2
git commit -a -m "Course 2008 exercise 2 (from 2007 exercise 1)"
# Course 2009
cp -R 2008 2009
git add 2009
git commit -m "Course 2009 recycled entirely from 2008"

Now, if we do git log --follow 2009/exercise2/description.txt or 
2009/exercise2, it only prints the "Course 2009" commit instead of the 
full history because --follow doesn't follow copies. What we actually 
want is:

commit 9e17341497b29735bc55b6631b43db6e2f50ed30
Author: Lasse Karkkainen <tronic@trn.iki.fi>
Date:   Sat Jul 4 19:05:57 2009 +0300

     Course 2009 recycled entirely from 2008

commit 8fd13a8667f0bc5c4851b366864a207fa85519bc
Author: Lasse Karkkainen <tronic@trn.iki.fi>
Date:   Sat Jul 4 19:05:57 2009 +0300

     Course 2008 exercise 2 (from 2007 exercise 1)

commit 593346660872ada80ba751688fffc7af7a31e124
Author: Lasse Karkkainen <tronic@trn.iki.fi>
Date:   Sat Jul 4 19:05:57 2009 +0300

     Course 2007

Note: the "Course 2008 exercise 1 (new)" commit is not listed, as it is 
unrelated to 2009/exercise2.

Some nice people from #git suggested various commands that would find 
the previous version (e.g. 2008/exercise2) etc, but none of those got 
even close to getting this full history over multiple copies, with log 
messages.

It would be useful if the git tools could produce history like this with 
all the tools (log, blame, gitk, etc), preferably with proper branching 
guesses (guesses because there is no info on where the copy came from), 
but even a linear history (sorted by commit time?) would do much better 
than not having anything.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-07-14 12:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-04 16:24 Proper tracking of copies in git log and others Lasse Kärkkäinen
2009-07-04 18:31 ` Sean Estabrooks
2009-07-14 12:19   ` Lasse Kärkkäinen
2009-07-07  6:53 ` Graeme Geldenhuys
2009-07-07 13:48 ` Michael J Gruber
2009-07-07 14:59   ` Avery Pennarun

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).