From 63d0c15ef9a2cb8acbc6f8e49bbd68742918d4a9 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Mon, 16 Feb 2015 02:32:32 +0000 Subject: [PATCH] changed the pre-commit hook for old perls --- codepot/etc/pre-commit.in | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/codepot/etc/pre-commit.in b/codepot/etc/pre-commit.in index 1f132d78..8828a248 100644 --- a/codepot/etc/pre-commit.in +++ b/codepot/etc/pre-commit.in @@ -343,9 +343,22 @@ sub restrict_changes_in_directory return -1; } - my $root = $txn->root(); - my $paths_changed = $root->paths_changed(); - foreach my $affected_file(keys $paths_changed) + my $root = eval { $txn->root() }; + if (!defined($root)) + { + print (STDERR "Cannot open root of transaction - $TRANSACTION\n"); + return -1; + } + + my $paths_changed = eval { $root->paths_changed() }; + if (!defined($paths_changed)) + { + # no change information found. return ok + $root->close_root (); + return 0; + } + + foreach my $affected_file(keys %$paths_changed) { my $chg = $paths_changed->{$affected_file}; my $action = $chg->change_kind();