Re: difftool -d not populating left correctly when not in git root
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Dec 5, 2016, 11:46 UTC
- Message-ID
- <alpine.DEB.2.20.1612051222560.117539@virtualbox>
- In-Reply-To
- <20161204223139.kk2ejrfc5elxmsro@gmail.com>
Hi David,
On Sun, 4 Dec 2016, David Aguilar wrote:
Show 22 quoted lines
> Date: Sun, 4 Dec 2016 14:27:17 -0800 > Subject: [PATCH] difftool: properly handle being launched from a subdirectory > > 9ec26e797781239b36ebccb87c590e5778358007 corrected how path arguments > are handled in a subdirectory, but it introduced a regression in how > entries outside of the subdirectory are handled by the dir-diff. > > When preparing the right-side of the diff we only construct the parts > that changed. > > When constructing the left side we construct an index, but we were > constructing it relative to the subdirectory, and thus it ends up empty > because we are in a subdirectory and the paths are incorrect. > > Teach difftool to chdir to the toplevel of the repository before > preparing its temporary indexes. This ensures that all of the > toplevel-relative paths are valid. > > Add a test case to exercise this use case. > > Reported-by: Frank Becker <fb@mooflu.com> > Signed-off-by: David Aguilar <davvid@gmail.com>
I applied this to my builtin-difftool branch (which, as per Peff's suggestion, runs t7800 both with and without the builtin difftool) and the tests pass:
https://github.com/dscho/git/commit/9b9a69c5ee975a4a2565343ae0a9199a6ac89609
Which means that the builtin difftool already had fixed the bug, more by coincidence than by design, I have to admit.
Ciao, Johannes