summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Kirianovskii <ilia.kirianovskii@lgepartner.com>2016-05-12 10:04:57 +0300
committerIlia Kirianovskii <ilia.kirianovskii@lgepartner.com>2016-05-24 04:39:24 +0000
commit9443890d60388f27f04b5a87013ca76f9afcc225 (patch)
tree0de004e79c07628bac1608967699dd54bf388972
parente50f5b915017882abcd287d53b794b9c3ed16f42 (diff)
downloadqt5-9443890d60388f27f04b5a87013ca76f9afcc225.tar.gz
Fix git_install_hooks for relative gitdir
Previously we expected gitdir to be always absolute. This patch fixes git_install_hooks in case of relative gitdir. Change-Id: Ia0883af18229703aaa22c62fd2181ed56d9f2fce Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
-rwxr-xr-xinit-repository24
1 files changed, 13 insertions, 11 deletions
diff --git a/init-repository b/init-repository
index 2580b0f6..954237d0 100755
--- a/init-repository
+++ b/init-repository
@@ -155,9 +155,10 @@ EOF
}
use Carp qw( confess );
+use Cwd qw( getcwd abs_path );
use English qw( -no_match_vars );
+use File::Spec::Functions qw ( rel2abs );
use Getopt::Long qw( GetOptions );
-use Cwd qw( getcwd abs_path );
my $script_path = abs_path($0);
$script_path =~ s,[/\\][^/\\]+$,,;
@@ -558,24 +559,25 @@ sub git_install_hooks
my @configresult = qx(git config --list --local);
foreach my $line (@configresult) {
next if ($line !~ /submodule\.([^.=]+)\.url=/);
- my $module = $1.'/.git';
- if (!-d $module) {
- open GITD, $module or die "Cannot open $module: $!\n";
+ my $module = $1;
+ my $module_gitdir = $module.'/.git';
+ if (!-d $module_gitdir) {
+ open GITD, $module_gitdir or die "Cannot open $module: $!\n";
my $gd = <GITD>;
close GITD;
chomp($gd);
- $gd =~ s/^gitdir: // or die "Malformed .git file $module\n";
- $module = $gd; # We expect it to be always absolute.
- if (open COMD, $module.'/commondir') {
+ $gd =~ s/^gitdir: // or die "Malformed .git file $module_gitdir\n";
+ $module_gitdir = rel2abs($gd, $module);
+ if (open COMD, $module_gitdir.'/commondir') {
my $cd = <COMD>;
chomp($cd);
- $module .= '/'.$cd;
- $module = abs_path($module);
+ $module_gitdir .= '/'.$cd;
+ $module_gitdir = abs_path($module_gitdir);
close COMD;
}
}
- $self->ensure_link($hooks.'/gerrit_commit_msg_hook', $module.'/hooks/commit-msg');
- $self->ensure_link($hooks.'/git_post_commit_hook', $module.'/hooks/post-commit');
+ $self->ensure_link($hooks.'/gerrit_commit_msg_hook', $module_gitdir.'/hooks/commit-msg');
+ $self->ensure_link($hooks.'/git_post_commit_hook', $module_gitdir.'/hooks/post-commit');
}
}