git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 26, 2015, 06:20 UTC
Message-ID
<1427350832-17005-1-git-send-email-gitster@pobox.com>
In-Reply-To
<xmqqiodtd3b4.fsf@gitster.dls.corp.google.com>

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(-)
-- 
2.3.4-475-g3180e2e
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 7 in “align D/F handling of "diff --no-index" with that of normal Git”
  1. align D/F handling of "diff --no-index" with that of normal GitJunio C Hamano, Mar 22, 2015
  2. Eric SunshineMar 22, 2015
  3. Ramsay JonesMar 22, 2015
  4. Junio C HamanoMar 22, 2015
  5. 0/2 "diff --no-index" updatesJunio C Hamano, Mar 26, 2015
  6. 1/2 diff-no-index: DWIM "diff D F" into "diff D/F F"Junio C Hamano, Mar 26, 2015
  7. 2/2 diff: align D/F handling of "diff --no-index" with that of normal GitJunio C Hamano, Mar 26, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.