[dh-make-perl] 01/01: Reset Git environment variables to ensure correct repo is used

Damyan Ivanov dmn at moszumanska.debian.org
Sat May 23 15:43:56 UTC 2015


This is an automated email from the git hooks/post-receive script.

dmn pushed a commit to branch master
in repository dh-make-perl.

commit 8dbde447c87fa822af5f2c3d939956e79fc129d3
Author: Damyan Ivanov <dmn at debian.org>
Date:   Sat May 23 15:43:37 2015 +0000

    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.
    
    Closes: #774070
---
 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 e3b1889..c06d04d 100644
--- a/lib/DhMakePerl/Command/make.pm
+++ b/lib/DhMakePerl/Command/make.pm
@@ -713,11 +713,21 @@ EOF
     return $found ? 1 : 0;
 }
 
+sub reset_git_environment {
+    # 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'};
+}
+
 sub git_import_upstream__init_debian {
     my ( $self ) = @_;
 
     require Git;
 
+    $self->reset_git_environment();
+
     Git::command( 'init', $self->main_dir );
 
     my $git = Git->repository( $self->main_dir );
@@ -748,6 +758,8 @@ sub git_add_debian {
     require Git;
     require File::Which;
 
+    $self->reset_git_environment;
+
     my $git = Git->repository( $self->main_dir );
     $git->command( 'add', 'debian' );
     $git->command( 'commit', '-m',

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/dh-make-perl.git



More information about the Pkg-perl-cvs-commits mailing list