git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* -B option of git log
@ 2013-02-22  0:44 Eckhard Maass
  2013-02-22  0:57 ` Jeff King
  0 siblings, 1 reply; 3+ messages in thread
From: Eckhard Maass @ 2013-02-22  0:44 UTC (permalink / raw)
  To: git

Hello,

As far as I understand the documentation, -B of git-log should help
correct rename detection. But it does not seem to work for me.

Let me get a setup:

$> git init .
Initialized empty Git repository in /tmp/t2/.git/
$> echo 'Lorem ipsum doler sed. Lorem ipsum doler sed. Lorem ipsum doler
sed. Lorem ipsum doler sed.' > a
$> git add a
$> git commit -m 'Init.'
[master (root-commit) b78205c] Init.
 1 file changed, 1 insertion(+)
 create mode 100644 a
$> mv a b
$> echo 'new' > a
$> git add -A .
$> git commit -m '2nd.'
[master a30ca49] 2nd.
 2 files changed, 2 insertions(+), 1 deletion(-)
 create mode 100644 b

Now, I get the following:

$> git log --oneline -B20%/80% -M20% --name-status
a30ca49 2nd.
M       a
A       b
b78205c Init.
A       a

But I would expect that git-log shows me a rename from a to b and a new a.

What is my misunderstanding? (And I tried it also with files with a
couple of lines.)

SEcki

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

* Re: -B option of git log
  2013-02-22  0:44 -B option of git log Eckhard Maass
@ 2013-02-22  0:57 ` Jeff King
  2013-02-22 10:14   ` Eckhard Maass
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff King @ 2013-02-22  0:57 UTC (permalink / raw)
  To: Eckhard Maass; +Cc: git

On Fri, Feb 22, 2013 at 01:44:00AM +0100, Eckhard Maass wrote:

> Let me get a setup:
> 
> $> git init .
> Initialized empty Git repository in /tmp/t2/.git/
> $> echo 'Lorem ipsum doler sed. Lorem ipsum doler sed. Lorem ipsum doler
> sed. Lorem ipsum doler sed.' > a
> $> git add a
> $> git commit -m 'Init.'
> [master (root-commit) b78205c] Init.
>  1 file changed, 1 insertion(+)
>  create mode 100644 a
> $> mv a b
> $> echo 'new' > a
> $> git add -A .
> $> git commit -m '2nd.'
> [master a30ca49] 2nd.
>  2 files changed, 2 insertions(+), 1 deletion(-)
>  create mode 100644 b
> 
> Now, I get the following:
> 
> $> git log --oneline -B20%/80% -M20% --name-status
> a30ca49 2nd.
> M       a
> A       b
> b78205c Init.
> A       a
> 
> But I would expect that git-log shows me a rename from a to b and a new a.

I think the problem is that your test file is so tiny that it falls
afoul of git's MINIMUM_BREAK_SIZE heuristic of 400 bytes (which prevents
false positives on tiny files). Try replacing your "Lorem ipsum" echo
with something like "seq 1 150", and I think you will find the result
you are expecting.

-Peff

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

* Re: -B option of git log
  2013-02-22  0:57 ` Jeff King
@ 2013-02-22 10:14   ` Eckhard Maass
  0 siblings, 0 replies; 3+ messages in thread
From: Eckhard Maass @ 2013-02-22 10:14 UTC (permalink / raw)
  To: git; +Cc: Jeff King

On 02/22/2013 01:57 AM, Jeff King wrote:
> I think the problem is that your test file is so tiny that it falls
> afoul of git's MINIMUM_BREAK_SIZE heuristic of 400 bytes (which prevents
> false positives on tiny files). Try replacing your "Lorem ipsum" echo
> with something like "seq 1 150", and I think you will find the result
> you are expecting.
Thanks. Two points, though:

With bigger files, I do get something like:
| M100  d
| R100  d       e

The rename is fine. But I am a bit puzzled mit the M - I, somehow,
would have expected an A for add and not a M.

Secondly, would it be a good idea to enhance the documentation on
that point to clarify this minimum size?

SEcki

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

end of thread, other threads:[~2013-02-22 10:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-22  0:44 -B option of git log Eckhard Maass
2013-02-22  0:57 ` Jeff King
2013-02-22 10:14   ` Eckhard Maass

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