fixed support for .gitignore

This commit is contained in:
Daniel Fichtinger 2025-05-06 14:04:08 -04:00
parent 8f0001d293
commit 465bc51b39
2 changed files with 8 additions and 7 deletions

View file

@ -37,7 +37,7 @@ without any problems since October 2024.
- Configure a list of files & directories to be automatically tracked by YADM.
- Tracked directories will also track any new files inside them!
- Automatically add, commit, and push tracked paths.
- `.ignore` support with `fd`.
- `.ignore`/`.gitignore` support with `fd`.
## Installation
@ -110,15 +110,16 @@ To remove a target from tracking, simply delete it from the `tracked` file.
It's possible to ignore certain patterns inside a folder you're otherwise
tracking with `yadmadd`. For example, suppose you've added `.config/foo`, but
you want to specifically ignore `.config/foo/bar.log`. You can use a `.ignore`
file for this:
you want to specifically ignore `.config/foo/bar.log`. You can use a
`.ignore`/`.gitignore` file for this:
```sh
echo "bar.log" > ~/.config/foo/.ignore
```
The `.ignore` file must be in the root of the directory you've added with
`yadmadd`. You also need `fd` available on your `$PATH` for ignoring to work.
The `.ignore`/`.gitignore` file must be in the root of the directory you've
added with `yadmadd`. You also need `fd` available on your `$PATH` for ignoring
to work.
### Committing & Pushing

View file

@ -55,8 +55,8 @@ fi
# This ensures symlinks are not added
if [ -d "$path" ]; then
if [ "$FD" == "true" ]; then
# we prefer fd because it respects .ignore
fd -t f . "$path" -X yadm add
# we prefer fd because it respects .ignore and .gitignore
fd --no-require-git -t f . "$path" -X yadm add
else
find "$path" -type f -exec yadm add {} +
fi