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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx> wrote:
> On Wed, Apr 4, 2012 at 12:21 PM, Tim Henigan <tim.henigan@xxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]