.git-hooks/pre-commit | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
New commits: commit 0724c35c2886a9e85400f383b0663208fb24b6fa Author: Thorsten Behrens <thorsten.behr...@cib.de> AuthorDate: Fri Jul 10 22:49:06 2020 +0200 Commit: Thorsten Behrens <thorsten.behr...@cib.de> CommitDate: Fri Jul 10 22:52:07 2020 +0200 Fixup pre-commit hook to work with worktrees For git worktree setups, the hooks sit with the original repo (usually the initial clone). Worktrees with older version checkouts then miss the blacklist->excludelist rename, and consequently fail. Change-Id: I5f60fabc7d5856c74d93c4ada54f57574e0fd1a9 diff --git a/.git-hooks/pre-commit b/.git-hooks/pre-commit index 27fba7e487a3..c7d51a1bcb2e 100755 --- a/.git-hooks/pre-commit +++ b/.git-hooks/pre-commit @@ -134,9 +134,15 @@ sub check_style($) my ($h) = @_; my $src = ClangFormat::get_extension_regex(); my @bad_names = (); - my $excluded_list_names = ClangFormat::get_excludelist(); my $clang_format = ClangFormat::find(); + ## Check if ClangFormat has get_excludelist or the old + ## get_blacklist + my $excluded_list_names; + eval { ClangFormat::get_excludelist() }; + if ($@) { $excluded_list_names = ClangFormat::get_blacklist(); } + else { $excluded_list_names = ClangFormat::get_excludelist(); } + # Get a list of non-deleted changed files. open (FILES, "git diff-index --cached --diff-filter=AM --name-only $h |") || die "Cannot run git diff."; while (my $filename = <FILES>) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits