From 188f97bc38500e19a293a629ec286a524447146b Mon Sep 17 00:00:00 2001 From: David Arnold Date: Thu, 4 May 2023 09:13:06 -0500 Subject: [PATCH] fix: ensure gitignore entries are relative to root problem: ```.gitignore treefmt.toml ``` can't be added: some/path/treefmt.toml solution: ```.gitignore /treefmt.toml ``` qed --- lib/hooks/link.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/hooks/link.nix b/lib/hooks/link.nix index d0f5f67..ac9d8ec 100644 --- a/lib/hooks/link.nix +++ b/lib/hooks/link.nix @@ -38,15 +38,15 @@ in then touch .gitignore fi - if ! grep -qF "${output}" .gitignore + if ! grep -qF "/${output}" .gitignore then if ! grep -qF "${gitignore-sentinel}" .gitignore then echo -e "\n# nixago: ${gitignore-sentinel}" >> .gitignore fi - newgitignore="$(awk '1;/${gitignore-sentinel}/{ print "${output}"; }' .gitignore)" + newgitignore="$(awk '1;/${gitignore-sentinel}/{ print "/${output}"; }' .gitignore)" echo -e -n "$newgitignore" > .gitignore git add .gitignore - log "${ansi.bold}${ansi."11"}'${output}' added to .gitignore${ansi.reset}" + log "${ansi.bold}${ansi."11"}'/${output}' added to .gitignore${ansi.reset}" fi ''