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

Re: [PATCH 8/9 v11] difftool: teach difftool to handle directory diffs

From
Tim Henigan <tim.henigan@gmail.com>
Date
Apr 10, 2012, 15:01 UTC
Message-ID
<CAFouetiBMK+WWU9yOLaO5SLyUO1K_S-YW0LTt5tE5UTcMM8K=w@mail.gmail.com>
In-Reply-To
<CAJDDKr76eMiA4rOHQhar3aToVThDfbc8Ki5tr2PGU_UpDMAVeA@mail.gmail.com>
Hi David,

Thank you for the review. I am working on the changes you suggested, but want to discuss one of them:

On Mon, Apr 9, 2012 at 8:14 AM, David Aguilar <davvid@gmail.com> wrote:
Show 9 quoted lines
> On Wed, Apr 4, 2012 at 12:21 PM, Tim Henigan <tim.henigan@gmail.com> wrote:
>> +
>> +       # If the diff including working copy files and those
>> +       # files were modified during the diff, then the changes
>> +       # should be copied back to the working tree
>> +       my $repo = Git->repository();
>> +       my $workdir = $repo->repo_path() . "/..";
>
> Does this work when $GIT_WORK_TREE / core.worktree are defined?

I had not considered this case and the existing code will certainly ignore alternate work tree locations. To fix the problem, I plan to add something like this:

+sub find_worktree
+{
+       my $worktree;
+       my $env_worktree = $ENV{GIT_WORK_TREE};
+       my $core_worktree = Git::config('core.worktree');
+
+       if (length($env_worktree) > 0) {
+               $worktree = $env_worktree;
+       } elsif (length($core_worktree) > 0) {
+               $worktree = $core_worktree;
+       } else {
+               my $repo = Git->repository();
+               $worktree = $repo->repo_path() . "/..";
+       }
+
+       return $worktree;
+}

Does this look like a reasonable solution? I don't typically use '$GIT_WORK_TREE' or 'core.worktree'. The above function works for me, but I would appreciate some feedback before I send the next revision of the patch (v12!).

Thanks, Tim

Previous: Junio C HamanoNext: Tim Henigan
Message 5 of 9 in “difftool: teach difftool to handle directory diffs”
  1. 8/9 difftool: teach difftool to handle directory diffsTim Henigan, Apr 4, 2012
  2. Tim HeniganApr 4, 2012
  3. David AguilarApr 9, 2012
  4. Junio C HamanoApr 9, 2012
  5. Tim HeniganApr 10, 2012
  6. Tim HeniganApr 10, 2012
  7. David AguilarApr 11, 2012
  8. Tim HeniganApr 11, 2012
  9. David AguilarApr 12, 2012

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.