From 53260886fdfd08547e7a9e5b8861d25b35dc6411 Mon Sep 17 00:00:00 2001 From: Hugo LEVY-FALK Date: Fri, 26 Jul 2024 13:24:29 +0200 Subject: [PATCH] Add a test for empty file list in git hook suggestion (#26) As it was, the proposed git hook will fail if no Julia file has been edited in the commit (for example if we only edited Project.toml). --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5015113..9d01d34 100644 --- a/README.md +++ b/README.md @@ -213,7 +213,10 @@ exec 1>&2 # Run Runic on added and modified files mapfile -t files < <(git diff-index --name-only --diff-filter=AM master | grep '\.jl$') -julia --project=@runic -m Runic --check --diff "${files[@]}" + +if [ ${#files[@]} -gt 0 ]; then + julia --project=@runic -m Runic --check --diff "${files[@]}" +fi ``` ## Formatting specification