Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ensure gitignore entries are relative to root #54

Merged
merged 1 commit into from
May 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
  • Loading branch information
blaggacao committed May 4, 2023
commit 188f97bc38500e19a293a629ec286a524447146b
6 changes: 3 additions & 3 deletions lib/hooks/link.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
''