From: Daniel Penkin <dpenkin@gmail.com>
To: git@vger.kernel.org
Subject: Incorrect unified diff when run with "--find-copies-harder"
Date: Sun, 24 Jun 2018 20:36:36 +1000 [thread overview]
Message-ID: <CAL78Jw0mQWxO4xkzFBoG0Oe4wjomUGj=dP5ufdUrE5Ku0GGEtg@mail.gmail.com> (raw)
Hello,
I believe I found a bug in how Git represents a diff when invoked with
"--find-copies-harder" parameter.
Specifically, the unified diff header of a hunk contains an extra
piece of text which appears to be a line from the context (i.e.
unchanged line), something like this:
> git diff --find-copies-harder d00ca3f 20fb313
diff --git a/test.txt b/copy.txt
similarity index 81%
copy from test.txt
copy to copy.txt
index 734156d..43a3f9d 100644
--- a/test.txt
+++ b/copy.txt
@@ -2,6 +2,7 @@ line 1
line 2
line 3
line 4
+added line
line 5
line 6
line 7
Note "line 1" after the standard unified diff header.
I prepared a sample repository with a minimal file I can reproduce
this problem with:
https://bitbucket.org/dpenkin/find-copies-harder-bug
I'm running Git 2.18.0 on a macOS, but I also tried with Git 2.15.0
and 2.8.6 running on Alpine Linux and was able to reproduce the same
problem.
Please advise whether this is expected output or is indeed a bug.
Thank you.
Kind regards,
Daniil Penkin
next reply other threads:[~2018-06-24 10:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-24 10:36 Daniel Penkin [this message]
2018-06-24 13:33 ` Incorrect unified diff when run with "--find-copies-harder" Andrei Rybak
2018-06-24 14:42 ` Daniel Penkin
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAL78Jw0mQWxO4xkzFBoG0Oe4wjomUGj=dP5ufdUrE5Ku0GGEtg@mail.gmail.com' \
--to=dpenkin@gmail.com \
--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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).