git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 0/1] difftool: --no-index is incompatible with --dir-diff
Date: Wed, 08 May 2019 14:52:40 -0700 (PDT)	[thread overview]
Message-ID: <pull.186.git.gitgitgadget@gmail.com> (raw)

While debugging why a straight-forward backport of the js/difftool-no-index 
branch onto Git for Windows' master does not work as expected (spoiler: it's
due to git diff --no-index now implying --ext-diff, a change that is not yet
in Git for Windows' master), I ran into quite a few segmentation faults
while trying to make --no-index work nicely with --dir-diff.

And this was a much bigger project than I thought it would be: the worktree 
is NULL and causes a segmentation fault, make_transient_cache_entry() 
returns NULL instead of a cache entry, while looking up replacement objects
there is a crash because git_replace_ref_base is NULL, during 
checkout_entry()'s life time, the prepare_alt_odb() function tries to
dereference the_repository.objects->odb (which is NULL, of course). I'll
stop here with all the segmentation faults.

Even worse, when trying to compare ../1 to ../2 (as we do in the regression
test for difftool --no-index outside any repository), we run afoul of 
verify_path() complaining that this is not a valid path for an index entry.

After figuring all of that out, I took a step back and guess what: it turns
out that it does not even make sense to combine those two options. The 
--dir-diff option exists to enable diff'ing subdirectories of a worktree
while pretending that untracked and ignored files in them do not even exist.
And without a worktree, there simply are no untracked or ignored files, so 
--dir-diff is not necessary.

Still, we should address those segmentation faults. And I think we address
them best by explicitly telling the user that they cannot use those two
options together.

Johannes Schindelin (1):
  difftool --no-index: error out on --dir-diff (and don't crash)

 builtin/difftool.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)


base-commit: 20de316e33446f37200e51aa333ba7d824dfd478
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-186%2Fdscho%2Fdifftool-no-index-extra-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-186/dscho/difftool-no-index-extra-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/186
-- 
gitgitgadget

             reply	other threads:[~2019-05-08 21:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-08 21:52 Johannes Schindelin via GitGitGadget [this message]
2019-05-08 21:52 ` [PATCH 1/1] difftool --no-index: error out on --dir-diff (and don't crash) Johannes Schindelin via GitGitGadget
2019-05-09  7:29 ` [PATCH 0/1] difftool: --no-index is incompatible with --dir-diff Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.186.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).