Skip to content

"diff --no-index" updates

Junio C Hamano git 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest2 patches 0 repliesNew

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2diff-no-index: DWIM "diff D F" into "diff D/F F"diff-no-index.c t/t4053-diff-no-index.sh+65 -00 replies
2/2diff: align D/F handling of "diff --no-index" with that of normal Gitdiff-no-index.c t/t4053-diff-no-index.sh+33 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/2] "diff --no-index" updates

Here are a few patches to scratch my itches in "diff --no-index" I have had for quite some time, but didn't feel strong enough to fix them myself so far.

The first one is to make "diff File Directory" (and "diff Directory File") more useful by aligning its behaviour with more mainstream "diff" implementations. We used to complain that one is a file and the other is a directory and died without doing anything useful. Instead, we pretend as if the user asked to compare "diff File Directory/File" (or vice versa), which is what GNU diff does.

The second one on the other hand is to make it behave more like the normal "git diff" when comparing two directories, when one directory has a path as a file while the other directory has the same path as a directory. GNU diff punts and says "File D1/path is a regular file while file D2/path is a directory" in such a case, and that is what "diff --no-index" does, too, but when the normal "git diff" compares two such trees, we show a removal of the file and creations of all the files in the directory (or vice versa). With this patch, we teach "diff --no-index" codepath to do the same, which would be more in line with the spirit of "diff --no-index", which is to make "git diff" goodies available to people who compare paths outside control of any git repository.

Junio C Hamano (2):
diff-no-index: DWIM "diff D F" into "diff D/F F"
diff: align D/F handling of "diff --no-index" with that of normal Git

 diff-no-index.c          | 66 ++++++++++++++++++++++++++++++++++++++++++++++--
 t/t4053-diff-no-index.sh | 34 +++++++++++++++++++++++++
 2 files changed, 98 insertions(+), 2 deletions(-)
Signature · 1 line
2.3.4-475-g3180e2e