[PATCH 0/4] "diff -p" patch header generation updates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There has always been one thing fishy about the plumbing level "diff" used
to generate patches with "-p" option: we produced a header-only diff when
there is no patch necessary to be shown, when there is no contents change.
We are calling into xdiff to produce a patch, and we should have all the
necessary information to suppress the unnecessary header, but because
historically we didn't, we never updated the code to do so.

It turns out that we already have the necessary machinery to notice such a
situation and suppressing the useless header. We just did not realize that
we could use it. There is a backward compatibility worry for scripts, but
I would imagine that the scripts saw these header-only diff as a nuisance
that needs to be filtered out, not a feature to learn about paths that are
only stat-dirty.  And more importantly, even if this _were_ a feature, it
was not working correctly when "-w" option was in effect to begin with, as
the second one in the series illustrates.

This series changes the world order that is almost 6 years old.  No more
phantom diff headers in patch output due to stat-dirtiness.

The first patch in this series replaces the one I posted earlier (one
block that prepares the expected result was in a wrong test).

The second patch adds test vectors that illustrate the current behaviour
that will be changed with this series.

The third patch is the real change, whose effect can be seen in the patch
to the test the second one introduces.

The fourth one is unrelated from the rest of the series from the feature
point of view, but its implementation depends on the updated semantics of
header suppression.

The series is designed to apply on top of v1.7.4-rc0~147 and has trivial
conflict in diff.h if applied/merged to 'master'.  Just take the addition
of DIFF_OPT* macros from both sides.

Junio C Hamano (4):
  t4011: modernise style
  t4011: illustrate "diff-index -p" on stat-dirty paths
  diff -p: squelch "diff --git" header for stat-dirty paths
  diff --ignore-mode-change

 diff.c                  |   31 +++++++-
 diff.h                  |    1 +
 t/t4011-diff-symlink.sh |  196 +++++++++++++++++++++++++++--------------------
 3 files changed, 141 insertions(+), 87 deletions(-)

-- 
1.7.9.2.350.g74d65
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]