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();