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

git difftool -I and git diff -I behave differently

From
MZMustafa Zengin <mzengin88@gmail.com>
Date
Mar 11, 2021, 20:18 UTC
Message-ID
<CAJ-1jP7fy95V5ROj0gE3UC9zn5f=8pTTGy1Y7cwQtx7DidEhqw@mail.gmail.com>
Hi,
git difftool and git diff behave differently for option -I.
Repro steps:
1. Add a line with "text" into a file (without the quotes)
2. Run
  git diff -I"text"
3. Observe that no output is returned
4. Run
  git difftool -I"text"
5. Observe that the assigned diff tool is opened with the change
including "text".

Expected: In step 5, no diff is shown.

My expectation is based on three things:
1. -S and -G options behave the same for `git diff` and `git difftool`.
2. Quote from https://git-scm.com/docs/git-difftool
    "See git-diff[1] for the full list of supported options."
   It implies that all `git diff` options are inherited to `git difftool`.
3. It looks like the command is attempting to parse the option so it
is not completely ignored. If I make the regex malformed, e.g.
     git difftool -I"*text"
   I get back:
     error: invalid regex given to -I: '*text'

StackOverflow post: https://stackoverflow.com/questions/66574689/git-difftool-with-i-option

Versions tested:
Windows: git version 2.30.0.windows.1
Ubuntu: git version 2.30.2

Thanks, Mustafa

Message 1 of 1 in “git difftool -I and git diff -I behave differently”
  1. Mustafa ZenginMar 11, 2021

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.