git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* rename/copy detection not working for git-log?
@ 2009-08-11 13:21 Kevin Green
  2009-08-11 13:42 ` Bruce Stephens
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Green @ 2009-08-11 13:21 UTC (permalink / raw)
  To: git


Hi,

I'm pretty sure I've seen this working as expected at some point in the
past, but I'm now not able to get the full history of a file that's
been moved to another directory and I can't understand why.  Here's a
simple way to reproduce:

  $ git init
  Initialized empty Git repository in /var/tmp/git/.git/
  $ mkdir bin
  $ cat > bin/test.sh
  #!/bin/sh

  echo Hello, world!
  $ git add .
  $ git commit -m 'initial import'
  [master (root-commit) b9dc5be] initial import
   1 files changed, 3 insertions(+), 0 deletions(-)
    create mode 100644 bin/test.sh
  $ mkdir scripts
  $ git mv bin/test.sh scripts/test.sh
  $ git commit -m 'move bin/ to scripts/'
  [master b4c6c72] move bin/ to scripts/
   1 files changed, 0 insertions(+), 0 deletions(-)
    rename {bin => scripts}/test.sh (100%)
  $ echo 'echo Goodbye!' >> scripts/test.sh
  $ git commit -a -m 'make a change in scripts/'
  [master 59830d5] make a change in scripts/
   1 files changed, 1 insertions(+), 0 deletions(-)


This now has full history of:

  $ git log --pretty=oneline
  59830d59f6b4d48b28f2ae8d51e921a9c8842b06 make a change in scripts/
  b4c6c72c548a1c17550c01350beede235d481aa4 move bin/ to scripts/
  b9dc5be440d2c843554e9b0302435d9a6f78cd65 initial import 

and the history of scripts/test.sh is as I expect:

  $ git log --pretty=oneline -- scripts/test.sh
  59830d59f6b4d48b28f2ae8d51e921a9c8842b06 make a change in scripts/
  b4c6c72c548a1c17550c01350beede235d481aa4 move bin/ to scripts/

and the history of bin/test.sh is as I would expect:

  $ git log --pretty=oneline -- bin/test.sh
  b4c6c72c548a1c17550c01350beede235d481aa4 move bin/ to scripts/
  b9dc5be440d2c843554e9b0302435d9a6f78cd65 initial import


But, I would expect that some combination of -M and -C would find me
the full history of the current test.sh script so I could see what
happened to it before it was moved.  (Okay, the example above is not so
interesting, but in the real world, bin/test.sh would have had lots of
commits before moving):

  $ git log --pretty=oneline -M -C -C -- scripts/test.sh
  59830d59f6b4d48b28f2ae8d51e921a9c8842b06 make a change in scripts/
  b4c6c72c548a1c17550c01350beede235d481aa4 move bin/ to scripts/

git-blame seems to get this right:

  $ git blame scripts/test.sh
  ^b9dc5be bin/test.sh     (Kevin Green 2009-08-11 09:07:06 -0400 1) #!/bin/sh
  ^b9dc5be bin/test.sh     (Kevin Green 2009-08-11 09:07:06 -0400 2)
  ^b9dc5be bin/test.sh     (Kevin Green 2009-08-11 09:07:06 -0400 3) echo Hello, world!
  59830d59 scripts/test.sh (Kevin Green 2009-08-11 09:08:29 -0400 4) echo Goodbye!


What am I missing?


Thanks

--Kevin

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

* Re: rename/copy detection not working for git-log?
  2009-08-11 13:21 rename/copy detection not working for git-log? Kevin Green
@ 2009-08-11 13:42 ` Bruce Stephens
  2009-08-11 13:57   ` Kevin Green
  0 siblings, 1 reply; 3+ messages in thread
From: Bruce Stephens @ 2009-08-11 13:42 UTC (permalink / raw)
  To: git

Kevin Green <Kevin.T.Green@morganstanley.com> writes:

[...]

> What am I missing?

I'd guess --follow

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

* Re: rename/copy detection not working for git-log?
  2009-08-11 13:42 ` Bruce Stephens
@ 2009-08-11 13:57   ` Kevin Green
  0 siblings, 0 replies; 3+ messages in thread
From: Kevin Green @ 2009-08-11 13:57 UTC (permalink / raw)
  To: Bruce Stephens; +Cc: git@vger.kernel.org

On 08/11/09 09:42:55, Bruce Stephens wrote:
> Kevin Green <Kevin.T.Green@morganstanley.com> writes:
> 
> [...]
> 
> > What am I missing?
> 
> I'd guess --follow

Ah, yep...  didn't see that earlier.  Exactly what I need, thanks.


--Kevin

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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-11 13:21 rename/copy detection not working for git-log? Kevin Green
2009-08-11 13:42 ` Bruce Stephens
2009-08-11 13:57   ` Kevin Green

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