>From 94798369412749560910507a55a375c961025685 Mon Sep 17 00:00:00 2001 From: Andy Beverley <a...@andybev.com> Date: Sat, 27 Dec 2014 21:31:33 +0000 Subject: [PATCH 2/6] Reset Git environment variables to ensure correct repo is used
Under some circumstances when building recursively, it's possible that Git environment variables will be set from previous builds, which then point to the wrong repo directories. This patches always undefines them before each call to Git. --- lib/DhMakePerl/Command/make.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/DhMakePerl/Command/make.pm b/lib/DhMakePerl/Command/make.pm index b0bd9fb..4761ae7 100644 --- a/lib/DhMakePerl/Command/make.pm +++ b/lib/DhMakePerl/Command/make.pm @@ -718,6 +718,12 @@ sub git_import_upstream__init_debian { require Git; + # The Git environment variables may be set from previous iterations + # of this program being run. In this case, it's possible that the + # Git module will use these to point to the wrong source tree. + delete $ENV{'GIT_DIR'}; + delete $ENV{'GIT_WORK_TREE'}; + Git::command( 'init', $self->main_dir ); my $git = Git->repository( $self->main_dir ); @@ -748,6 +754,12 @@ sub git_add_debian { require Git; require File::Which; + # The Git environment variables may be set from previous iterations + # of this program being run. In this case, it's possible that the + # Git module will use these to point to the wrong source tree. + delete $ENV{'GIT_DIR'}; + delete $ENV{'GIT_WORK_TREE'}; + my $git = Git->repository( $self->main_dir ); $git->command( 'add', 'debian' ); $git->command( 'commit', '-m', -- 1.7.10.4