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. - Configure a list of files & directories to be automatically tracked by YADM.
- Tracked directories will also track any new files inside them! - Tracked directories will also track any new files inside them!
- Automatically add, commit, and push tracked paths. - Automatically add, commit, and push tracked paths.
- `.ignore` support with `fd`. - `.ignore`/`.gitignore` support with `fd`.
## Installation ## 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 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 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` you want to specifically ignore `.config/foo/bar.log`. You can use a
file for this: `.ignore`/`.gitignore` file for this:
```sh ```sh
echo "bar.log" > ~/.config/foo/.ignore echo "bar.log" > ~/.config/foo/.ignore
``` ```
The `.ignore` file must be in the root of the directory you've added with The `.ignore`/`.gitignore` file must be in the root of the directory you've
`yadmadd`. You also need `fd` available on your `$PATH` for ignoring to work. added with `yadmadd`. You also need `fd` available on your `$PATH` for ignoring
to work.
### Committing & Pushing ### Committing & Pushing

View file

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