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

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

Previous: David Aguilar
Message 3 of 3 in “difftool -d not populating left correctly when not in git root”
  1. Frank BeckerDec 2, 2016
  2. David AguilarDec 4, 2016
  3. Johannes SchindelinDec 5, 2016

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.