From: Junio C Hamano <hidden> Date: 2016-06-15 22:42:22
$ git diff-tree -p 52e8a6^2 52d8a6 -- git-fetch.sh
shows a change that trivially is redundant, like this:
diff --git a/git-fetch.sh b/git-fetch.sh
index b4325d9..de4f011 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -320,7 +320,7 @@ fetch_main () {
( : subshell because we muck with IFS
IFS=" $LF"
(
- git-fetch-pack $exec $keep "$remo...
+ git-fetch-pack $exec $keep --thin...
) |
while read sha1 remote_name
do
@@ -367,21 +367,26 @@ fetch_main "$reflist"
# automated tag following
case "$no_tags$tags" in
-'')
- taglist=$(IFS=" " &&
- git-ls-remote $upload_pack --tags "$remote" |
...
- done)
+'')
+ case "$reflist" in
+ *:refs/*)
...
Notice the first '-' and '+' lines of second hunk are identical?
There is another interesting thing. This is running diff
between 52e8a6^2 and 52d8a6 blobs, but if I change them slightly
so that the first hunk is not different, then this anomaly
disappears.
$ git diff-tree -p 52e8a6^2 52d8a6 -- git-fetch.sh
shows a change that trivially is redundant, like this:
diff --git a/git-fetch.sh b/git-fetch.sh
index b4325d9..de4f011 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -320,7 +320,7 @@ fetch_main () {
( : subshell because we muck with IFS
IFS=" $LF"
(
- git-fetch-pack $exec $keep "$remo...
+ git-fetch-pack $exec $keep --thin...
) |
while read sha1 remote_name
do
@@ -367,21 +367,26 @@ fetch_main "$reflist"
# automated tag following
case "$no_tags$tags" in
-'')
- taglist=$(IFS=" " &&
- git-ls-remote $upload_pack --tags "$remote" |
...
- done)
+'')
+ case "$reflist" in
+ *:refs/*)
...
Notice the first '-' and '+' lines of second hunk are identical?
There is another interesting thing. This is running diff
between 52e8a6^2 and 52d8a6 blobs, but if I change them slightly
so that the first hunk is not different, then this anomaly
disappears.
Could you send me the two files that creates the above diff?
- Davide
From: Junio C Hamano <hidden> Date: 2016-06-15 22:42:22
Davide Libenzi [off-list ref] writes:
On Sun, 2 Apr 2006, Junio C Hamano wrote:
quoted
$ git diff-tree -p 52e8a6^2 52d8a6 -- git-fetch.sh
shows a change that trivially is redundant, like this:
diff --git a/git-fetch.sh b/git-fetch.sh
index b4325d9..de4f011 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -320,7 +320,7 @@ fetch_main () {
..
Notice the first '-' and '+' lines of second hunk are identical?
There is another interesting thing. This is running diff
between 52e8a6^2 and 52d8a6 blobs, but if I change them slightly
so that the first hunk is not different, then this anomaly
disappears.
Could you send me the two files that creates the above diff?
I should have tried your pristine xdiff code myself before
bothering you, but I haven't (sorry).
The problem is from the "stripped down" version we use in git,
so you may or may not see the problem in your version. Attached
are the files.
I should have tried your pristine xdiff code myself before
bothering you, but I haven't (sorry).
It definitely happens with plain libxdiff-0.17 too.
In general, unless it's related to the "\ No newline" or the extra stuff
on the "@@"-line, I'd be very surprised if we have any differences in the
diff output wrt libxdiff-0.17. I was really pretty careful, and didn't
change the code at all, just removed unnecessary files and functions.
Linus
I should have tried your pristine xdiff code myself before
bothering you, but I haven't (sorry).
The problem is from the "stripped down" version we use in git,
so you may or may not see the problem in your version. Attached
are the files.
Yes, it does even vanilla libxdiff ;) It's not a problem though, since it
is created in xdl_cleanup_records() that tries to do a fast pass over the
records to try to simplify the real diff operation. In trying to be fast,
only hashes are compared, and it happens that the hash for "'')" collides
with another one (try to replace one of the "'')" chars with another one).
Why is this not a problem? Because what this lead to is only lines to be
marked as changed, with a probability of about N/2^(8 * sizeof(long) - 1),
even though they are not. And this happens only during sequential groups
of lines changed, that is when the hash-colliding line is either at the
begin or the end of the run.
- Davide
I should have tried your pristine xdiff code myself before
bothering you, but I haven't (sorry).
It definitely happens with plain libxdiff-0.17 too.
In general, unless it's related to the "\ No newline" or the extra stuff
on the "@@"-line, I'd be very surprised if we have any differences in the
diff output wrt libxdiff-0.17. I was really pretty careful, and didn't
change the code at all, just removed unnecessary files and functions.
So it does 0.18, that contains the "\ No newline" handling for text diff
and patch. See my reply to Junio also.
- Davide
Yes, it does even vanilla libxdiff ;) It's not a problem though, since it is
created in xdl_cleanup_records() that tries to do a fast pass over the records
to try to simplify the real diff operation. In trying to be fast, only hashes
are compared, and it happens that the hash for "'')" collides with another one
(try to replace one of the "'')" chars with another one). Why is this not a
problem? Because what this lead to is only lines to be marked as changed, with
a probability of about N/2^(8 * sizeof(long) - 1), even though they are not.
And this happens only during sequential groups of lines changed, that is when
the hash-colliding line is either at the begin or the end of the run.
Hmm. It's still ugly, though. No possibility to have a "clean up identical
initial and final lines" stage to get rid of extraneous bogus diffs?
I look at diffs a lot, and while this may be rare, if I were to end up
having to wonder what the difference is and it turns out that it's just
due to a libxdelta thing, I'd be a bit irritated and wish it gave me a
proper diff..
Linus
Yes, it does even vanilla libxdiff ;) It's not a problem though, since it is
created in xdl_cleanup_records() that tries to do a fast pass over the records
to try to simplify the real diff operation. In trying to be fast, only hashes
are compared, and it happens that the hash for "'')" collides with another one
(try to replace one of the "'')" chars with another one). Why is this not a
problem? Because what this lead to is only lines to be marked as changed, with
a probability of about N/2^(8 * sizeof(long) - 1), even though they are not.
And this happens only during sequential groups of lines changed, that is when
the hash-colliding line is either at the begin or the end of the run.
Hmm. It's still ugly, though. No possibility to have a "clean up identical
initial and final lines" stage to get rid of extraneous bogus diffs?
It does ;) If you make the second hunk (the one with the '') line) to be
the first, the shrink-initial-and-final lines optimizations will make it
eat the '') line.
I look at diffs a lot, and while this may be rare, if I were to end up
having to wonder what the difference is and it turns out that it's just
due to a libxdelta thing, I'd be a bit irritated and wish it gave me a
proper diff..
Thanks. I've made the first "release" (2.6.17-rc1) with the new built-in
diff, let's see if somebody has any issues.
But just the fact that I could do an almost 24MB diff (6MB compressed)
with 738 _thousand_ lines in about 4 seconds is damn nice. The script I
use to cut releases (logs, diffstats, tar-files etc) used to take a long
time with BK, these days it's a couple of seconds.
Linus
Thanks. I've made the first "release" (2.6.17-rc1) with the new built-in
diff, let's see if somebody has any issues.
No problem. That's only an eye-issue though, since the diff is still a
valid diff according to its definition where D=A-B => B+D==A && A-D==B
From the day I released 0.18, xregression is continuosly running w/out any
issue. I'll check it out though ...
- Davide
$ git diff-tree -p 52e8a6^2 52d8a6 -- git-fetch.sh
shows a change that trivially is redundant, like this:
diff --git a/git-fetch.sh b/git-fetch.sh
index b4325d9..de4f011 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -320,7 +320,7 @@ fetch_main () {
..
Notice the first '-' and '+' lines of second hunk are identical?
There is another interesting thing. This is running diff
between 52e8a6^2 and 52d8a6 blobs, but if I change them slightly
so that the first hunk is not different, then this anomaly
disappears.
Could you send me the two files that creates the above diff?
I should have tried your pristine xdiff code myself before
bothering you, but I haven't (sorry).
The problem is from the "stripped down" version we use in git,
so you may or may not see the problem in your version. Attached
are the files.
This is the change I made to libxdiff. Xregression already made a few
thousands on iterations w/out problems.
- Davide