Commit graph

727 commits

Author SHA1 Message Date
dependabot[bot] f5838a33e9
Bump pytest from 8.3.3 to 9.0.3 in /test
Bumps [pytest](https://github.com/pytest-dev/pytest) from 8.3.3 to 9.0.3.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/8.3.3...9.0.3)

---
updated-dependencies:
- dependency-name: pytest
  dependency-version: 9.0.3
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-13 23:43:24 +00:00
Erik Flodin bbb58e6625
Add support for "seed" template (#435)
Some checks failed
Tests / Tests (macos-13) (push) Has been cancelled
Tests / Tests (macos-15) (push) Has been cancelled
Tests / Tests (ubuntu-22.04) (push) Has been cancelled
Tests / Tests (ubuntu-24.04) (push) Has been cancelled
Tests / Tests (windows-2022) (push) Has been cancelled
The file will only be created from the template the first run. On
subsequent runs it will not be updated, even if the template has
changed.
2025-03-23 21:32:50 +01:00
Erik Flodin 4214de8d91
Change handling of dirs with alt conditions
Instead of creating symlinks pointing at the directory, create individual
symlinks for each file within the dir alternate (fixes #490).

Also rework how stale symlinks are removed. Now a (stale) symlink will only be
removed if it's pointing at a file that's an altnerate file (fixes #236).
2025-03-18 20:50:34 +01:00
Erik Flodin 7f76a455bb
Fix typos in manpage 2025-03-18 20:21:02 +01:00
Erik Flodin 64fe9ec4bb
Replace ubuntu 20.04 with 22.04
as the 20.04 runner is deprecated and will be removed 2025-04-01.
2025-03-18 20:05:17 +01:00
Erik Flodin 7eabaee84c
Release 3.5.0
Some checks failed
Tests / Tests (macos-13) (push) Has been cancelled
Tests / Tests (macos-15) (push) Has been cancelled
Tests / Tests (ubuntu-20.04) (push) Has been cancelled
Tests / Tests (ubuntu-24.04) (push) Has been cancelled
Tests / Tests (windows-2022) (push) Has been cancelled
* Silence warnings when collecting alt files (#521)
  * Adjust handling of encrypt patterns to match 3.3.0 and older
  * Make encrypt exclude patterns only match encrypted files
  * Automatically exclude alt and template files (#234)
  * Support negative alt conditions (#365)
  * Handle filenames with space in bash completion (#341)
  * Add new yadm.filename template variable (#520)
2025-03-04 00:05:35 +01:00
Erik Flodin 4f4c5e2914
Update CHANGES and prepare for 3.5.0 2025-03-04 00:03:44 +01:00
Erik Flodin 0e0172769d
Add yadm.filename variable to default template processor
Some checks are pending
Tests / Tests (macos-13) (push) Waiting to run
Tests / Tests (macos-15) (push) Waiting to run
Tests / Tests (ubuntu-20.04) (push) Waiting to run
Tests / Tests (ubuntu-24.04) (push) Waiting to run
Tests / Tests (windows-2022) (push) Waiting to run
Similar to yadm.source but reflects the current file also in included
files (#520).
2025-03-03 23:47:16 +01:00
Erik Flodin 2ac90b004c
Fix handling of filenames with space in bash completion (#341)
By calling __gitcompappend with the same suffix as the completion for git
does (i.e. " ") we can remove the call to sort -u as it is no longer
needed (bash seems to remove duplicates) and then spaces are handled correctly.

Also make the completion available in testhost.
2025-03-03 21:36:36 +01:00
Erik Flodin bee1558a4e
Minor cleanups of alt handling
Also correct alt conditions precedence list in manual.
2025-03-02 22:18:09 +01:00
AaronYoung5 9ff5e09650
Add support for negative alt conditions (#522) 2025-03-02 22:06:12 +01:00
Erik Flodin d4796108f4
Automatically exclude alt links and template files
unless yadm.auto-exclude is set to false (#234, #465).

Alt files exclude pattern will be written to $GIT_DIR/info/exclude.yadm-alt and
encrypt files exclude patthern to ...yadm-encrypt. Then these two files will be
merged together and added to $GIT_DIR/info/exclude whenever one of them has
changed.
2025-03-02 21:05:43 +01:00
Erik Flodin 6726730701
parse_encrypt: Don't let e.g. "*.ext" match files in subdirs
Some checks failed
Tests / Tests (macos-13) (push) Has been cancelled
Tests / Tests (macos-15) (push) Has been cancelled
Tests / Tests (ubuntu-20.04) (push) Has been cancelled
Tests / Tests (ubuntu-24.04) (push) Has been cancelled
Tests / Tests (windows-2022) (push) Has been cancelled
This matches the behavior before 3.4.0.

Silent errors from ls-files to avoid warnings about e.g. directories that
aren't readable and also list files that would have been encrypted had they not
been tracked in git (#521).

Fix the patterns written to info/exclude so that they match the same files as
are encrypted (e.g. *.key should only match .key files in the topdir, not in
subdirs).
2025-02-25 23:04:23 +01:00
Erik Flodin 5648f8b337
Release 3.4.0
Some checks failed
Tests / Tests (macos-13) (push) Has been cancelled
Tests / Tests (macos-15) (push) Has been cancelled
Tests / Tests (ubuntu-20.04) (push) Has been cancelled
Tests / Tests (ubuntu-24.04) (push) Has been cancelled
Tests / Tests (windows-2022) (push) Has been cancelled
* Improve and harden alt file regeneration (#466)
* Fix "yadm config" in fish completion (#491)
* Fix "yadm clone" when not run in "$YADM_WORK" (#513)
* Output the actual paths in help message (#376)
* Verify all alt conditions for templates (#478)
* Ignore case in alt and default template conditions (#455, #456)
* Fall back to ID for distro family if ID_LIKE is not available (#494)
* Support overriding distro and distro family (#430)
* Improve support for Bash 3 (the default version on macOS)
* Make "yadm clone --recursive" work as expected (#517)
* Don't include files multiple times in archive (#125)
* Document YADM_HOOK_DATA and YADM_HOOK_DIR env variables (#343)
* Support alt dirs with deeply nested tracked files (#495)
2025-02-09 22:28:48 +01:00
Erik Flodin c90aa86051
Update CHANGES and prepare for 3.4.0 2025-02-09 22:24:18 +01:00
Erik Flodin 7e19d21f09
Document YADM_HOOK_DATA and YADM_HOOK_DIR env variables (#343)
Some checks failed
Tests / Tests (macos-13) (push) Has been cancelled
Tests / Tests (macos-15) (push) Has been cancelled
Tests / Tests (ubuntu-20.04) (push) Has been cancelled
Tests / Tests (ubuntu-24.04) (push) Has been cancelled
Tests / Tests (windows-2022) (push) Has been cancelled
2025-01-27 22:25:03 +01:00
Erik Flodin 1505b7ec8f
Add test to verify that file is only included once in archive
As of the switch (in 4511f5d9) to use git ls-files to list files to include in
archive, duplicate matches are automatically removed (fixes #125).
2025-01-27 21:54:10 +01:00
Erik Flodin 02b4019bc6
Add support and tests for clone --recurse-submodules
Some checks failed
Tests / Tests (macos-13) (push) Has been cancelled
Tests / Tests (macos-15) (push) Has been cancelled
Tests / Tests (ubuntu-20.04) (push) Has been cancelled
Tests / Tests (ubuntu-24.04) (push) Has been cancelled
Tests / Tests (windows-2022) (push) Has been cancelled
Including tests for clone --recursive.
2025-01-20 00:01:22 +01:00
Christof Warlich a86f2381b6
Make "yadm clone --recursive" work as expected (#517)
The --recursive switch was ignored when YADM clones a dotfile repository.
This commit causes "yadm clone --recursive" to also clone submodules
in one go, similar to what GIT does when given the --recursive switch.
2025-01-14 22:45:50 +01:00
Erik Flodin f33e7c2e1f
Run tests on github windows runner using WSL
Some checks failed
Tests / Tests (macos-13) (push) Has been cancelled
Tests / Tests (macos-15) (push) Has been cancelled
Tests / Tests (ubuntu-20.04) (push) Has been cancelled
Tests / Tests (ubuntu-24.04) (push) Has been cancelled
Tests / Tests (windows-2022) (push) Has been cancelled
2025-01-09 22:15:22 +01:00
Erik Flodin 0f5ee86b38
test: Make distroy family detection work as in yadm
So that family is properly set also on e.g. debian.
2025-01-09 22:08:50 +01:00
Christof Warlich 1e5612d707
Fix testing with WSL (#516) 2025-01-09 21:46:58 +01:00
Erik Flodin 1d69ce370c
Merge pull request #491
Some checks failed
Tests / Tests (macos-13) (push) Has been cancelled
Tests / Tests (macos-15) (push) Has been cancelled
Tests / Tests (ubuntu-20.04) (push) Has been cancelled
Tests / Tests (ubuntu-24.04) (push) Has been cancelled
2024-12-15 17:25:27 +01:00
Erik Flodin 119d1ddbaa
Refactor template handling
Move common template logic out to a new template() function that calls one of
the existing template processors and then handles writing the result and
copying permissions.
2024-12-15 16:15:14 +01:00
Erik Flodin eb819782ee
Merge pull request #466 from rasa/improve-template-logic 2024-12-15 16:14:50 +01:00
Ross Smith II 7a4de1a247
Always remove temp_file on failure, other cleanup 2024-12-15 16:13:25 +01:00
Erik Flodin f5dfc7ab01
Format yadm and bootstrap with shfmt
Some checks failed
Tests / Tests (macos-13) (push) Has been cancelled
Tests / Tests (macos-15) (push) Has been cancelled
Tests / Tests (ubuntu-20.04) (push) Has been cancelled
Tests / Tests (ubuntu-24.04) (push) Has been cancelled
Command: shfmt -w -ln bash -i 2 -ci <file>
2024-12-11 20:07:38 +01:00
Erik Flodin bb21c9a267
Run tests directly on github runner instead of in the docker image
Some checks are pending
Tests / Tests (ubuntu-20.04) (push) Waiting to run
Tests / Tests (ubuntu-24.04) (push) Waiting to run
Tests / Tests (macos-13) (push) Waiting to run
Tests / Tests (macos-15) (push) Waiting to run
As this makes it possible to run the tests on different systems. Initially
ubuntu (20.04 and 24.04) and macOs (13 and 15).
2024-12-10 21:51:58 +01:00
Erik Flodin 4511f5d9c6
Use git ls-files to list files to encrypt
By using git ls-files instead of bash we can support ** also on macOS where the
included bash version (3) doesn't support globstar.
2024-12-10 21:51:58 +01:00
Erik Flodin 216d49ceef
Run mandoc or groff instead of man.REAL to check man page
Also fix all warnings reported by mandoc and apply some of the recommendations
from https://liw.fi/manpages/.
2024-12-10 21:29:27 +01:00
Erik Flodin 24772e7b4b
Fix test_upgrade when running outside of docker image
E.g. direct on github runner.
2024-12-10 21:28:51 +01:00
Erik Flodin 3093460d41
Ignore __pycache__/ 2024-12-10 21:28:51 +01:00
Erik Flodin c232894792
Make test_unit_configure_paths work with bash 3
Bash 3 doesn't understand declare -p so use regular parameter expansion instead
to print all variables that begin with YADM_ or GIT_.
2024-12-10 21:28:50 +01:00
Erik Flodin 8c2f833b43
Support overriding distro and distro family
Fixes #430.
2024-12-10 18:35:26 +01:00
Erik Flodin c092b7c099
Ignore case in alt and default template processor conditions
Some checks are pending
Tests / Tests (push) Waiting to run
This aligns all conditions with distro and distro_family.

Suggestion from #456.
2024-12-09 23:50:49 +01:00
Erik Flodin 6c1970fb41
Set distro family from ID line if no ID_LIKE line is found
See #456.
2024-12-09 23:13:43 +01:00
Erik Flodin 18d5f66542
Ignore case for yadm.distro and .distro_family in default template
Same as b2b0b14 but for if statements in default template processor.
2024-12-09 22:54:41 +01:00
Erik Flodin b2b0b143d6
Refactor alt handling
Some checks failed
Tests / Tests (push) Has been cancelled
* Simplify score_file() by using case in instead of nested ifs with regexps.
* Merge record_score() and record_template().
* Alt condition processing no longer stops when a template condition is seen
  but continues processing to verify that all conditions are valid (as the
  documentation says it should). Fixes #478.
* Support alt dirs with deeply nested tracked files (fixes #490).
* Use git ls-files to filter out which tracked files to consider for alt
  processing. Should speed up auto-alt (#505).
* Use nocasematch when comparing distro and distro_family. Fixed #455.
2024-12-06 23:10:52 +01:00
Erik Flodin b164d03594
Make relative_path match full dir and not just a prefix
Before this change, relative_path "/A/B/C" "/A/B/CD" would return "" instead of
the correct "../CD".
2024-12-06 23:10:49 +01:00
Erik Flodin 0b91140ea8
Output the actual paths in help message
Some checks are pending
Tests / Tests (push) Waiting to run
Fixes #376.
2024-12-06 00:07:45 +01:00
Erik Flodin 6ee9b472d1
Merge pull request #507 from AVM-Martin/fix/reset-yadm-work-index
Some checks failed
Tests / Tests (push) Has been cancelled
fix(clone): reset index of YADM_WORK
2024-11-29 23:10:35 +01:00
AVM.Martin ae3a149449
style: use pathspec for consistency 2024-11-26 19:22:18 +07:00
AVM.Martin 85e8c1ddfc
docs: fix comment 2024-11-26 19:21:18 +07:00
AVM.Martin a7939bec7b
style: join arguments 2024-11-26 19:20:59 +07:00
Erik Flodin ec10041024
Call bootstrap scripts with a tty
Some checks failed
Tests / Tests (push) Has been cancelled
Inspired by #449 but using read instead of mapfile to make it work with bash
3. Fixes #344.
2024-11-24 20:18:22 +01:00
Erik Flodin 3a1b236147
Link features in README.md to yadm.io (as suggested in #346)
Some checks are pending
Tests / Tests (push) Waiting to run
2024-11-24 17:03:56 +01:00
Erik Flodin 30fa6f08a4
Update testbed docker image
Some checks failed
Tests / Tests (push) Has been cancelled
* Update base image to Ubuntu 24.10. This uses a python version where j2cli no
  longer works when installed using pip so use the version from Ubuntu instead
  which has been patched to work.

* Update shellcheck, pylint, pytest, isort, flake8, black and yamllint to the
  latest versions. This closes #502.

* Use a longer expect timeout to fix tests failing when gpg is killed due to
  this timeout.

* Explicitly flush gpg-agent's cached passwords to fix failing tests with
  latest gnupg. Also clean up after tests to avoid having gpg-agents running
  after the test (e.g. when running tests directly without docker).
2024-11-11 22:30:41 +01:00
Erik Flodin 640b324401
Prepare for version 3.3.0
Some checks failed
Tests / Tests (push) Has been cancelled
* Support nested ifs in default template (#436)
 * Support include and ifs in default template includes (#406)
 * Support environment variables in ifs in default template (#488)
 * Support != in default template (#358, #477)
 * Fix multiple classes in default template on macOS (#437)
2024-11-08 20:23:23 +01:00
Erik Flodin 8e5d4b1578
Pass classes as separate arguments to template_default
Some checks are pending
Tests / Tests (push) Waiting to run
To work around problem with passing newlines in variable with awk on
darwin. This fixes #437.
2024-11-08 19:54:14 +01:00
Erik Flodin d74a41b1b4
Merge pull request #497 from erijo/template-default
Some checks failed
Tests / Tests (push) Has been cancelled
Rewrite default template to handle nested ifs, != and env vars in if
2024-11-06 22:25:40 +01:00