Subject: Re: [Bug-vc-dwim] bug#30316: [PATCH] maint: find git worktree

From: Jim Meyering <[email-masked]>
Date: Sat, 17 Feb 2018 14:08:08 +1200

On Mon, Feb 5, 2018 at 3:26 PM, Jim Meyering <[email-masked]> wrote:
> On Thu, Feb 1, 2018 at 9:45 PM, Oleg Pykhalov <[email-masked]> wrote:
>> In addion to my previous message.
>>
>> Oleg Pykhalov <[email-masked]> writes:
>>
>>> The following patch allows to use 'vc-chlog' in the Git worktree instead
>>> of getting “can't determine version control system for DIRECTORY”.
>>
>> Probably a directory is needed, too.  I was little bit confused about
>> that directory is a file and it worked for the first time because I have
>> another version of vc-dwim installed simultaneously.  Apologies.
>>
>> Here is a new patch.
>
> Thank you. I've pushed that along with two other commits that were
> required to complete git worktree support.
> Here are the changes I've just pushed:

The following additional portability fix was required (just pushed):
From 0fa06a8a65316df18b15204931af943e03e9c013 Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email-masked]>
Date: Sat, 17 Feb 2018 12:56:15 +1200
Subject: [PATCH] vc-dwim: port to 5.x that don't automatically use Cwd

* vc-dwim.pl (do_at): "use Cwd" here, too.
Otherwise, "vc-dwim --init" would fail at least with perl v5.16.3.
The new use of do_at exposed that this function used the Cwd module
without first ensuring that it is available.
---
 vc-dwim.pl | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/vc-dwim.pl b/vc-dwim.pl
index 558ae36..75a87fc 100755
--- a/vc-dwim.pl
+++ b/vc-dwim.pl
@@ -549,6 +549,8 @@ sub do_commit ($$$$)
 sub do_at($$)
 {
   my ($dest_dir, $code) = @_;
+  eval 'use Cwd';
+  die $@ if $@;
   my $initial_wd = Cwd::getcwd()
     or die "$ME: getcwd failed: $!\n";
   chdir $dest_dir
-- 
2.13.5